Smart Volume: Studio-Quality Auto Gain Control#350
Closed
djbob2000 wants to merge 10 commits into
Closed
Conversation
added 10 commits
June 19, 2026 20:07
…scaded LR4 crossovers
…ts for 3-band compressor
…init to ensure RT safety
…llocation-free RT-safety
Author
|
@ronitsingh10 waiting your review or comments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
This PR significantly upgrades the dynamics engine in FineTune to resolve volume fluctuations, pumping artifacts, and bass loss, while introducing broadcasting-grade AGC controls. It addresses user feedback regarding dynamics stability by implementing a per-device Smart Volume feature and isolating legacy controls for future re-design.
This PR closes and resolves the following issues:
Key Improvements
1. Dual-Band AGC Architecture & Phase-Linear Crossover
bassBand.currentGainDbstrictly within[masterBand.currentGainDb - 3.0, masterBand.currentGainDb + 3.0]). This prevents unnatural independent bass pumping (upper clamp) and excessive bass loss during heavy bass transients (lower clamp).2. Proportional Ballistics, AGC Window & Level Protections
agcWindowSizeDb) around the target level where the AGC holds its current gain to eliminate breathing and pumping during steady passages.3. Silence Gate, Idle Gain Fallback & Real-Time Gating Slowdown
silenceGateIdleGainDbdefaulting to -24.0 dB) with a fallback time constant of 9.0 seconds, avoiding sudden volume pops when audio resumes.exp(lnGateSlowdownFactor * (1.0 - gatingFactor))using a factor of 0.086 tuned for conversational speech dynamics.4. Custom Parametric Sidechain Filter
SIMD4to process the three sidechain signals (mono downmix, bass band, and master band) in parallel in a single pass, ensuring allocation-free execution on the real-time audio thread.KWeightingFilterhas been preserved and integrated into the test suite for behavior and frequency response comparison.5. Dedicated 3-Band Post-AGC Compressor
thresholdDbdefaults to 0.0 dBFS,ratiodefaults to 7.6,attackMsdefaults to 2.9 ms, andreleaseMsdefaults to 11.6 ms).6. UI & Settings Enhancements
unifiedLoudnessEnabledsettings transparently inside SettingsManager.swift to enable per-device Smart Volume defaults if the legacy feature was previously configured.applyLoudnessEqualizationToTapto all device switch, connection, and update event loops in AudioEngine.swift to ensure Smart Volume parameters are dynamically applied across routes.