Go Down

Topic: Audio Codec Shield output as dB (Read 2955 times) previous topic - next topic

pjrc

See what Doug says, he is quite right the 0.707 is just silly.
I agree 100%.  Multiplying peak-to-peak by 0.707 is only valid if the signals are always absolutely pure sine waves.  For natural sounds, or anything that's not a pure sine wave, this is incorrect.  The less the sound resembles a constant, unchanging, spectrally pure sine wave, the greater the error.  Or ordinary real-world sound, the error will be large, and will fluctuate as the sound changes.

pjrc

A true Root Mean Square calculation may not be practical on the Arduino,
It's probably possible, but difficult, on 8 bit AVR.  If one interrupt is serviced per sample, the amount of CPU overhead for merely acquiring the data without efficient DMA is probably a bigger limitation.

I can tell you true RMS on 16 bit, 44.1 kHz data on Teensy 3.2 running at 96 MHz (leveraging the Cortex-M4 DSP extensions) consumes approx 1% of the available CPU time.  Here's the source code, if anyone's interested.

Go Up