Skip to content

Add SILK pitch analysis core#158

Merged
thomas-vilte merged 1 commit into
pion:mainfrom
thomas-vilte:feat/silk-pitch-analysis
Jul 22, 2026
Merged

Add SILK pitch analysis core#158
thomas-vilte merged 1 commit into
pion:mainfrom
thomas-vilte:feat/silk-pitch-analysis

Conversation

@thomas-vilte

Copy link
Copy Markdown
Member

Description

adds pitchAnalysisCore — the two-stage pitch estimator (silk_pitch_analysis_core_FLP): a coarse search at 4 kHz over the full lag range, followed by a refined search at 8 kHz (and, for 16 kHz input, a stage-3 refinement back in the original signal) using the codebook tables in pitch_est_tables.c. Also includes the two escape paths (low first-stage correlation, no codebook candidate above threshold) and the previous-lag continuity bias that favors sticking with the prior frame's pitch

ported from pitch_analysis_core_FLP.c and pitch_est_tables.c/pitch_est_defines.h

left find_pitch_lags.go out of this one even though the original split plan grouped it here — it's a method on *Encoder (needs previousLag, ltpCorr, etc.), and that type doesn't exist in this package yet. Moving it to land alongside find_pred_coefs.go, once there's an encoder to hang it off of

one scope note carried over from the original code: only 8 and 16 kHz are handled today (12 kHz needs resamplerDown2_3, which isn't ported yet) — this matches the upstream file as-is, not something reduced during the split

Reference issue

part of the SILK encoder series (#157)

Co-authored-by: François Allais <francois.allais@hotmail.com>
@thomas-vilte
thomas-vilte requested a review from FrantaBOT July 21, 2026 18:16
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.91%. Comparing base (ad89c91) to head (7689d8e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #158      +/-   ##
==========================================
+ Coverage   88.57%   88.91%   +0.34%     
==========================================
  Files          38       39       +1     
  Lines        8252     8506     +254     
==========================================
+ Hits         7309     7563     +254     
  Misses        712      712              
  Partials      231      231              
Flag Coverage Δ
go 88.91% <100.00%> (+0.34%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This was referenced Jul 21, 2026
@thomas-vilte
thomas-vilte merged commit a8d0fa3 into pion:main Jul 22, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants