code wiki / (root) / nx_voice_codec.nx

nx_voice_codec.nx

buildroot/runtime/nx_voice_codec.nx

13110 B353 linesdepth 4pulls 8 transitivereach 1 importersview sourcekind librarytopic voice
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_voice_frame.nx nx_lpc.nx nx_vad.nx nx_voice_fec.nx nx_voice_codec_tier.nx nx_voice_codec.nx nx_voice_codec_v1_adapter.nx

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

63struct VoiceCodecState

consts

46const NX_VC_VERDICT_UNKNOWN: i64 = 0
47const NX_VC_VERDICT_OK: i64 = 1
48const NX_VC_VERDICT_BUF_TOO_SMALL: i64 = 2
49const NX_VC_VERDICT_BAD_PAYLOAD: i64 = 3
50const NX_VC_VERDICT_FRAME_REJECTED: i64 = 4
51const NX_VC_VERDICT_BAD_PARAMS: i64 = 5
52const NX_VC_VERDICT_N: i64 = 6
55const NX_VC_MAX_LPC_ORDER: i64 = 20
58const NX_VC_RES_SUBSAMPLES: i64 = 8

functions

82func nx_voice_codec_state_init(
110func _w16(payload: *u8, off: i64, v: i64) -> i64
117func _r16(payload: *u8, off: i64) -> i64
128func nx_voice_codec_encode(
248func nx_voice_codec_decode(
349func nx_vc_verdict_is_valid(v: i64) -> i64