Originally Posted by Douglas Whates
I'm struggling to work something out here. I'm in the middle of mapping the notes for sample library project and I want to do a seemingly very simple thing, but I'm getting all in a jumble when it comes to dB vs linear scale.
Basically, I want to map the various dynamics evenly from the quietest to the loudest.
Imagine this scenario...
Let's say I have 150 wave files, each containing a single recording of a single key. They go from loud to quiet, with the quietest one peaking at -50dBFS, and the loudest peaking at -4.5dBFS. Let's say I want to have 64 even, linear levels of loudness from the quietest to the loudest. Can someone tell me how calculate what peak dBFS would correspond to each of those 64 levels?
I'm seeing all sorts of formula like dB = 20 * log (out_level / ref_level), but to be honest I can't work out if that's what I need, or if it is what I need - how do I use it!?
Unfortunately, trying to distribute a set of tones that are perceived with equal loudness changes (steps) is not a simple matter. If what you're trying to achieve is a perceived set of equal steps, it can really only be done if you define the acoustic playback level (listening SPL) and frequency.
It's easy to calculate an equal relative distribution of power levels
for the tones: i.e.: (-4.5 dB) - (-50 dB) = 45.5 dB range /64 steps =0.7 dB per step. You can find all sorts of references that will define the smallest level change that a human can perceive as being 1 dB and that a SPL change of 10 dB will seem to be a doubling of loudness for most listeners.
However, that's only a very rough approximation and only applies at mid frequencies and at moderate to loud sound pressure levels. At lower loudness levels of 50 dB SPL or less (true sound levels, not readings on a level display on a computer) it becomes harder for the "ear-brain" system to differentiate small differences in SPL. This effect is also highly frequency dependent so the perceptual differences in loudness also become compressed at frequencies below 200 Hz and above 8 kHz. (See Fletcher Munson curves.)
If you do a Google search for "dB to perceived loudness" you will find a number of good sources that may help you better understand the issues.
Anyway, to roughly begin to address your immediate need, you might start by using a transfer function for all tones that goes something like this:
For a 46 dB to 64 step TF:
-50 dB to -30 dB use 22 steps of 0.9 dB
-30 to -20 use 14 steps of 0.7 dB
-20 to -10 use 16 steps of 0.625 dB
-10 to -4 use 12 steps of 0.5 dB
That will work for mid-frequencies, but for any notes lower than 200 Hz you will have to "tweek" the transfer function to reduce the amount of signal reduction of the lower loudness samples. In other words, make the level change less for the low samples so the whole dynamic range is reduced from 46 dB to something like 30 dB.
Hope this points you in the right direction.
Sound level comparison chart and Fletcher Munson curves attached.