Musicsynthesis
Musicsynthesis
Musicsynthesis
Sound Synthesis
The following matlab code creates the first line of the popular song: Mary had a
little lamb.
fre=[329.6280 293.6650 261.6260 293.6650 0 329.6280 329.6280 .
329.6280 0 293.6650 293.6650 293.6650 0 329.6280 391.9950 3
f = @(f0,t) exp(-0.05*t) .* sin(2*pi*f0*t);
n = 10000; %number of sampling points for a half second note
t = [0:n]/(2*n); %play a note only a half second
song = [];
for k = 1:length(fre)
song= [song f(fre(k),t)];
end
sound(song,2*n)
Mary
Fourier Series
a0 X ⇣ ⇣ n⇡ ⌘ ⇣ n⇡ ⌘⌘
1
f (x) = + an cos x + bn sin x .
2 n=1
L L
Convergence theory?
N =1 N =2
N =5 N = 25
Bishnu P. Lamichhane, bishnu.lamichhane@newcastle.edu.au Mathematics and Music
Introduction
Sound Synthesis
Z L
2 n⇡x
bn = f (x) sin( ) dx
L 0 L
2
= (cos(n⇡) 1).
n⇡
Hence
2 4
[1 ( 1)n ] =
bn = if n is odd,
(n⇡) (n⇡)
and bn = 0 if n is even. The Fourier series for L = 1 is, therefore,
1
X 1
4 1 4 X 1
f (x) = sin (n⇡x) = sin ((2n 1)⇡x)
⇡ n=1,3,5,... n ⇡ n=1 2n 1
N =1 N =2 N =5 N = 25
Bishnu P. Lamichhane, bishnu.lamichhane@newcastle.edu.au Mathematics and Music
Introduction
Sound Synthesis
Mary Additive
Mary Simple
Bishnu P. Lamichhane, bishnu.lamichhane@newcastle.edu.au Mathematics and Music
Introduction
Sound Synthesis
We want to break sound into smaller pieces. Since sound waves are periodic signals,
we can express using sine and cosine waves resulting in a Fourier series. Let
y : [0, T ] ! R be a continuous signal. For example, we can approximate a sound
signal y by using sin and cos like
Z n
!2
T X
ya = min y(t) (ai cos(wi t) + bi sin(wi t)) dt
0 i=1
1 This
Pn can be digitised by sampling the signal y and also the sum
i=1 (ai cos(wi t) + bi sin(wi t)) at a finite number of time points.
2 The optimisation problem is nonlinear if we minimise with respect to wi .
3 We can use some information of the sound signal like physical properties to
simplify wi .
Optimisation Bottleneck
If we approximate the global signal (a 1/2 second A4 note looks like below), we
do not capture the local property of the signal accurately.
If we approximate the the signal locally (using around 5-6 milliseconds note), we
lose the accuracy globally.
The main idea behind Frequency Modulation is that we modulate the frequency over
time resulting in change in frequency over time. A simple frequency modulation is
obtained by setting
F (t) = sin(2⇡fc t + I sin(2⇡fm t)),
where fc is called the carrier frequency, fm is called the modulation frequency and I
is called the index of modulation, which is also the strength of modulation or the
intensity of the modulation.
We can include more terms to model a wide variety of sounds:
Frequency Modulation
Using fc = 1, fm = 2 and I = 12 in the modulated signal
Frequency Modulation
d2 y dy
x2 2
+x + x2 k2 y = 0
dx dx
Bessel Function
Wavetable Synthesis
Wavetable synthesis produces a sound signal by cycling through a table of values that
represent a waveform.The wavetable method generates di↵erent frequencies of a
signal by changing the speed with which it cycles through table entries.
1 Wavetable synthesis is based on creating periodic waveforms by employing
arbitrary periodic waveforms.
2 The output waveform changes in time as one wavetable is mixed with another,
creating a changing waveform.
3 Used in many commercial synthesisers: Waldorf, Ableton, PPG Wave, etc.
Final Slide