A Look at Musical Instrument Sounds
Background
on Fourier Analysis/Synthesis
·
Musical
instruments have different tonal qualities, even when playing the same note. This is due to different “harmonics” present
in the instruments signal.
·
Playing
the same note on any instrument will produce the same fundamental frequency
(the lowest frequency sinusoidal component).
However, sinusoids of integer multiple frequencies of this fundamental
are also present (the harmonics). You
hear the sum of these harmonics and the fundamental. Your brain recognizes the fundamental frequency and associates
that with the “note” you hear. The
harmonics give the note its “character.”
·
Each
instrument has a certain set of harmonic strengths unique to that
instrument. A flute has relatively weak
or soft harmonics and produces nearly a perfect sinusoid at the fundamental
frequency. A muted trumpet, on the
other hand, is rich with strong harmonics giving it a “growl” sound.
·
What
is interesting is that any waveform (signal shape) can be expressed as the sum
of sinusoidal signals of various strengths and frequencies. This is what we refer to as the frequency
content of a signal. This concept is
credited to Fourier and determining the frequency content of a signal is called
Fourier analysis. Building a signal by adding harmonics is called Fourier synthesis.
·
A
“synthesizer” is the name for a keyboard that constructs its sounds by adding
sinusoids (performs Fourier synthesis).
Most keyboards today are sampling keyboards and get their sounds by
digitally recording the actual instruments.
·
Watch
how a saw-tooth wave shape can be created (synthesized) by adding sinusoidal
harmonics to a fundamental sinusoidal signal
clear; close all; clc
figure(1)
t=linspace(0,10,500);
out=zeros(size(t));
for k=1:10
sign=(-1)^(k-1);
out=out+sign*(1/k)*sin(k*t); % add on the k-1’th harmonic
plot(t,out)
xlabel('time (sec) ');
ylabel('x(t) ');
title('Saw-tooth Wave
Formed with Sinusoidal Harmonics');
grid
axis([0,10,-2,2]);
if k==1
S=sprintf('Fundamental
Frequency');
else
S=sprintf('%.0f
Harmonics',k-1);
end
text(4.25,1.25,S);
M(k)=getframe;
disp('Hit Any Key to Add Next
Harmonic');
pause
end
movie(M,3,10);
·
Here is a demonstration of how a square-wave can
be synthesized by adding sinusoidal harmonics in just the right
proportion. This page was created by
Paul Hartke when he was an undergraduate Electrical Engineering Student at UD.
· Now that you know a thing or
two about harmonics, lets look at the waveforms produced by real instruments. These sounds have been recorded from my
KORG 01/W Pro Sampling Keyboard.
clear; close all;
clc
[flute,fs]=wavread('flute.wav');
[tenor,fs]=wavread('tenorsax.wav');
[trump,fs]=wavread('mutedtrumpet.wav');
·
Let’s
look at, and listen to, the flute signal
figure(1)
N=length(flute);
t=linspace(0,N/fs,N);
plot(t(7000:7500),flute(7000:7500))
xlabel('time (sec) ');
ylabel('relative
strength');
title('Small Portion
of Flute Signal');
soundsc(flute,fs);
·
When
we look at an audio signal in time and in frequency, this is called a
spectrogram. The spectrogram you are
about to see is color-coded. Red means
strong energy content, and blue is little energy. You should be able to see the fundamental frequency energy
(lowest red line) going up and down the scale over time and the harmonics go
right along with it (their frequencies are always integer multiples of the
fundamental).
% flute
figure(1)
specgram(flute,1000,fs,1000)
soundsc(flute,fs);
·
Try
this with the tenor sax and muted trumpet
% tenor sax
figure(1)
specgram(tenor,1000,fs,1000)
soundsc(tenor,fs);
% trumpet
figure(1)
specgram(trump,1000,fs,1000)
soundsc(trump,fs);
· You can see how many strong
harmonics there are with the muted trumpet.
Let’s look at a piece of the signal (amplitude vs. time) and listen
again. The rough shape of the waveform
indicates the presence of many strong harmonics (the less like a pure sinusoid,
the more harmonics it must have).
figure(1)
N=length(trump)
t=linspace(0,N/fs,N);
plot(t(1000:2000),trump(1000:2000))
xlabel('time (sec) ');
ylabel('relative
strength');
title('Small Portion
of Trumpet Signal');
soundsc(trump,fs);