Smart Volume: Studio-Quality AGC & Intelligent Loudness Compensation#317
Smart Volume: Studio-Quality AGC & Intelligent Loudness Compensation#317djbob2000 wants to merge 11 commits into
Conversation
…ualizer improvements
…stack allocation for performance and update LoudnessEqualizer for RT-thread efficiency
7243b62 to
0dca336
Compare
…allel using SIMD4 and consolidate sidechain filtering in LoudnessEqualizer.
|
Hey everyone, I read your feedback and I hear you. I’ve fixed everything you asked for. Please make sure to share your thoughts on the updated AGC + ISO226. I tried to make the AGC as universal as possible — I believe it’s significantly better than SoundSource Magic Boost, and I took inspiration from professional audio solutions. Let’s make this product useful for everyone. |
…nd in LoudnessEqualizer
1c6fd8b to
e62aa0c
Compare
1c9744b to
ed97c8b
Compare
…nd apply intensity scaling directly to band gains
f8c9846 to
6d3b29f
Compare
…sity range and reference phon levels
|
You can try my version https://github.com/djbob2000/FineTuneFork/releases/tag/1.8.0 |
|
@ronitsingh10 Do you think we should keep the AGC and Drive switches, or remove the adjustment and just enable them together with Loudness Compensation? |
|
@djbob2000, thank you for keeping this branch current. You merged You asked whether to keep the AGC and Drive switches or fold them under Loudness Compensation. I'd take a third path: remove the adjustments entirely, make both effects automatic, and keep them as two separate features instead of one bundled switch. One thing shifted while you were iterating. #304 merged on June 14 and closed #302, so the volume pumping this PR set out to fix is already gone on 1. Drop the Drive and Boost sliders, and compute both amounts automatically. 2. Move Loudness Compensation onto the output device, and let it switch automatically. 3. Keep the leveler as its own opt-in, off by default. Here is the focused PR I would merge happily: per-device automatic Loudness Compensation, one toggle, no sliders, cloning the AutoEQ device-keyed pattern, with the headroom logic doing what Boost did by hand (boost where digital headroom exists, otherwise attenuate the midband so it cannot clip, the way CamillaDSP and the RME do it). That keeps the strongest parts of your work and sheds the parts people won't understand. A few specifics to make it land:
Would you take the per-device compensation as the first PR? And if you see it differently, have a cleaner implementation in mind, or think another approach makes more sense, tell me. I would rather change the plan now than have you build one you do not believe in. |
Overview
This PR significantly upgrades the loudness engine in FineTune to resolve audible volume fluctuations, pumping artifacts, and bass loss, while introducing broadcasting-grade AGC controls. It addresses user feedback regarding volume stability and exposes granular controls over loudness dynamics and spectral compensation.
This PR closes and resolves the following issues:
Key Improvements
1. Dual-Band AGC Architecture & Phase-Linear Crossover
bassBand.currentGainDbwithin[masterBand.currentGainDb - 3.0, masterBand.currentGainDb + 3.0]). This prevents both unnatural independent bass pumping (upper limit) and excessive bass loss during heavy bass transients (lower limit).2. Orban-Style Progressive Ratio & Soft-Knee Compression
minRatioof 2:1 up to an infinitemaxRatiofor deep overshoots) using an exponential factor (progressiveRate = 0.15), removing harsh brickwall transitions.3. Silence Gate, Idle Gain Fallback & Exponential Slowdown
silenceGateIdleGainDbdefaulting to-24.0dB) instead of snapping to unity gain (0 dB), avoiding sudden volume pops when audio resumes.-12.0dB and-16.0dB. The active release speed is scaled down usingpow(gateSlowdownFactor, 1.0 - gatingFactor)(with a factor of0.086tuned for conversational speech dynamics) as the signal drops toward the gate threshold.4. Custom Parametric Sidechain Filter
KWeightingFilterhas been preserved and integrated into the test suite for behavior and frequency response comparison.5. Dedicated Post-AGC Compressor
-3.0dBFS, ratio10.0, attack1.0ms, release11.6ms) with a soft knee (0.1dB) and exponential release slowdown to catch transient overshoots that the slower AGC envelope follower misses.6. UI & Settings Enhancements
0.0to1.0(+24db max)) to control the input gain driving the leveler.3.0for greater flexibility) to adjust the amount of low-frequency equal-loudness compensation.unifiedLoudnessEnabledsettings transparently inside SettingsManager.swift.7. Equal-Loudness Compensator Upgrades & Headroom Management
peakDB) from all section gains. This guarantees that equal-loudness boosts will never exceed 0 dBFS or cause digital clipping, eliminating the dependency on downstream hard limiters.8. Stability & Routing Fixes
recreateTap(for:)to prevent audio dropouts or orphaned IO processes.Verification
Automated Tests
Comprehensive unit test suites cover the new dynamic features, filters, and safety bounds:
LinkwitzRileyCrossover2Tests(allpass reconstruction and magnitude response verification).AgcPhonOffsetSmootherTests(fast/slow smoothing paths).PostAgcCompressorTests(threshold, compression ratio, exponential release, and NaN safety).LoudnessEqualizerTests(gate slowdown, sudden drop protection, progressive ratio curves, and the new bass band clamping under heavy bass input).ISO226ContoursTests(estimated phon mapping curves and volume steps).Result:
** TEST SUCCEEDED **