Visualizing volume of PCM samples

Posted by genevincent on Stack Overflow See other posts from Stack Overflow or by genevincent
Published on 2010-03-26T22:52:07Z Indexed on 2010/03/26 23:03 UTC
Read the original article Hit count: 515

Filed under:
|
|
|
|

I have several chunks of PCM audio (G.711) in my C++ application. I would like to visualize the different audio volume in each of these chunks.

My first attempt was to calculate the average of the sample values for each chunk and use that as an a volume indicator, but this doesn't work well. I do get 0 for chunks with silence and differing values for chunks with audio, but the values only differ slighly and don't seem to resemble the actual volume.

What would be a better algorithem calculate the volume ?

I hear G.711 audio is logarithmic PCM. How should I take that into account ?

© Stack Overflow or respective owner

Related posts about c++

Related posts about audio