code wiki / (root) / nx_voice_read.nx

nx_voice_read.nx

buildroot/runtime/nx_voice_read.nx

3598 B82 linesdepth 4pulls 4 transitivereach 2 importersview sourcekind librarytopic voice
docsdependenciesstructsconstsfunctions

about

nx_voice_read.nx -- VOICE-CLONE-001 rung 5-FUSE: a CLONED VOICE READING WORDS. Fuses the two halves of the arc: * rung 5a (nx_phoneme_synth) provides ARTICULATION -- WHAT is said (the phoneme sequence, the formant trajectory over time). * a parametric SPEAKER IDENTITY provides WHO says it -- a consistent vocal-tract-length warp (every formant scaled by warp_num/warp_den) plus the speaker's F0. Scaling all formants by one factor is VTLN (vocal-tract length normalization): it preserves the formant RATIOS that make /a/ an /a/, while shifting the whole spectrum to a different-sized tract -- i.e. a different person saying the same word. The phoneme inventory is DATA in formant-Hz (record = [F1,F2,F3,voiced,dur]); at read time each formant is warped to the speaker and converted to a 2-pole resonator coefficient a1 = 2*r*cos(2*pi*F/fs) (r=0.95, matching nx_phoneme_synth). NOTE (tech debt): fx.nx has a CORDIC cos, but it imports syscalls.nx -> nx_syscalls.nx, which collides with this arc's nx_syscalls_x86_64.nx (two files, same symbols, no dedup). Until the arc's syscall module is unified, an inline integer cos (Taylor + quadrant reduction, err ~1e-3, plenty for formant tuning) is used here. license_tier: ORIGINAL module: nishi-core.audio.voice_read depends: nishi-core.audio.phoneme_synth capability: AUDIO_SPEAKER_READER

dependencies 2 imports · 2 importers

nx_syscalls_x86_64.nx nx_phoneme_synth.nx nx_voice_read.nx nx_g2p_gate.nx nx_voice_read_gate.nx

imports: nx_syscalls_x86_64.nxnx_phoneme_synth.nx

imported by: nx_g2p_gate.nxnx_voice_read_gate.nx

structs

none

consts

29const VR_MAGIC_65536: i64 = 65536
30const VR_MAGIC_4000: i64 = 4000
32const VR_2R_Q15: i64 = 62259 // 2*0.95 in Q15
33const VR_PI_Q16: i64 = 205887 // pi in Q16.16
34const VR_HALFPI_Q16: i64 = 102944 // pi/2 in Q16.16
35const VR_FS: i64 = 8000

functions

38func _vr_cosq16(th: i64) -> i64
called by 1: _vr_a1
54func _vr_a1(f_hz: i64) -> i64
called by 1: nx_voice_read calls 1: _vr_cosq16
65func nx_voice_read(hz_seq: *i64, n_phon: i64, f0_hz: i64,
called by 2: mainmain calls 2: _vr_a1nx_phoneme_synth