Forums > MaxMSP

MSP and Decibel Query

Feb 28 2011 | 11:20 am

I have a number box which is the result of a calculation that works out the perceived intensity of a sound source in dB at a changeable distance if the emitted source was 100 dB.

For example, if the sound source was 100 dB at 1 meter away, at 40.23 meters away, the perceived intensity in dB would be 73.93 dB.

Basically, I have got a cycle~ 440 object and I want the perceived intensity in dB to be represented on the gain~ slider, but the gain slider has a range from 0-157. How can I get the dB from the calculation to be represented on the gain~ slider. I understand that the calculation is in dBSPL and I have looked into atodb and dbtoa.

Any ideas would be greatly appreciated,

Mar 05 2011 | 10:51 pm

db inside digital audio and in real world are used in different manners. In digital audio 0dB is defined as the maximum possible amplitude – which equals an amplitude of 1. Therefore dB values in digital audio are usually negative. I.e. -6dB equals a amplitude of 0.5, -12db would result in 0.25 and so on.

In the ‘real’ world 0dB is defined as the lowest perceivable sound pressure – therefore the dB values are positive.

What remains the same is that if you raise a sound-pressure by 6dB you double the signal.

So the only thing you can represent inside your patch is the relative difference of the signal. In your example you have a drop in sound pressure of 26.07dB (100dB – 73.93dB).
[dbtoa] will calculate for you that this difference equals an amplitude (inside the digital audio processing) of 0.05.

To scale your signal feed [dbtoa] with the difference in dB of your ‘real world’ values (in your example it would be -26.07 as it is a drop in sound pressure) and multiply your signal from the [cycle~] with the resulting value using [+~].

If it comes to the [gain~] object you have to notice that it applies a logarithmic scale internally and that is uses what is called headroom. (See the help patch). At a value of 128 is multiplies the in incoming signal by 1 (in other words the signal is unchanged). A drop of 10 steps at the [gain~] equals a drop of 6dB or half of the amplitude. So at 118 the [gain~] will multiply the incoming signal by 0.5 (== -6dB), at 108 with 0.25 (== -12dB) and so on.

The rest is just a very little math….


Mar 06 2011 | 10:56 pm

"and multiply your signal from the [cycle~] with the resulting value using [+~]."
–> i meant [*~] of course… ;)

Viewing 3 posts - 1 through 3 (of 3 total)

Forums > MaxMSP