code wiki / (root) / nx_lpc_synth.nx

nx_lpc_synth.nx

buildroot/runtime/nx_lpc_synth.nx

6280 B181 linesdepth 3pulls 3 transitivereach 6 importersview sourcekind librarytopic lpc
docsdependenciesstructsconstsfunctions

about

nx_lpc_synth.nx -- LPC synthesis filter (Arc 1 Phase A.3). Counterpart to nx_lpc_autocorr + nx_lpc_levinson. Given LPC predictor coefs a[1..p] (Q30) and residual e[0..N-1] (i16 PCM signed), reconstruct the speech signal: s[n] = e[n] + Σ_{k=1..p} a[k] * s[n-k] (Note: prediction was s_pred[n] = -Σ a[k] s[n-k] making residual e[n] = s[n] - s_pred[n] = s[n] + Σ a[k] s[n-k]. Inverting that: s[n] = e[n] - Σ a[k] s[n-k] ... but the standard convention used in Levinson is a[k] satisfying s[n] + Σ a[k] s[n-k] = e[n], so s[n] = e[n] - Σ a[k] s[n-k]. Match our sign convention.) Per [[feedback-bits-up-exceed-never-match]]: integer-only IIR pole filter. Patent-clean foundation for sovereign nx_voice_codec. Inputs: e_pcm: i16 LE residual signal (N * 2 bytes) n: number of samples a_q30: i64 LE LPC coefs (p * 8 bytes) from nx_lpc_levinson p: LPC order s_out: i16 LE reconstructed signal buffer (N * 2 bytes) Caller responsibility: s_out should be zeroed for n < 0 (we use only n >= 0 history; initial taps treated as 0).

dependencies 1 imports · 4 importers

nx_syscalls_x86_64.nx nx_lpc_synth.nx nx_voice_clone_synth.nx nx_voice_codec_v2.nx nx_voice_v2_gate.nx nx_vox_tract.nx

imports: nx_syscalls_x86_64.nx

imported by: nx_voice_clone_synth.nxnx_voice_codec_v2.nxnx_voice_v2_gate.nxnx_vox_tract.nx

structs

none

consts

29const NX_MAGIC_32767: i64 = 32767
30const NX_MAGIC_32768: i64 = 32768
31const NX_MAGIC_2048: i64 = 2048
32const NX_MAGIC_4096: i64 = 4096
33const NX_MAGIC_6144: i64 = 6144
34const NX_MAGIC_536870912: i64 = 536870912
35const NX_MAGIC_268435456: i64 = 268435456
36const NX_MAGIC_134217728: i64 = 134217728
37const NX_MAGIC_67108864: i64 = 67108864
39const NX_LPC_Q: i64 = 30

functions

42func _i16_load_le(p: *u8, n: i64) -> i64
51func _i16_store_le_sat(p: *u8, n: i64, v: i64) -> i64
62func _i64_load_le(p: *u8, n: i64) -> i64
74func nx_lpc_synth(e_pcm: *u8, n_samples: i64,
115func nx_lpc_synth_roundtrip_test(scratch: *u8) -> i64