Perceptual loudness | analysis sources
With Rodio taking on more and more dsp like features it could be interesting to add a layer that analyzes the perceptual loudness. It should be relatively simple as an adaptation to AGC. There was also an earlier issue https://github.com/RustAudio/rodio/issues/722 where someone used Rodio to build a real-time audio visualizer.
With the no-playback feature this would enable building small audio analysis tools using Rodio. Such as adding replay gain to songs.
What do you all think?
It looks like there's already a port of libebur128 to Rust here sdroege/ebur128
On rare occasions when I mix something I wish I had some loudness normalization tool (Bitwig unfortunately does not have an embedded loudness measurement).
https://coaxion.net/blog/2020/09/porting-ebu-r128-audio-loudness-analysis-from-c-to-rust/ https://en.wikipedia.org/wiki/Loudness https://en.wikipedia.org/wiki/EBU_R_128
It's a nice idea. Generally we'd need to calculate RMS, apply a FIR/IIR filter, possibly by chaining biquads, and build a histogram. Then depending on which standard or weighting we'd want, we could build the calculation pipeline dynamically.
Maybe we should implement all these as basic building blocks first, then build loudness calculation on top of it (same as for the EQ proposal).
Besides EQ-ing the signal the EBUR128 also requires some gating (discarding quiet parts from calculations, Audacity wiki) .
@roderickvd Do you think the existing rust crate will not do? Re-implementing all the details (if we'd want to follow existing standards) may require quite substantial work. An alternative could be to have some simplified version that is good enough, but I'd used a standard if possible.
Ah I had only clicked the C link. Yes let's reuse what's there!
Since there is already a suitable lib this seems like a (relatively) easy issue. I've marked it as such, if that's not the case do remove the label.