code wiki / _hdl_build / nx_gamemusic_gate.nx

nx_gamemusic_gate.nx

buildroot/runtime/_hdl_build/nx_gamemusic_gate.nx

9372 B213 linesdepth 6pulls 10 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_gamemusic_gate.nx -- CERTIFICATION of nx_gamemusic, completing `audio-sfx-music`. The SFX half is already proven by nx_game_audio_gate (3/3, real WAV). This gate proves the MUSIC half so the capability can honestly be called HAVE rather than inferred from SFX alone. T1 EXACT equal-temperament octaves: A4=440 -> A5=880 -> A3=220, no drift T2 DETERMINISTIC render: same song rendered twice -> byte-identical samples T3 DATA-DRIVEN: a different song array produces different audio (melody is data, not code) T4 SATURATING MIX: layering loud tracks clamps instead of wrapping (no integer-overflow crackle) T5 PER-NOTE ENVELOPE: a note attacks then decays (it does not click on at full amplitude) T6 ★ANTI-VACUITY: output is non-silent AND pitch is real -- a high note has strictly more zero-crossings than a low note. Silence or a constant would satisfy T2/T4 vacuously. T7 REAL ARTIFACT: a playable WAV is written to disk via the existing nx_audio_wav writer T8 composes with nx_gamesave: the song DATA round-trips through save/load license_tier: ORIGINAL expect_exit: 0

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_gamemusic.nx nx_audio_wav.nx nx_gamesave.nx nx_gamemusic_gate.nx

imports: nx_syscalls.nxnx_gamemusic.nxnx_audio_wav.nxnx_gamesave.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main mw sys_write mus_note_freq mus_base_hz mn sys_write ↻ sys_mmap sys_mmap ↻ mus_song_samples clearbuf mus_render sys_mmap ↻ mus_note_freq ↻ sfx_tone mus_env mus_mixadd mus_env ↻ zerocross sys_unlinkat wav_render_stereo wav_put_str wav_put_u32 wav_put_u16 wav_put_i16 wav_save sys_openat_wr sys_write ↻ sys_close sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ↻ gs_save sys_mmap ↻ put64 gsc_put64 gs_cksum

structs

none

consts

none

functions

19func mw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
20func mn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
29func zerocross(b: *i64, n: i64) -> i64
called by 1: main
39func clearbuf(b: *i64, n: i64) -> i64 { var i: i64=0; while i<n { b[i]=0; i=i+1 } return 0 }
called by 1: main
41func main() -> i64