Search code examples
audiowavpcmdirectsound

Sound pressure display for WAVE PCM data


The digital sound is playing using DirectSound device. It is necessary to display sound activity in decibels - like analog devices do.

What is the right way to calculate sound pressure from the WAVE PCM data (44100 Hz, 16-bit)?


Solution

  • if you just need an "idea" of the sound pressure, you can simply compute the log-energy on some time franmes of the signal: split the signal every N samples, compute 10*log(sum(xn**2)) where x are the N samples, and you get a value in the dB domain. If you need to precisely display a measure (that is your 0 dB matches say a mixtable 0dB), it is a bit more complicated.

    See here for more details:

    http://music.columbia.edu/pipermail/music-dsp/2002-April/048341.html