nx_voice_codec.nx
buildroot/runtime/nx_voice_codec.nx
about
nx_voice_codec.nx -- NishiVoice v1: the composition primitive that
orchestrates VAD + LPC + residual quantisation + FEC + frame into
a single named sovereign voice codec. No Opus dependency. No
external code. Pure composition of nxc2 substrate primitives.
genealogy_id: nx_voice_frame_q10 + nx_lpc_q15 + nx_vad_q10 +
nx_voice_fec_q10 + nx_voice_codec_tier_dispatch_q10
lineage_id: nishi_voice_codec_v1_q10
Composition pipeline (encode):
PCM samples (Q-scale i64, frame-sized)
-> nx_vad_classify -> verdict (SILENCE / VOICE / NOISE / ...)
-> if SILENCE: payload = energy_byte (1 byte) + cn_seed (1)
-> else: nx_lpc_analyze -> order-N coefficients in Q15
residual = 8 evenly-spaced subsamples (16-bit each)
payload = [vad][order][coeffs * 2N][n_sub][sub * 2*n_sub]
-> nx_voice_frame_build -> wire frame with hash-chain header
-> nx_fec_encode_block appends FEC tail (half-res of previous frame)
Decode reverses:
frame bytes -> nx_voice_frame_parse -> payload bytes
-> if vad=SILENCE: synthesise comfort noise samples
-> else: read coeffs + subsamples; expand via
piecewise linear interpolation
v1 is the COMPOSITION skeleton. Bitrate optimisation (entropy
coding of residual via nx_range_coder, codebook-VQ of LPC) is the
v2 path documented in NISHI_COMMS_ROADMAP.md. The point of v1 is
to prove every substrate primitive composes end-to-end with no
external dependency.
dependencies 6 imports · 1 importers
imports: nx_syscalls.nxnx_voice_frame.nxnx_lpc.nxnx_vad.nxnx_voice_fec.nxnx_voice_codec_tier.nx
imported by: nx_voice_codec_v1_adapter.nx
structs
| 63 | struct VoiceCodecState |
consts
| 46 | const NX_VC_VERDICT_UNKNOWN: i64 = 0 |
| 47 | const NX_VC_VERDICT_OK: i64 = 1 |
| 48 | const NX_VC_VERDICT_BUF_TOO_SMALL: i64 = 2 |
| 49 | const NX_VC_VERDICT_BAD_PAYLOAD: i64 = 3 |
| 50 | const NX_VC_VERDICT_FRAME_REJECTED: i64 = 4 |
| 51 | const NX_VC_VERDICT_BAD_PARAMS: i64 = 5 |
| 52 | const NX_VC_VERDICT_N: i64 = 6 |
| 55 | const NX_VC_MAX_LPC_ORDER: i64 = 20 |
| 58 | const NX_VC_RES_SUBSAMPLES: i64 = 8 |
functions
| 82 | func nx_voice_codec_state_init( |
| 110 | func _w16(payload: *u8, off: i64, v: i64) -> i64 called by 1: nx_voice_codec_encode |
| 117 | func _r16(payload: *u8, off: i64) -> i64 called by 1: nx_voice_codec_decode |
| 128 | func nx_voice_codec_encode( |
| 248 | func nx_voice_codec_decode( |
| 349 | func nx_vc_verdict_is_valid(v: i64) -> i64 |