code wiki / _hdl_build / nx_audio_critters.nx
nx_audio_critters.nx
buildroot/runtime/_hdl_build/nx_audio_critters.nx
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
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
structs
| none |
consts
| 9 | const K_MAGIC_4000: i64 = 4000 |
| 10 | const K_MAGIC_9000: i64 = 9000 |
| 11 | const K_MAGIC_4500: i64 = 4500 |
| 12 | const K_MAGIC_10000: i64 = 10000 |
| 13 | const K_MAGIC_6000: i64 = 6000 |
| 14 | const K_MAGIC_14000: i64 = 14000 |
| 15 | const K_MAGIC_3000: i64 = 3000 |
| 16 | const K_MAGIC_11000: i64 = 11000 |
| 18 | const SR: i64 = 48000 // Nyquist 24kHz: reaches the high/near-ultrasonic band dogs respond to |
| 19 | const NS: i64 = 48000 // 1.0 s |
| 20 | const AMP: i64 = 12000 |
functions
| 22 | func 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 |
| 23 | func cpn(v: i64) -> i64 called by 1: main |
| 31 | func c_abs(v: i64) -> i64 { if v<0 { return 0-v } return v } called by 1: peak |
| 32 | func 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 } |
| 33 | func clr(a: *i64, n: i64) -> i64 { var i: i64=0; while i<n { a[i]=0; i=i+1 } return 0 } |
| 36 | func place_sweep(acc: *i64, tmp: *i64, off: i64, seglen: i64, f0: i64, f1: i64) -> i64 |
| 49 | func save_wav(L: *i64, R: *i64, path: *u8) -> i64 |
| 55 | func mk_squeak(acc: *i64, tmp: *i64) -> i64 |
| 65 | func mk_chirp(acc: *i64, tmp: *i64) -> i64 |
| 72 | func mk_whistle(acc: *i64, tmp: *i64) -> i64 |
| 80 | func main() -> i64 |