nx_lpc_synth.nx
buildroot/runtime/nx_lpc_synth.nx
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
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
| 29 | const NX_MAGIC_32767: i64 = 32767 |
| 30 | const NX_MAGIC_32768: i64 = 32768 |
| 31 | const NX_MAGIC_2048: i64 = 2048 |
| 32 | const NX_MAGIC_4096: i64 = 4096 |
| 33 | const NX_MAGIC_6144: i64 = 6144 |
| 34 | const NX_MAGIC_536870912: i64 = 536870912 |
| 35 | const NX_MAGIC_268435456: i64 = 268435456 |
| 36 | const NX_MAGIC_134217728: i64 = 134217728 |
| 37 | const NX_MAGIC_67108864: i64 = 67108864 |
| 39 | const NX_LPC_Q: i64 = 30 |
functions
| 42 | func _i16_load_le(p: *u8, n: i64) -> i64 |
| 51 | func _i16_store_le_sat(p: *u8, n: i64, v: i64) -> i64 |
| 62 | func _i64_load_le(p: *u8, n: i64) -> i64 |
| 74 | func nx_lpc_synth(e_pcm: *u8, n_samples: i64, |
| 115 | func nx_lpc_synth_roundtrip_test(scratch: *u8) -> i64 |