I’m writing a simple dynamic range compressor as an extension to Pure Data as an exercise (I’m sure that many such extensions already exist), and, although my original plan was to have it work linearly with full-scale measurements, a quick glance at Audacity’s compressor opened my eyes so far that I should be using decibel measurements for this purpose instead.
Since I’ve started writing signal processing extensions for PD, I’ve really had to brush up on my mathematics, refamiliarising myself with logarithms in particular, but, despite flicking through Wikipedia and other online sources, I’m still having some trouble understanding how to get a decibel value from a digital sample.
I see that Audacity measures decibels in “dBfs,” or “decibel full-scale,” where 0 dBfs represents the LOUDEST that a sample can be (the clipping point, or 1 and -1 in full scale), and the rest is represented by how many decibels QUIETER a sample is from that point, so that we only deal with negative decibel values.
Still, the exact equation used to get this dBfs value escapes me, and I’m not proficient enough with code-sifting to look up exactly how Audacity, for example, does it, so perhaps any one of you with the necessary experience could give me a hint? How do I take a sample’s value in full scale and convert it to a dBfs value?
Thanks in advance.