nx_voice_frame.nx
buildroot/runtime/nx_voice_frame.nx
about
nx_voice_frame.nx -- Phase 4a foundation: sovereign voice-codec
frame format with CAS-chained sha256 headers.
Per docs/NISHI_COMMS_ROADMAP.md Phase 4: the frame format alone is
already a WIN over Opus on two axes (audit-ability + content-
addressability). Subsequent files compose LPC + range coder + FEC
on top of THIS frame structure.
Frame wire format (binary, all little-endian):
[0..3] magic = "NXVF" (4 bytes)
[4] version major (1) (1)
[5] tier hint (NX_HW_TIER_*) (1)
[6..7] bitrate kbps (2) -- 1..64
[8..9] sample_rate / 1000 (2) -- 8 | 16 | 24 | 48
[10] frame_ms (1) -- 10 | 20
[11] flags (1) -- bit0=voice; bit1=FEC; bit2=neural-residual
[12..15] sequence number (4)
[16..47] prev_frame_hash (32) sha256 of previous frame's full bytes
[48..49] payload_len (2)
[50..] payload (variable)
After payload, the receiver computes sha256(this entire frame
header+payload) and stashes for the NEXT frame's prev_hash. Chain.
genealogy_id: rfc_5285_rtp + rfc_6716_opus_packetisation +
nx_attest_merkle_chain
lineage_id: nishi_voice_frame_q10
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_voice_codec.nx
structs
| none |
consts
| 71 | const NX_VFR_VERDICT_UNKNOWN: i64 = 0 |
| 72 | const NX_VFR_VERDICT_OK: i64 = 1 |
| 73 | const NX_VFR_VERDICT_BAD_MAGIC: i64 = 2 |
| 74 | const NX_VFR_VERDICT_VERSION_MISMATCH: i64 = 3 |
| 75 | const NX_VFR_VERDICT_TRUNCATED: i64 = 4 |
| 76 | const NX_VFR_VERDICT_CHAIN_BROKEN: i64 = 5 |
| 77 | const NX_VFR_VERDICT_N: i64 = 6 |
| 80 | const NX_VFR_FLAG_VOICE: i64 = 1 |
| 81 | const NX_VFR_FLAG_FEC: i64 = 2 |
| 82 | const NX_VFR_FLAG_NEURAL_RESIDUAL: i64 = 4 |
| 84 | const NX_VFR_HEADER_BYTES: i64 = 50 |
functions
| 46 | func _h32(buf: *u8, n: i64, out: *u8) -> i64 called by 1: nx_voice_frame_parse |
| 92 | func nx_voice_frame_build( called by 1: nx_voice_codec_encode |
| 139 | func nx_voice_frame_parse( |
| 176 | func nx_voice_frame_sequence(buf: *u8) -> i64 |
| 181 | func nx_voice_frame_flags(buf: *u8) -> i64 |
| 186 | func nx_vfr_verdict_is_valid(v: i64) -> i64 |