Decibel#

Sound levels are often described on a decibel (dB) scale. But what is actually a decibel, and how does it relate to the signals we are measuring?

Decibel is a relative measure of the ratio of power of two signals on a logarithmic scale. It is usually in the form of :

\[10 \log_{10} \frac{P}{P_{ref}} \,\mathrm{dB} \]

where \(P\) is the power of sound we are interested in measuring, and \(P_{ref}\) is the reference.

Power is proportional to the square of pressure. Therefore, the above is equivalent to

\[10 \log_{10} \left( \frac{p}{p_{ref}} \right)^2 = 20 \log_{10} \frac{p}{p_{ref}} \,\mathrm{dB} \]

Yet, we often hear noise levels announced in terms of decibels without explicitly mentioning the reference. This can cause problems, since the conventional reference for sounds in the air is 20 μPa, which corresponds to the threshold below which a human usually cannot hear (thus making that sound level equal to 0 dB), but for the reference is 20 μPa for sound in water. This means that for the same sound, the decibel value can be different depending on which reference one uses!

Why use logarithmic measure?#

We use the decibel measure, because logarithm provides a convenient compression of values that allows us to easily compare sound as loud as a jet taking off right outside of your window (approximately 140 dB re 20 μPa) with sound as soft as dropping a needle on the floor (approximately 15 dB re 20 μPa).

To get an intuitive feeling of how logarithm works, try the widget below:

Hide code cell source

import matplotlib
matplotlib.use('module://matplotlib_inline.backend_inline')

import numpy as np
import matplotlib.pyplot as plt
import ipywidgets as widgets

from IPython.display import display

Hide code cell source

x_all = np.hstack((np.arange(0.1, 1, 0.1), np.arange(1, 10, 0.1)))

def plot_log_point(x, base):

    plt.figure(figsize=(5,3))
    plt.gca().axhline(0, color="b", lw=0.5)
    plt.gca().axvline(0, color="b", lw=0.5)
    match base:
        case "10":
            plt.plot(x_all, np.log10(x_all), "k")
            plt.plot(x, np.log10(x), "ro", markerfacecolor="w")
        case "2":
            plt.plot(x_all, np.log2(x_all), "k")
            plt.plot(x, np.log2(x), "ro", markerfacecolor="w")
        case "e (natural log)":
            plt.plot(x_all, np.log(x_all), "k")
            plt.plot(x, np.log(x), "ro", markerfacecolor="w")
    plt.grid()
    plt.xlabel("x")
    plt.ylabel("log value")
    plt.show()

x_slider = widgets.FloatSlider(
    value=1, min=0.01, max=10, step=0.01,
    description="x value", 
    continuous_update=True, 
    style={'description_width': 'initial'}, 
    layout=widgets.Layout(width="400px")
)

base_radio = widgets.RadioButtons(
    options=["10", "2", "e (natural log)"],
    value="10",  # default selected
    description="Base of logarithm",
    disabled=False,
    style={'description_width': 'initial'},
)

interactive_plot = widgets.interactive(
    plot_log_point, x=x_slider, base=base_radio)
display(interactive_plot)

Exercises#

To get more confident in using decibels, try the following exercise.

Exercise 1: Comparing power#

The sound of breathing is roughly 10 dB, and the sound of a trumpet playing is roughly 110 dB.

How much louder is the trumpet than the breathing?

Answer
\[ 100 \, \textrm{dB} = 10\log_{10} \frac{P_1}{P_2} \]

Therefore, the trumpet’s power is 1010 higher than that of breathing.

Exercise 2: dB scaling#

Let’s consider two scenarios:

  • Signal 1: 1 person talking

  • Signal 2: 100 people talking

Assuming the power of people talking adds linearly, what many dB is signal 2 louder than signal 1?

Answer
\[ 10 \log_{10} 100 = 20 \,\textrm{dB} \]

Exercise 3: dB in air vs in water#

Given the different reference units of sound pressure level (SPL) in air and in water:

  • Air: 20 μPa

  • Water: 1 μPa

What is the difference between the SPL decibel values measured in air and in water for the same sound?

Answer
\[ 20 \log_{10} \frac{20}{1} = 26 \,\textrm{dB} \]

Therefore, for the same sound, decibel values computed with in-water reference is about 26 dB higher than decibel values computed with in-air reference.

References#