code wiki / (root) / nx_pitch_gate.nx

nx_pitch_gate.nx

buildroot/runtime/nx_pitch_gate.nx

5848 B146 linesdepth 2pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic pitch
docsdependenciesstructsconstsfunctions

about

nx_pitch_gate.nx -- REFEREE for VOICE-CLONE-001 rung 0 (sovereign F0). POSITIVE (voiced, real-ish): nx_voiced_vowel.wav is a glottal pitch glide 120 -> 100 Hz @ 8 kHz. The detector MUST (a) report ~120 Hz in an early window and ~100 Hz in a late window, (b) TRACK the downward glide (early_f0 > late_f0), and (c) flag both windows VOICED. NEG-CONTROL #1 (synthetic): a deterministic white-noise buffer MUST read UNVOICED. If noise reads voiced the detector is worthless -> RED. NEG-CONTROL #2 (real data): nx_speech_mixed.wav is voiced->unvoiced->voiced. The middle (unvoiced) third MUST read UNVOICED while the outer thirds read VOICED -- a discrimination the synthetic noise control can't give. Every measured value is PRINTED (no fabricated greens). Evidence -> stdout + knowledge/status/pitch_gate.log. Exit 0 GREEN / 1 RED. Sovereign: nx_syscalls + nx_pitch only. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_pitch.nx nx_pitch_gate.nx

imports: nx_syscalls.nxnx_pitch.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_openat_append gp sys_write gn sys_mmap sys_write ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close analyze sys_mmap ↻ nx_pitch_f0 _px_i16 nx_pitch_is_voiced gp ↻ gn ↻ gen_noise sys_close ↻ sys_exit

structs

none

consts

20const FS: i64 = 8000
21const MINLAG: i64 = 25 // fs / 320 Hz
22const MAXLAG: i64 = 114 // fs / 70 Hz
23const WIN: i64 = 480
24const HDR: i64 = 44 // canonical RIFF/WAVE header bytes

functions

27func gp(logfd: i64, s: *u8) -> i64
called by 2: analyzemain calls 1: sys_write
35func gn(logfd: i64, v: i64) -> i64
called by 2: analyzemain calls 2: sys_mmapsys_write
52func analyze(logfd: i64, label: *u8, pcm: *u8, start: i64, vflag: *i64) -> i64
69func gen_noise(buf: *u8, nsamp: i64) -> i64
called by 1: main
84func main() -> i64