feat(processor): improve adaptive filter tuning with speech metrics and noise-aware thresholds #6
+253
−92
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR enhances the adaptive filter tuning system to use more accurate measurements for filter parameter selection:
NoiseRemove adaptive thresholding: Replace fixed compand parameters with values derived from measured noise floor during silence analysis. Threshold scales to
noise_floor + 5dB(clamped to[-70dB, -40dB]) and expansion scales from 4-12dB based on noise severity across 4 tiers.Speech-specific spectral metrics: Filters that process speech content now prefer metrics from
SpeechProfile(speech-only regions) over full-file measurements. This provides more accurate tuning fortuneDeesserFull,tuneLA2ARatio,tuneLA2ARelease, andtuneDC1Declick.Fallback handling: Both improvements gracefully fall back to previous behavior when noise profile or speech metrics are unavailable.
Problem Solved
Previous adaptive tuning used full-file spectral measurements diluted by silence periods and fixed noise reduction parameters regardless of actual recording characteristics. This caused:
Changes
internal/processor/adaptive.go: Core adaptive logic withpreferSpeechMetric()helper and updatedtuneNoiseRemove()internal/processor/adaptive_test.go: 12 new test cases for metric preference and expansion scalinginternal/processor/filters.go: Updated default NoiseRemove config valuesinternal/logging/report.go: Enhanced rationale logging for adaptive decisionsTesting
just testpasses with all new and existing testsSummary by cubic
Improves adaptive filter tuning with speech-aware metrics and noise-aware compand thresholds for more transparent, consistent processing. Speech filters now use measurements from speech regions, and noise reduction adjusts to the actual noise floor.
Written for commit 7183b89. Summary will update on new commits.