Loudness

BlitzPlus Forums/BlitzPlus Programming/Loudness

Arem(Posted 2005) [#1]
Any way to tell how loud a sound is playing? I don't want to know the volume of the sound but how loud the sound is at the point. IE an explosion would be much louder at the beginning than at the end. Any ideas?


CS_TBL(Posted 2005) [#2]
Do you need this in blitz, realtime? Or is a premade graph of the sound-envelope also adequate?

If so: you can do this with an envelope-follower. If you don't have this one in some tool you can make your own:

* make the wave mono and absolute. (mono: if you don't care for different envelopes in stereo)
* create a 'scan' variable and make it 'loud' .. (e.g. make it 1.0 or 127 or 32767 etc.)
* scan each sample of the wave

IF sample<scan THEN
scan=scan*.9999
ELSE
scan=sample
ENDIF

If I don't make mistakes (all from the head :), the scan-variable now 'follows' the peaks of the sound. It'll lead to a sawtooth'ish wave which you could smooth together to create a more fluid envelope.

When the whole scan is done, you've now an envelope of your sound which you could save as some file, to load it and read-out in your app. :D