nx_voice_read.nx
buildroot/runtime/nx_voice_read.nx
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
imports: nx_syscalls_x86_64.nxnx_phoneme_synth.nx
imported by: nx_g2p_gate.nxnx_voice_read_gate.nx
structs
| none |
consts
| 29 | const VR_MAGIC_65536: i64 = 65536 |
| 30 | const VR_MAGIC_4000: i64 = 4000 |
| 32 | const VR_2R_Q15: i64 = 62259 // 2*0.95 in Q15 |
| 33 | const VR_PI_Q16: i64 = 205887 // pi in Q16.16 |
| 34 | const VR_HALFPI_Q16: i64 = 102944 // pi/2 in Q16.16 |
| 35 | const VR_FS: i64 = 8000 |
functions
| 38 | func _vr_cosq16(th: i64) -> i64 called by 1: _vr_a1 |
| 54 | func _vr_a1(f_hz: i64) -> i64 |
| 65 | func nx_voice_read(hz_seq: *i64, n_phon: i64, f0_hz: i64, |