Skip to content

Fix rnnoise only works with 48khz audio#1266

Merged
ddennedy merged 1 commit into
masterfrom
rnnoise_sample_rate
Jul 3, 2026
Merged

Fix rnnoise only works with 48khz audio#1266
ddennedy merged 1 commit into
masterfrom
rnnoise_sample_rate

Conversation

@bmatherly

Copy link
Copy Markdown
Member

This change converts the sampling frequency to whatever was requested by the consumer. It also improves a rare underflow condition in the filter and uses fake samples to fill the gap.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the RNNoise module so it can operate internally at RNNoise’s required 48 kHz while returning audio at the consumer-requested sampling rate, and it improves handling of a rare short-output (“underflow”) scenario by synthesizing an extra padded chunk and carrying excess forward.

Changes:

  • Always request/process RNNoise audio at 48 kHz float, then resample back to the originally requested sampling rate.
  • Add logic to mitigate rare output shortfalls by processing an extra zero-padded RNNoise block and storing excess in carry buffers.
  • Manage a lazily-created resample filter instance and close it during teardown.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/modules/rnnoise/link_rnnoise.c Resamples link output back to the consumer-requested frequency after RNNoise processing and ensures proper cleanup.
src/modules/rnnoise/filter_rnnoise.c Adds resampling-back support in the filter path and introduces extra-chunk padding to reduce zero-fill underflows.

Comment thread src/modules/rnnoise/filter_rnnoise.c
Comment thread src/modules/rnnoise/filter_rnnoise.c Outdated
This change converts the sampling frequency to whatever was
requested by the consumer. It also improves a rare underflow
condition in the filter and uses fake samples to fill the gap.
@bmatherly bmatherly force-pushed the rnnoise_sample_rate branch from 99bfd5e to 1f3a798 Compare July 3, 2026 21:57
@ddennedy ddennedy added this to the v7.42.0 milestone Jul 3, 2026
@ddennedy ddennedy merged commit 76be501 into master Jul 3, 2026
23 checks passed
@ddennedy ddennedy deleted the rnnoise_sample_rate branch July 3, 2026 22:11
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.

3 participants