(electronic music)
Our ears can hear a wide range of sounds,
from extremely soft to extremely loud.
The sound pressure level of a jet taking off,
is something like a trillion times more
than the sound pressure level
of the soft sound of wind on leaves.
Like many physical quantities,
the way we perceive sound pressure levels
is based on ratios rather than differences.
That is, it is logarithmic rather than linear.
The decibel, DB,
is a logarithmic unit used to express the ratio
of two values of a physical quantity.
One of these values is often a standard reference value.
Time domain digital samples
do not have an absolute sound pressure level.
But the largest relative sound pressure level is one.
The dynamic range of human hearing is 120 DB.
Here is the equation for converting magnitude values to DB.
Magnitude spectral frequently converted to DB,
as this makes them easier to read and understand.
And better corresponds to how we perceive sounds.
As an example, lets look at the effect of windowing
on the spectrum of sinusoids that have a frequency
that is in between the frequencies of DFT bins.
Lets look at plotting magnitude spectra in decibels
and the effect of windowing.
We have seen than when an input sinusoid matches
the frequency of one of the DFT bins,
then we get a corresponding peak at the magnitude spectrum.
Lets look at what happens to the magnitude spectrum
when the input folds halfway between DFT bins.
So here we define one sine wave at bin 256,
and another sine wave at bin 256.5.
Here we take the magnitude spectra,
and here we take the magnitude spectrum of F2,
of the F2 sine wave using a hanning window.
So let's look at this plot.
In this plot we see that the sine at 256
is a clear peak.
With very little energy,
with actually no energy in the neighboring peaks.
These are all at zero.
You see a little bit of a line,
because of interpolation,
but the values are just zero.
But when you look at the sine wave
that's in 256.5, you see you get two peaks,
and you get some spreading
of the energy in neighboring bins.
And this spreading of energy goes quite far out.
Notice that when we look at the windowed sine wave,
at the DFT bin 256.5,
this spreading is much more contained
and that is because of the windowing.
Here is the code for doing this plot.
Now, let's consider taking the magnitude spectrum,
but instead of using a linear scale,
using a DB scale.
So the DB equation is here.
And again, we take these three magnitude spectra,
the original sine wave that corresponds
to DFT bin 256,
a sine wave that corresponds to bin 256.5,
and the windowed version of the sine wave
corresponding to 256.5.
So now when we plot the same plot,
it will look like this.
So now you can see that we have again,
a little bit more,
this is the original in red at 256.
And then the green one is at 256.5.
And by using the windowing,
we reduce the spreading of energy to neighboring bins.
And now the scale here is in decibels.
If we zoom out a bit on this plot
and instead of plotting from bin 230 to 270,
plot all of the magnitude spectrum,
then we get this plot that gives you an even better picture,
where we have the clear peak
of the sine at DFT bin 256.
The green 256.5 and the windowed version
of the 256.5.
Notice how much less spread
the windowed function version has
compared to the green one.
Using Dbs when considering audio signals
is a good first approximation to loudness,
which is how loud humans perceive the sound to be.
It is important to understand
that loudness is a perceptual property
of the human hearing system,
whereas a sound pressure measurement
is a computed quantity.
It turns out that the human ear is not equally sensitive
to all sound frequencies.
And a more correct computation
of loudness needs to take that into account.