Estimating the parameters of an envelope that decays all
exponential like
Dr. Bob L. Sturm, Universitetlektor
School of Electronic Engineering and Computer Science
KTH, Sweden
January 22, 2019
We are given a sound recording x(t) of a tone produced by a musical instrument, and are
told to approximate it by a superposition of N sinusoids (overtones), also known as “additive
synthesis”. This means we are building the model:
N
X −1
x(t) ≈ envn (t) sin(2πfn t) (1)
n=0
where envn (t) is the amplitude envelope of the nth overtone with a frequency fn . When tones
are produced by striking, such as a mallet on a xylophone bar, a good envelope to choose is
exponential decay:
envn (t) = An e−γn t , t ≥ 0 (2)
where An is the initial amplitude of the overtone struct at time t = 0, and γn is the rate at
which it decays. Now we just need to estimate for each overtone its frequency, amplitude and
decay rate.
We can easily estimate each overtone frequency by looking at the location of peaks in a mag-
nitude spectrum of x(t); but how do we estimate An and γn ? First, we know from our model
that the power of the overtone in any portion is only going to depend on the envelope of the
sinusoid. The sinusoid has a constant power no matter when we look. Hence, we can relate the
dB amplitude of the nth overtone to its envelope by the following:
dBn (t) := 20 log10 envn (t) = 20 log10 An e−γn t = 20 log10 An + 20 log10 (e−γn t )
loge e−γn t
= 20 log10 An + 20 = 20 log10 An − 20γn t/ loge 10 (3)
loge 10
where we have used the fact that
loga x
logb x = . (4)
loga b
Considering the envelope at two different times t1 and t2 produces two equations:
dBn (t1 ) = 20 log10 An − 20γn t1 / loge 10 (5)
dBn (t2 ) = 20 log10 An − 20γn t2 / loge 10. (6)
1
Estimating the parameters of an envelope that decays all exponential like January 22, 2019
Subtracting the two equations gets rid of the unknown An :
dBn (t1 ) − dBn (t2 ) = (20/ loge 10)γn (t2 − t1 ). (7)
Solving for the exponential decay parameter gives:
loge 10 dBn (t1 ) − dBn (t2 )
γn = . (8)
20 t2 − t1
Having computed γn , we can then plug it into (5) or (6) and solve for the amplitude:
An = 10dBn (t1 )/20 10γn t1 / loge 10 . (9)
1.5
0.5
Amplitude
-0.5
-1
-1.5
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time (s)
Figure 1: Our synthetic test signal in time.
Let’s apply this using a signal that we synthesize with known parameters. This will allow us
to compare our estimates with the truth. Figure 1 shows our signal, synthesized using the
following code:
f = [200 402 595 825];
a = [0.5 1 0.7 0.3];
gamma = [1.8 2.0 3.7 4.3];
fs = 22050; dur = 2;
t = [0:dur*fs-1]'/fs;d
x = zeros(length(t),1);
for ii=1:length(f)
x = x + a(ii)*exp(-gamma(ii)*t).*sin(2*pi*t*f(ii));
end
x = x./max(abs(x)+0.01);
Now we look at the dB magnitude spectrum of this signal at two different points in time. This
is computed with the discrete Fourier transform. Figure 2 shows two 200 ms portions of the
signal, one taken at t1 = 0.05 s and the other at t2 = 1.0 s. We see four significant overtones.
Using the peak picking tool on the MATLAB plot, we find the frequency of these peaks to be:
200, 402, and 595 and 825 Hz. These agree perfectly with the frequencies we used to generate
this signal.
2
Estimating the parameters of an envelope that decays all exponential like January 22, 2019
0.5
Amplitude
-0.5
[0.05,0.25] s
0
-20
Magnitude (dB)
-40
-60
-80
-100
0 100 200 300 400 500 600 700 800 900 1000
Frequency (Hz)
(a) Top: Waveform; Bottom: dB magnitude spectrum
0.5
Amplitude
-0.5
[1,1.2] s
0
-20
Magnitude (dB)
-40
-60
-80
-100
0 100 200 300 400 500 600 700 800 900 1000
Frequency (Hz)
(b) Top: Waveform; Bottom: dB magnitude spectrum
Figure 2: 200 ms segments of our synthetic test signal at two times and the dB magnitude spectra.
We also find that each overtone decays in dB magnitude the following amounts from t1 to t2 .
The zeroth overtone starts at −5.7 dB and decays to −20.6 dB. The first overtone starts at 0
dB and decays to −16.5 dB. The second starts at −5.2 dB and decays to −35.7 dB. The third
starts at −13.3 dB and decays to −48.8 dB. This gives us all we need to know to estimate the
3
Estimating the parameters of an envelope that decays all exponential like January 22, 2019
1.2
0.8
Amplitude
0.6
2
0.4 1
0.2 3
4
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time (s)
Figure 3: The estimated envelopes of the overtones (labeled) of our synthetic test signal.
decay parameters for each overtone: γ̂1 = 1.8057, γ̂2 = 1.9996, γ̂3 = 3.6963, and γ̂4 = 4.3022.
These all agree very closely with the truth. Our estimates of the amplitudes are: Â0 = 0.5678;
Â1 = 1.1051; Â2 = 0.6611; Â3 = 0.2682. These are close to the ground truth, but have some
deviation.1 Figure 3 shows the estimated envelopes of each overtone in this test signal.
1
Can you suggest some reasons for this discrepancy?