Author Topic: Loudness  (Read 4747 times)

r2d2

  • Posts: 4
Loudness
« on: 6 Jul '03 - 22:38 »
Hello
How do I find out the loudness of a wave-file at a special position?
thank you

kchabot

  • Posts: 17
Re: Loudness
« Reply #1 on: 7 Jul '03 - 12:54 »
Try to use the BASS_ChannelGetData with an FFT constant (see help file). This returns an array of level values per audio frequency. (0->1)

Since bass sound less loud then higher tones, you should amplify the basses logarithmicly and amplify less the higher the frequency gets. (bass 10 times as strong as higher tones) (See the bass visualisation sample)

Then sum up all values of the amplified array. This value should be a good representation of the loudness of the audio at that point.

This is an idea to get you started. This mesures the loudness of the audio as a custom value. To get the actual loudness in dB (= RMS Loudness) you will have to calculate the values in a different way, but I am not sure how...

If you require the loudness to be in dB, but you don't require to get an exact read-out, you can simply calculate it by: = -(128 - ( x / z  * 128))
with Z being 1408 if you take 512 samples, 2816 if you take 1024 samples... and X being the calculated value from your fft array. This should give a value from -128dB till 0dB where 0 is the audio peak (max) and -128dB is silence.

NOTE: If you need to get the peak level and not loudness level, use the BASS_GetLevel function (see help file).

kchabot

  • Posts: 17
Re: Loudness
« Reply #2 on: 7 Jul '03 - 12:54 »
Hmmmm...

The smiley face is an 8 btw ;)

r2d2

  • Posts: 4
Position
« Reply #3 on: 8 Jul '03 - 16:18 »
It works. But till now I can only find out the loudness of a stream that is playing.

How can I find out the loudness without playing the file and just giving the position of which I want to find out the loudness?

Thanx
« Last Edit: 8 Jul '03 - 22:06 by r2d2 »

kchabot

  • Posts: 17
Re: Loudness
« Reply #4 on: 9 Jul '03 - 16:09 »
You can use a decoding channel.
This will allow you to return the loudness value with the song being played.

Use the DECODE flag when loading/creating the stream (see help file) and the channel_setPosition function to set the position...