From 6d12ee10719c448574172ab8938401342caa28ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 23 Aug 2026 13:06:20 +0300 Subject: [PATCH] docs(opus-silkq/r1): voiced threshold sweep recorded; not the 12k mechanism --- crates/ec-opus/src/silk_enc.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/ec-opus/src/silk_enc.rs b/crates/ec-opus/src/silk_enc.rs index 5d5d7ad9..bfed315f 100644 --- a/crates/ec-opus/src/silk_enc.rs +++ b/crates/ec-opus/src/silk_enc.rs @@ -556,6 +556,13 @@ fn ncc(frame: &[f32], lag: usize) -> f32 { /// Coarse (4 kHz-equivalent decimated) search followed by a fine search at /// full rate, then a per-subframe refinement and contour-table lookup /// against the decoder's own `CB_LAGS_*` tables (`silk.rs:157-176`). +/// Voiced decision: libopus silk_find_pitch_lags starts from 0.6 (minus speech-activity, +/// tilt and prev-type terms); value measured on real speech, lane opus-silkq r1. +// Sweep 2026-08-23 (reelm 12k SILK-WB, corr/err_ratio): .35 -> .8081/11.4, +// .45 -> .8127/26.3, .55 -> .8106/44.8, .65 -> .7987/12.3; err non-monotonic, +// threshold is not the 12k mechanism. Kept at .35. +const VOICED_THRESHOLD: f32 = 0.35; + pub(crate) fn estimate_pitch( frame: &[f32], fs_khz: i32, @@ -631,7 +638,7 @@ pub(crate) fn estimate_pitch( } } } - let voiced = best_score > 0.35; + let voiced = best_score > VOICED_THRESHOLD; if !voiced { return Some(PitchEstimate { voiced: false,