code wiki / (root) / nx_tts_formant.nx

nx_tts_formant.nx

buildroot/runtime/nx_tts_formant.nx

7688 B153 linesdepth 5pulls 8 transitivereach 0 importersview sourcekind tooltopic tts
docsdependenciesstructsconstsfunctions

about

nx_tts_formant.nx -- R2.0 of the sovereign VOICE-YOU-CAN-HEAR (embodiment census R2, hardware-up rung 1). Classical source-filter FORMANT synthesis, zero ML: a glottal impulse train (pitch F0) cascaded through 3 formant resonators (2-pole, coeffs from the verified nx_f32_cos/nx_f32_exp) shapes it into vowel timbre; a phoneme sequence (a->i, "ai") is synthesized, normalized, and written as a real 16-bit PCM WAV she can PLAY. Robotic but INTELLIGIBLE and fully sovereign -- the audio-out path that serves BOTH bodies (digital + robot TTS). Later rungs: glottal pulse shape, consonants, G2P text->phonemes, then neural quality. license_tier: ORIGINAL expect_exit: 0

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_f32.nx nx_f32_sincos.nx nx_f32_exp.nx nx_f32_cvt.nx nx_tts_formant.nx

imports: nx_syscalls.nxnx_f32.nxnx_f32_sincos.nxnx_f32_exp.nxnx_f32_cvt.nx

imported by: nobody (leaf or entry point)

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

main tw sys_write sys_mmap reson_ab nx_i32_to_f32 nx_f32_div nx_f32_classify nx_f32_exp_field nx_f32_mant_field nx_f32_sign nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_f32_mul nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_f32_exp nx_f32_classify ↻ nx_f32_sign ↻ _f32_to_i32_rne nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_exp_field ↻ nx_f32_mant_field ↻ nx_i32_to_f32 ↻ _f32_ldexp nx_f32_classify ↻ nx_f32_exp_field ↻ nx_f32_sign ↻ nx_f32_neg nx_f32_cos nx_f32_classify ↻ _sc_range_reduce_pk nx_f32_mul ↻ _sc_f32_to_i32_rne nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_exp_field ↻

structs

none

consts

12const F_MAGIC_1150: i64 = 1150
13const F_MAGIC_2900: i64 = 2900
14const F_MAGIC_2250: i64 = 2250
15const F_MAGIC_32767: i64 = 32767
17const SR: i64 = 16000
18const F_PI: i64 = 0x40490FDB
19const F_2PI: i64 = 0x40C90FDB
20const WAV_PATH: *u8 = "/mnt/c/Users/elder/AppData/Local/Temp/claude/C--Users-elder/e373474e-29d5-4488-9fe2-f191e3b1a524/scratchpad/elara_voice.wav" as *u8

functions

22func tw(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
23func tn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{sys_write(1,"-" as *u8,1);m=0-m} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
26func reson_ab(F: i64, BW: i64, out2: *i64) -> i64
40func cascade(x: i64, ab: *i64, st: *i64) -> i64
called by 1: main calls 2: nx_f32_addnx_f32_mul
55func f32_to_int(m: i64) -> i64
called by 1: main
68func pB(buf: *u8, po: *i64, b: i64) -> i64 { buf[po[0]] = (b & 0xFF) as u8; po[0]=po[0]+1; return 0 }
called by 2: pU16pU32
69func pU16(buf: *u8, po: *i64, v: i64) -> i64 { pB(buf,po,v); pB(buf,po,v>>8); return 0 }
called by 1: main calls 1: pB
70func pU32(buf: *u8, po: *i64, v: i64) -> i64 { pB(buf,po,v); pB(buf,po,v>>8); pB(buf,po,v>>16); pB(buf,po,v>>24); return 0 }
called by 1: main calls 1: pB
71func pStr(buf: *u8, po: *i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ buf[po[0]]=s[i]; po[0]=po[0]+1; i=i+1 } return 0 }
called by 1: main
73func main() -> i64