code wiki / _hdl_build / nx_audio_census.nx
nx_audio_census.nx source
↩ module page · 117 lines · 8372 B
1// nx_audio_census.nx -- SOVEREIGN coverage census for the S-CLASS AUDIO ECOSYSTEM "omnivoice" (operator 2026-06-23:
2// audiobooks in chosen/generated voices, generate object sounds like a Tibetan copper/singing bowl, EXACT binaural,
3// sound mixing -> generating -> lossless = a full audio ecosystem). Grounded on REAL organ existence (org_resolve)
4// so it can't be fiction: a family is HAVE iff a real organ file exists, MISSING otherwise. Organ names GROUNDED by
5// a live runtime/ probe 2026-06-23 (we have a deep foundation already). The MISSING set = the honest S-class worklist.
6// Data in nx_seg_store (NO TSV). Mirrors nx_ng2_census. Gate: neg-control teeth; GREEN if grounded + HAVE>=1.
7// expect_exit: 0 license_tier: ORIGINAL
8import "nx_seg_store.nx"
9import "nx_syscalls.nx"
10const AU_MAGIC_2048: i64 = 2048
11
12const AU_STORE: *u8 = "knowledge/store/audio_eco"
13const NSTEPS: i64 = 19
14
15func cp(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
16func clen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
17func cpn(v: i64) -> i64 {
18 let bb: *u8 = sys_mmap(28); var m: i64 = v
19 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m }
20 let t: *u8 = sys_mmap(28); var k: i64 = 0
21 if m == 0 { t[0] = 48 as u8; k = 1 }
22 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
23 var i: i64 = 0; while i < k { bb[i] = t[k - 1 - i]; i = i + 1 }
24 sys_write(1, bb, k); return 0
25}
26func cstreq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 }
27func cexists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
28func cjoin(pfx: *u8, name: *u8, out: *u8) -> i64 { var o: i64 = 0; var i: i64 = 0; while pfx[i] != (0 as u8) { out[o] = pfx[i]; o = o + 1; i = i + 1 } i = 0; while name[i] != (0 as u8) { out[o] = name[i]; o = o + 1; i = i + 1 } out[o] = 0 as u8; return 0 }
29func org_resolve(name: *u8) -> i64 {
30 if cstreq(name, "-" as *u8) == 1 { return 0 }
31 let p: *u8 = sys_mmap(512)
32 cjoin("runtime/_hdl_build/" as *u8, name, p); if cexists(p) == 1 { return 1 }
33 cjoin("runtime/" as *u8, name, p); if cexists(p) == 1 { return 1 }
34 cjoin("runtime/wiki/" as *u8, name, p); if cexists(p) == 1 { return 1 }
35 return 0
36}
37func au_key(k: i64, out: *u8) -> i64 {
38 var o: i64 = 0; let pfx: *u8 = "cap:AUD:" as *u8; var i: i64 = 0
39 while pfx[i] != (0 as u8) { out[o] = pfx[i]; o = o + 1; i = i + 1 }
40 if k == 0 { out[o] = 48 as u8; o = o + 1 } else { let t: *u8 = sys_mmap(16); var m: i64 = k; var n: i64 = 0; while m > 0 { t[n] = (48 + (m % 10)) as u8; m = m / 10; n = n + 1 } var j: i64 = 0; while j < n { out[o] = t[n - 1 - j]; o = o + 1; j = j + 1 } }
41 out[o] = 0 as u8; return 0
42}
43func au_field(src: *u8, slen: i64, idx: i64, out: *u8) -> i64 {
44 var f: i64 = 0; var i: i64 = 0
45 while f < idx { if i >= slen { out[0] = 0 as u8; return 0 } if src[i] == (124 as u8) { f = f + 1 } i = i + 1 }
46 var o: i64 = 0; var g: i64 = 1
47 while g == 1 { if i >= slen { g = 0 } else { if src[i] == (124 as u8) { g = 0 } else { out[o] = src[i]; o = o + 1; i = i + 1 } } }
48 out[o] = 0 as u8; return 1
49}
50func sa(w: *i64, key: *u8, val: *u8) -> i64 { ss_add(w, 1, key, val, clen(val)); return 0 }
51
52func au_seed() -> i64 {
53 let w: *i64 = ss_begin()
54 // ---- FOUNDATION (grounded HAVE) ----
55 sa(w, "cap:AUD:1" as *u8, "WAV-PCM-OUTPUT|nx_audio_wav.nx|WAV + PCM file output HAVE (nx_audio_wav + nx_audio_pcm)" as *u8)
56 sa(w, "cap:AUD:2" as *u8, "SYNTH-OSC|nx_audio_synth.nx|oscillator + synthesis HAVE (nx_audio_synth + nx_audio_osc + nishi_synth)" as *u8)
57 sa(w, "cap:AUD:3" as *u8, "MIXING|nx_audio_mix.nx|multi-track mixing HAVE" as *u8)
58 sa(w, "cap:AUD:4" as *u8, "PAN-SPATIAL|nx_audio_spatial.nx|pan + spatial placement HAVE (nx_audio_spatial + nx_audio_pan)" as *u8)
59 sa(w, "cap:AUD:5" as *u8, "FX|nx_audio_fx.nx|audio effects HAVE" as *u8)
60 sa(w, "cap:AUD:6" as *u8, "RESAMPLE|nx_audio_resample.nx|sample-rate conversion HAVE" as *u8)
61 sa(w, "cap:AUD:7" as *u8, "CODEC|nx_codec.nx|audio codec HAVE (nx_codec + rd/perceptual variants)" as *u8)
62 sa(w, "cap:AUD:8" as *u8, "LPC|_wb_lpc.nx|linear predictive coding HAVE (the lossless basis; _wb_lpc + nv1_lpc)" as *u8)
63 sa(w, "cap:AUD:9" as *u8, "VOICE-CLONE|nx_voice_clone_synth.nx|voice clone / synth HAVE" as *u8)
64 sa(w, "cap:AUD:10" as *u8, "VOICEPRINT|nx_voiceprint.nx|speaker embedding / voiceprint HAVE" as *u8)
65 sa(w, "cap:AUD:11" as *u8, "DENOISE-ENHANCE|nx_denoise_spectral.nx|spectral denoise + enhance HAVE (+ nx_audio_enhance + nx_audio_dred)" as *u8)
66 sa(w, "cap:AUD:12" as *u8, "CAPTURE-PLAYBACK|nx_audio_capture.nx|capture + playback HAVE (nx_audio_capture + nx_audio_playback)" as *u8)
67 // ---- S-CLASS GAPS (the operator's named asks = the worklist) ----
68 sa(w, "cap:AUD:13" as *u8, "MODAL-OBJECT-SYNTH|-|MISSING: physical/MODAL synthesis of a specific object's resonance (Tibetan singing/copper bowl) -- have generic synth/osc, NOT object-modal damped-mode synthesis" as *u8)
69 sa(w, "cap:AUD:14" as *u8, "BINAURAL-HRTF|-|MISSING: EXACT binaural 3D (HRTF / ITD+ILD) -- have nx_audio_spatial (pan), not true head-related binaural" as *u8)
70 sa(w, "cap:AUD:15" as *u8, "LOSSLESS-BITEXACT|-|MISSING/verify: bit-exact LOSSLESS audio codec (FLAC-class) -- have LPC + rate-distortion codec, the lossless-bit-exact path = wire+verify" as *u8)
71 sa(w, "cap:AUD:16" as *u8, "AUDIOBOOK|-|MISSING: long-form audiobook in a CHOSEN/GENERATED voice (compose text->chapters->nx_voice_clone_synth->nx_audio_wav)" as *u8)
72 sa(w, "cap:AUD:17" as *u8, "OWNVOICE-TRANSLATE|-|MISSING: speech->translate->resynth in the SAME voice (compose nx_voiceprint + nx_mt_core + nx_voice_clone_synth + nx_voice_codec)" as *u8)
73 sa(w, "cap:AUD:18" as *u8, "MASTERING-CHAIN|-|MISSING: EQ + dynamic-range-compression + limiter master chain (have nx_audio_fx/mix primitives, not the chain)" as *u8)
74 sa(w, "cap:AUD:19" as *u8, "MUSIC-GEN|-|MISSING: music/song generation (have synth/osc; learned/structured music gen = gap)" as *u8)
75 ss_commit(AU_STORE, w, sys_now_realtime_sec())
76 return 0
77}
78
79func main() -> i64 {
80 cp("=== nx_audio_census: S-CLASS AUDIO ECOSYSTEM coverage (omnivoice; status from REAL organs, no TSV) ===\n" as *u8)
81 au_seed()
82 let h: *i64 = ss_open(AU_STORE)
83 let pq: *i64 = sys_mmap(16) as *i64
84 let lq: *i64 = sys_mmap(16) as *i64
85 var have: i64 = 0; var missing: i64 = 0
86 let miss_buf: *u8 = sys_mmap(AU_MAGIC_2048); var mo: i64 = 0
87 var k: i64 = 1
88 while k <= NSTEPS {
89 let key: *u8 = sys_mmap(64); au_key(k, key)
90 if ss_hget(h, key, pq, lq) == 1 {
91 let val: *u8 = pq[0] as *u8; let vl: i64 = lq[0]
92 let node: *u8 = sys_mmap(96); let organ: *u8 = sys_mmap(96); let note: *u8 = sys_mmap(240)
93 au_field(val, vl, 0, node); au_field(val, vl, 1, organ); au_field(val, vl, 2, note)
94 let isb: i64 = org_resolve(organ)
95 if isb == 1 { have = have + 1; cp(" [HAVE] " as *u8) }
96 else { missing = missing + 1; cp(" [MISSING] " as *u8); var z: i64 = 0; while node[z] != (0 as u8) { miss_buf[mo] = node[z]; mo = mo + 1; z = z + 1 } miss_buf[mo] = 32 as u8; mo = mo + 1 }
97 cp(node); cp(" <= " as *u8); cp(organ); cp(" -- " as *u8); cp(note); cp("\n" as *u8)
98 }
99 k = k + 1
100 }
101 miss_buf[mo] = 0 as u8
102 cp(" COVERAGE: HAVE=" as *u8); cpn(have); cp(" MISSING=" as *u8); cpn(missing); cp(" of " as *u8); cpn(NSTEPS); cp("\n" as *u8)
103 cp(" >> S-CLASS WORKLIST (the gaps to build) = " as *u8); cp(miss_buf); cp("\n" as *u8)
104
105 let ncr: i64 = org_resolve("nx_audio_wav.nx" as *u8)
106 let ncf: i64 = org_resolve("nx_zzz_nonexistent.nx" as *u8)
107 cp(" neg-control: built(nx_audio_wav.nx)=" as *u8); cpn(ncr); cp(" (expect 1) built(fake)=" as *u8); cpn(ncf); cp(" (expect 0)\n" as *u8)
108
109 var ok: i64 = 1
110 if have < 1 { ok = 0 }
111 if ncr != 1 { ok = 0 }
112 if ncf != 0 { ok = 0 }
113 cp(" verdict=" as *u8)
114 if ok == 1 { cp("GREEN (deep audio foundation grounded on real organs; the MISSING worklist is the S-class gap set; teeth)\n" as *u8); sys_exit(0); return 0 }
115 cp("RED\n" as *u8)
116 sys_exit(1); return 1
117}