nx_tts_seq.nx
buildroot/runtime/nx_tts_seq.nx
about
nx_tts_seq.nx -- R2.2 sovereign voice: a PHONEME SEQUENCER (the architecture that generalizes to any word once
G2P feeds it). Upgrades R2.1 (which did /h/+vowels) with a real phoneme TABLE spanning the excitation classes:
VOICED vowels (glottal pulse), NASAL murmur (/m/,/n/ -- low-attenuated voiced), LIQUID (/l/), NOISE aspirate
(/h/), and VOICED-FRICATIVE (/v/,/z/ -- glottal + noise). A word = an array of phonemes; the sequencer renders
each through its 3 formants with the cascade state kept CONTINUOUS across boundaries (smooth coarticulation),
then writes a playable WAV. Synthesizes "hello" (/h/-/e/-/l/-/o/) = aspirate + vowel + liquid + vowel, spanning
3 excitation classes. Still zero ML, hardware-up. license_tier: ORIGINAL expect_exit: 0
dependencies 5 imports · 0 importers
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
structs
| none |
consts
| 13 | const F_MAGIC_1103515245: i64 = 1103515245 |
| 14 | const F_MAGIC_12345: i64 = 12345 |
| 15 | const F_MAGIC_32768: i64 = 32768 |
| 16 | const F_MAGIC_65536: i64 = 65536 |
| 17 | const F_MAGIC_1850: i64 = 1850 |
| 18 | const F_MAGIC_2500: i64 = 2500 |
| 19 | const F_MAGIC_1300: i64 = 1300 |
| 20 | const F_MAGIC_2700: i64 = 2700 |
| 21 | const F_MAGIC_32767: i64 = 32767 |
| 23 | const SR: i64 = 16000 |
| 24 | const F_PI: i64 = 0x40490FDB |
| 25 | const F_2PI: i64 = 0x40C90FDB |
| 26 | const F_ONE: i64 = 0x3F800000 |
| 28 | const EXC_VOICED: i64 = 0 |
| 29 | const EXC_NASAL: i64 = 1 |
| 30 | const EXC_NOISE: i64 = 2 |
| 31 | const EXC_VFRIC: i64 = 3 |
| 32 | const WAV_PATH: *u8 = "/mnt/c/Users/elder/AppData/Local/Temp/claude/C--Users-elder/e373474e-29d5-4488-9fe2-f191e3b1a524/scratchpad/elara_hello.wav" as *u8 |
functions
| 34 | func tw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 35 | func 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 } |
| 37 | func reson_ab(F: i64, BW: i64, out2: *i64) -> i64 |
| 46 | func cascade(x: i64, ab: *i64, st: *i64) -> i64 |
| 54 | func f32_to_int(m: i64) -> i64 called by 1: main |
| 62 | func glottal(phase: i64, period: i64) -> i64 |
| 70 | func prng(st: *i64) -> i64 { st[0] = (st[0]*F_MAGIC_1103515245 + F_MAGIC_12345) & 0x7FFFFFFF; return st[0] } called by 1: render_ph |
| 72 | func pB(buf: *u8, po: *i64, b: i64) -> i64 { buf[po[0]] = (b & 0xFF) as u8; po[0]=po[0]+1; return 0 } |
| 73 | func pU16(buf: *u8, po: *i64, v: i64) -> i64 { pB(buf,po,v); pB(buf,po,v>>8); return 0 } |
| 74 | func 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 } |
| 75 | func 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 |
| 79 | func render_ph(f1: i64, f2: i64, f3: i64, exc: i64, dur: i64, amp: i64, smp: *i64, so: *i64, st: *i64, rng: *i64, period: i64) -> i64 |
| 101 | func main() -> i64 |