from IPython.display import display, YouTubeVideo, ImageSound is a vibration which travels through a medium as
longitudinal waves: gasses (e.g., air), liquids (e.g., water), and solids (e.g., concrete)
transversal sound waves: solids (e.g., concrete)
The speed of sound depends on the medium.
In air at room temperature, for example, it is approximately 343 m/s.
Image('apLecture1_files/wave.png')
Sound is normally divided into three types:
Infrasound: Sound with frequencies up to 20 Hz
Audible sound: Sound with frequencies in range 20 Hz - 20 kHz (audio)
Ultrasound: Sound with frequencies above 20 kHz
We can consider haptics as slow vibrations too.
Human hearing¶
The human ear consists of the following parts:
Outer ear: Everything on the outside of the ear drum, including the pinna
Middle ear: The three bones (Malleus, Incus, Stapes). What do they do?
Inner ear: The cochlea (Latin for what?) tube. What does the basilar membrane do inside? Hair cells?
The human ear
does not hear all frequencies equally well
is most sensitive to frequencies around 4 kHz
is tuned to speech
has a really large dynamic range of up to ~120 dB (i.e., we can hear sound intensities up to ~10^12 the quietest sounds)

Sinusoids¶
A sinusoid (or a sine wave) is given by
where
is the amplitude
is the frequency measured in radians pr. second (SI symbol rad/s). Is related to the frequency measured in cycles pr. second (SI symbol Hz) via .
is the time measured in seconds (SI symbol s)
is the initial phase measured in radians (SI symbol rad)
The above form of the sinusoid is often referred to as the polar form. By using the angle addition formula for a cosine, i.e.,
a sinusoid can also be written in a rectangular form as
where a and b are scalars given by
Numpy example: A sinusoid¶
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
samplingFreq = 44100 # Hz
nData = 2000
time = np.arange(0,nData).T/samplingFreq # s
# Generate a sinusoid
amp = 1;
freq = 100 # Hz
initPhase = np.pi/2 # rad
sinusoid = amp*np.cos(2*np.pi*freq*time+initPhase)
# Plot the sinusoids
plt.plot(time, sinusoid, linewidth=2)
plt.xlim((time[0],time[nData-1]))
plt.ylim((-1,1))
plt.xlabel('Time [s]')
plt.ylabel('Amplitude [.]')
plt.grid(True)
Assume that the act of striking a bar is modelled as compressing a spring in one dimension.
From Hooke’s law, this compresssion can be written as
where
is the restoring force measured in Newton (SI unit N)
is the displacement measured in meters (SI unit m) of the string from its resting position
is the spring constant measured in N/m
From Newton’s second law, the force can also be expressed as
where
is the mass of the string measured in kilogram (SI unit kg)
is the acceleration measured in m/s^2.
The acceleration is related to the displacement as
where is the velocity measured in m/s.
Combining these three equations gives
which can be rewritten as
This is a constant-coefficient second-order differential equation.
Let us check if our sinusoid
is a solution to the above differential equation. Since
we obtain
Thus, striking a bar will make it vibrate sinusoidally with the frequency
This frequency can be changed by changing the spring constant and mass.
Summary¶
Sound is a vibration travelling through a medium.
Sound waves are longitudal waves (and also transversal waves when travelling through a solid).
The human ear converts pressure variations in the air to
mechanical movement (interface is the eardrum)
vibrations in a liquid (interface is the oval window)
electrical signal to the brain (interface is the haircells attached to the basilar membrane)
A sinusoid (or sine wave) is given by
and it an extremely important building block (or atom) in analysing and manipulating sound.
Assuming that striking a bar can be modelled as compressing a spring, the bar will vibrate sinusoidally.
Complex numbers¶
In the next 20 minutes, you will learn
that the equation
has two solutions
what a complex number is
how you add and multiply complex numbers
The need for complex numbers¶
While the linear equation
can easily be solved, the simple quadratic equation
was in high school said to have no solution since its descriminant was negative.
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
nData = 100
x = np.linspace(-2,2,nData)
y = x**2+1
plt.plot(x,y,linewidth=2)
plt.xlabel('x')
plt.ylabel('y')
plt.ylim((-1,5))
plt.grid(True);
However, the quadratic equation can in fact be solved by using complex numbers.
Rearranging our simple quadratic equation gives
which allows us to write the solution as
where
is the imaginary unit. This unit also satisfies that
Note that
engineers normally use the symbol for the imaginary unit
mathematicians normally use the symbol for the imaginary unit.
Let us now consider the quadratic equation
We know from high school that the solutions to the general quadratic
have the form
where is the discriminant given by
The complex number¶
A complex number can be written as
where
is the real part
is the imaginary part.
A complex number can be depicted in the complex plane which is a 2D coordinate system.

The complex conjugate¶
The complex conjugate of a complex number is
Thus, the conjugation operator changes the sign of imaginary part, but not the real part.
Addition of complex numbers¶
Assume we have the two complex numbers
The sum of these two numbers is then
Thus, the real and imaginary part of of are simply
Note that
Multiplication of complex numbers¶
Assume we have the two complex numbers
The product of these two numbers is then
Thus, the real and imaginary part of of are
Note that
Summary¶
Complex numbers were originally invented to solve algebraic equations (e.g., the cubic equation)
The imaginary unit is
A complex number consists of a real part and imaginary part , and is written as
The complex conjugate of is
It is much easier to add two complex numbers than it is to multiply them.
Additional information on complex numbers¶
If you want to know more about complex numbers, you can find some nice videos here:
Phasors¶
In the next 20 minutes, you will learn
how a complex number can be written in a polar form
why the polar form makes multiplications much easier
what a phasor is
how a phasor is related to a real sinusoid
The polar (or exponential) form of a complex number¶
As for 2D vectors, we can also write a complex number in terms of its magnitude and angle . We have
Thus,
where the last equality follows from Euler’s formula.

Euler’s formula¶
Given by
A very important formula used everywhere in science and engineering
Simplifies notation and mathematical manipulations
Its real and imaginary parts are a cosine and a sine, respectively, i.e.,

The complex conjugate¶
The complex conjugate of a complex number
is
Thus, the conjugation operator changes the sign of the angle, but not the magnitude.
Multiplication of complex numbers¶
Multiplication of complex numbers is much easier when the polar form is used. Let
The product of these two numbers is then
where we used to get the last equation.
Thus, to multiply two complex numbers we
multiply their magnitudes
add their angles
Note that divisions can be calculated as multiplications since
and
Converting between the rectangular and polar forms¶
We have seen that a complex number can be written as
We can convert from the polar coordinates to the rectangular coordinates via
We can convert from the rectangular coordinates to the polar coordinates via
The phasor¶
We have previously looked at the sinusoid
Based on what we know about Euler’s formula and complex numbers, we can now also write as
since (from Euler’s formula)
This time-varying complex number is called a phasor or a complex sinusoid.
Note that
using the phasor instead of the real sinusoid makes life much easier (you will see this later in the course)
even though we work with the phasor, we can always come back to the real sinusoid by taking the real part of the phasor

