Visualizing volume of PCM samples

穿精又带淫゛_ 提交于 2019-12-04 19:35:13

Note, I haven't worked with G.711 PCM audio myself, but I presume that you are performing the correct conversion from the encoded amplitude to an actual amplitude before processing the values.

You'd expect the average value of most samples to be approximately zero as sound waveforms oscillate either side of zero.

A crude volume calculation would be rms (root mean square), i.e. taking a rolling average of the square of the samples and take the square root of that average. This will give you a postive quantity when there is some sound; the quantity is related to the power represented in the waveform.

For something better related to human perception of volume you may want to investigate the sort of techniques used in Replay Gain.

If you're feeling ambitious, you can download G.711 from the ITU-web site, and spend the next few weeks (or maybe more) implementing it.

If you're lazier (or more sensible) than that, you can download G.191 instead -- it includes source code to compress and decompress G.711 encoded data.

Once you've decoded it, visualizing the volume should be a whole lot easier.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!