code wiki / _hdl_build / nx_audio_lossless_gate.nx

nx_audio_lossless_gate.nx

buildroot/runtime/_hdl_build/nx_audio_lossless_gate.nx

5783 B109 linesdepth 7pulls 20 transitivereach 0 importersview sourcekind gate/prooftopic audio
docsdependenciesstructsconstsfunctions

about

nx_audio_lossless_gate.nx -- MEASURES the two audio-SOTA claims the operator named ("audio where its FLAC but with the dog hearing"): (1) LOSSLESS = bit-exact PCM round-trip through the sovereign LPC codec (the FLAC guarantee: integer linear prediction + exactly-coded residuals, no quantization); (2) WIDE SPECTRUM = a 30kHz "dog whistle" tone (human-inaudible >20kHz, dogs hear to ~45kHz) sampled at 96kHz (Nyquist 48kHz) survives encode->decode UNFILTERED. Three signals stress all codec paths: a voice+ ultrasonic tone mix (the headline), a predictable ramp (the LPC-compresses path), and pseudo-random noise (the raw-fallback path). GREEN iff EVERY signal round-trips bit-exact (max-err = 0) -- proven, not asserted. Reports the compression ratio vs raw PCM (the FLAC comparison). If any max-err != 0 the codec is NOT lossless and this goes RED (measure, don't assume). expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_video_client_wasm.nx nx_audio_lossless_gate.nx

imports: nx_syscalls.nxnx_video_client_wasm.nx

imported by: nobody (leaf or entry point)

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

main aw sys_write sys_mmap sinei sys_mmap ↻ wr_s16 roundtrip vc_lpc_encode vc_wr_u32 vc_lpc_rd_i16 vc_lpc_residuals vc_lpc_cost_bits vc_lpc_rice_put vc_lpc_bit_put vc_lpc_decode vc_rd_u32 vc_lpc_rd_i16 ↻ vc_lpc_wr_i16 vc_lpc_rice_get vc_lpc_bit_get rd_s16 an sys_mmap ↻ sys_write ↻

structs

none

consts

none

functions

13func aw(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
14func an(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
21func sinei(k: i64) -> i64
called by 1: main calls 1: sys_mmap
28func wr_s16(pcm: *u8, i: i64, v: i64) -> i64
called by 1: main
33func rd_s16(pcm: *u8, i: i64) -> i64
called by 1: roundtrip
40func roundtrip(pcm: *u8, N: i64, out: *u8, back: *u8, scr: *i64, bytes_out: *i64) -> i64
59func main() -> i64