AudioSampleBuffer::getMagnitude() to dB


#1

Hi there. How I can convert AudioSampleBuffer::getMagnitude() to dB units?


#2
static inline float ampTodB (const float amp) noexcept { return log10 (amp) * 20.f; }
static inline float dBToAmp (const float dB) noexcept { return pow (10.f, dB * (1.f / 20.f)); }

#3

There’s actually a Decibels class containing conversion functions like that.


#4

sorry, forgot you added that…


#5

Thank you