code wiki / _hdl_build / nx_audio_critters.nx

nx_audio_critters.nx

buildroot/runtime/_hdl_build/nx_audio_critters.nx

5044 B106 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tooltopic audio
docsdependenciesstructsconstsfunctions

about

nx_audio_critters.nx -- DOG-TEST sweep sounds (squeak / chirp / whistle), COMPOSED from the canonical audio engine (operator 2026-06-24: "make sure the most capabilities absorb when we dedup and keep the most s class"). DEDUP: the private sine table this organ used to carry is now absorbed INTO nx_audio_osc as osc_sine/osc_sweep (the engine's "later rung"), so there is ONE sine implementation; this organ just composes osc_sweep. 48kHz + high-frequency content (dogs hear far above humans; a dog whistle is ultrasonic). 16-bit PCM = lossless. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_audio_osc.nx nx_audio_wav.nx nx_audio_critters.nx

imports: nx_audio_osc.nxnx_audio_wav.nx

imported by: nobody (leaf or entry point)

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

main cp mk_squeak clr place_sweep osc_sweep osc_sin_unit osc_sin_s osc_qm osc_cos_s osc_qm ↻ save_wav wav_render_stereo wav_put_str wav_put_u32 wav_put_u16 wav_put_i16 wav_save sys_openat_wr sys_write sys_close cpn peak c_abs mk_chirp clr ↻ place_sweep ↻ mk_whistle clr ↻ place_sweep ↻

structs

none

consts

9const K_MAGIC_4000: i64 = 4000
10const K_MAGIC_9000: i64 = 9000
11const K_MAGIC_4500: i64 = 4500
12const K_MAGIC_10000: i64 = 10000
13const K_MAGIC_6000: i64 = 6000
14const K_MAGIC_14000: i64 = 14000
15const K_MAGIC_3000: i64 = 3000
16const K_MAGIC_11000: i64 = 11000
18const SR: i64 = 48000 // Nyquist 24kHz: reaches the high/near-ultrasonic band dogs respond to
19const NS: i64 = 48000 // 1.0 s
20const AMP: i64 = 12000

functions

22func cp(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
23func cpn(v: i64) -> i64
called by 1: main
31func c_abs(v: i64) -> i64 { if v<0 { return 0-v } return v }
called by 1: peak
32func peak(a: *i64, n: i64) -> i64 { var m: i64=0; var i: i64=0; while i<n { let v: i64=c_abs(a[i]); if v>m{m=v} i=i+1 } return m }
called by 1: main calls 1: c_abs
33func clr(a: *i64, n: i64) -> i64 { var i: i64=0; while i<n { a[i]=0; i=i+1 } return 0 }
36func place_sweep(acc: *i64, tmp: *i64, off: i64, seglen: i64, f0: i64, f1: i64) -> i64
49func save_wav(L: *i64, R: *i64, path: *u8) -> i64
called by 1: main calls 2: wav_render_stereowav_save
55func mk_squeak(acc: *i64, tmp: *i64) -> i64
called by 1: main calls 2: clrplace_sweep
65func mk_chirp(acc: *i64, tmp: *i64) -> i64
called by 1: main calls 2: clrplace_sweep
72func mk_whistle(acc: *i64, tmp: *i64) -> i64
called by 1: main calls 2: clrplace_sweep
80func main() -> i64