Sie sind auf Seite 1von 6

Experiment # 7

Frequency Spectra (Fourier Transforms)and Spectrograms


PHYS/MUS 102Spring 2014

Background
Why do two instruments sound different even when the same note is struck, sung, plucked? The
answer lies in the nature of the instrument. Depending on how instruments geometry and mode of
operation, the waveforms it produces will differ, thus the sound we perceive will defer. The difference
in waveforms can be quantified by Harmonic Series Analysis (aka Frequency Spectrum
Analysis aka Fourier Transforms) Fortunately, no matter how complicated the waveform,
Fourier came along and told us Fear not! Everything can just be decomposed (or synthesized)
from a harmonic series of sine waves. The mixture of waveforms can be easily visualized and
assessed in a frequency spectrum. This is simply a plot that tells us how much of each harmonic
to include in order to sum up to the recorded/final waveform. In this lab, you will explore various
aspects of Fourier transforms and applications thereof.

Theory
Any periodic function x(t) can be expressed as a sum of sines or cosinesor equivalently as a sum
of sines which can have a phase lag:
x(t) = Ao + A1 sin(2f1 t) + B1 cos(2f1 t) + A2 sin(2f2 t) + B2 cos(2f2 t) + . . .

(1)

where the the coefficients An and Bn (n = 0, 1, 2, 3, . . .) tell us how much of each sin and cosine
wave at frequencyfn = nf1 to mix together to add up to get the final waveform x(t). It is the
magnitude of the An + Bn that are plotted vs frequency f in a frequency spectrum.

Experiment
Fourier Synthesis: Synthesize Me
To start, lets build some intuition regarding how sine waves in a harmonic series can be added
up to get a more exotic (arbitrary) waveform. To do this, you will use a computer-based Fourier
synthesizer .
Navigate to this url1 : http://www.falstad.com/fourier/
1
You may need to download and install the latest version of java to get this to run properly. In the instructors
experience, google chrome is the easiest to use in terms of security settings and updating java versions.

Have a play with the applet, synthesizing various waveforms using only sine waves. You can
change the fundamental frequency using the slider toward bottom, right. Note the values of the
coefficients An and carefully observe the timbre. (Make sure the box labeled Sound is checked.)
Next, turn all of the sine wave coefficients back to zero, then set all the series of cosine coefficients
(Bn ) to be the same values as you had for the sine wave coefficients. Compare and contrast what
you hear? Does the timbre depend on if you use sines vs. consines. Lastly, make a mix of sines
and cosines by setting the An back to their previous value (dont adjust the Bn ). Does the sound
quality change at all? The vast majority of humans cant tell the difference, the point being that
only the frequency content matters, not the actual waveform shape.
Quick tips/hints: wear headphones and/or keep your volume low. Else you are likely to drive
your neighbors insane. Also, a richer mix of waves is typically much more pleasing to the ear. See
if you can synthesize a waveform that sounds like a particular instrument. Be sure to clearly state
what instrument you were trying to replicate and what note you are playing.
Next, adjust the coefficients as necessary in order to synthesize some or all of the following. Of
course, try your best to achieve the desired waveform before just hitting the button to give you the
answer.

1. Square Wave
2. Sawtooth Wave
3. Triangle Wave

Consult Fig. 1 for what these (standard) waveforms look like. Choose an arbitrary base
frequency (fundamental frequency) of 110 Hztwo octaves below concert A440.
Compare and contrast the Fourier coefficients you found in a general sense. You should notice
some significant differences in the frequency spectra (or harmonic structure). For instance, for
which waveforms above are the odd harmonics most dominant, which waveforms rely mostly on
just a few of the harmonic series, etc?

Decomposing Beethovens 5th


No doubt you are familiar with the opening bars of Beethovens 5th symphony and its tripplet
rhythm landing on a sustained chord: dum-dum-dum-DUM! But what are these famous chords?
Your task is to find out. Enter: harmonic series analysis!
Download a clip of the first 10 sec of Beethovens 5th Symphony, 1st Movement (played by
the Dresden Symphony). The file is available here: http://home.wlu.edu/~ericksonj/phys102_
s2014.html
Below are some very specific instructions about how to use computer software to do this.

Figure 1: Basic waveforms. Use the Fourier synthesizer to build these using a sum of sine waves in
a harmonic series
1. Launch Audacity, then open the file you jus downloaded. Highlight and zoom in on the
section of interest. You want to analyze only a single note/chord at a time, so something
like 100 msec worth of data should be plenty. If you highlight to much data, say 500 msec,
youll be cropping a section with multiple notes, so it would be difficult to tell which notes
are playing in the opening.
2. Export this cropped selection as a .wav format sound file for further analysis. To do this,
navigate to File >> Export Selection as WAV. Important: when saving the file, save to
your h: drive, or other network drive. You will need to access this file while using theStable
thestable.wlu.edu.
3. For frequency analysis of the .wav file you will use MATLAB (a powerful software package
that is particularly good at computing and displaying frequency spectra). To access matlab,
log on to the stable: thestable.wlu.edu. Choose the computational and scientific software
option. From the windows start menu, launch MATLAB. Up near the top of the command
window, you will see three dots in a button which you can press. Doing so launches a pop-up
asking you to navigate to a folder (directory). Be absolutely certain to choose the folder in
which you just saved your .wav file(s).
4. Now, download the frequency spectra analysis script from the course webpage (it is a .m file).
Save this file to exactly the same folder where your .wav files are. Do NOT place it in a
subfolder/directory.
To test whether everything is working ok, type at the command prompt:
>> which freqAnalysis
You should see a directory/folder returned as text. Otherwise, if you get a message like
freqAnalysis not found something has gone wrong. Consult the instructor for help as
needed.
3

5. Now to use the function, you can type at the command prompt something like:
>>FFT = freqAnalysis(pianoE4.wav, [0 3000]);
This says to matlab please analyze the audio file pianoE4.wav, compute the Fourier transform, and display the results for all frequencies between 03000 Hz. Of course you need to
change the file name to whatever you named your file. Also, you may want to change the
frequency limits to something more conducive for viewing, should you have mostly very low
frequency content, or high frequency content. Dont forget the square brackets around 0 and
3000they are essential! If all goes well, the computer should think for a few seconds, then
output a nice graph of the frequency spectra, which you can then analyze in detail. I highly
recommend saving and/or printing out frequency spectra. Youll want them for discussion in
your final report.
6. For each of the opening four chords of Beethovens 5th symphony, include a plot of the
frequency spectrum, annotated clearly to show how you determined which notes (pitches)
were sounding. Also, denote the pitches sounded by the orchestra using the standard bass
and treble clef shown below. What is the name of each of these chords (e.g., C major, E-flat
minor, etc.). You may find the following chart helpful, it lists the notes of the 12-tone western
scale with corresponding frequencies: http://www.phy.mtu.edu/~suits/notefreqs.html

(a) Chord 1

(b) Chord 2

(c) Chord 3

(d) Chord 4

Figure 2: Bass and Treble Clefs. Use them to sketch out the chords of Beethovens immortal 5th.

Human voice
Are men from Mars, women from Venus? Were not going to solve (or even weigh in!) on that
age-old conundrum, but we will investigate differences in the human voice in various ways.
Compare the sound quality and spectrograms for the following pairs:

1. Male vs female voice saying the same phrase.


2. News anchor or radio personality vs average voice. Ideas: compare Brian Williams (NBC
news) to a nerdy TV characters voice; or Katie Couric to whomever (Miiley Cyrus? Please
no. =) ) Maybe even compare their voice to yours!
4

Heres how you will accomplish this task. Youll use a RadioShack brand condenser microphone
and Audacity software to record sounds/voice. For this exercise, do NOT rely on your built in
laptop microphone. It is a low fidelity recording device. The condenser mic offers much better
recording quality. Plug in the mic to your laptop before launching audacity. Make sure the mic is
switched on. Then launch Audacity. Before recording in Audacity, youll need to set the microphone
input to Microphone. To do this, navigate toward the upper-right of the audacity window. You
should see a drop down box with the desired selection. See Fig. 3, which highlights where to make
this change:

Figure 3: Screenshot from audacity showing where to change the source input for recording. It
should be set to Microphone, NOT digital mic.

Obtain clips of a famous personality talking via youtube, or elsewhere on the internet. Start
playing the clip while you simultaneously record the sound with condenser mic. You may need
to play around with positioning of the mic, or the mic input sensitivity controls in audacity for
optimal recording (just to the left of where you changed the input source). Just a short clip will
dosomething like 2-5 s should be plenty.
One other important note: do NOT use the version of audacity through theStableyou wont
be able to record anything. The computer you are working on isnt sophisticated enough to share
audio measurements with the computer in the cloud, which you are accessing through the stable.
Instead, download a local copy of audacity on to the computer or your laptop from the following
link (tis free!). http://audacity.sourceforge.net/download/ Do NOT use download links
other than the one explicitly listed here (they could be pirated version, malware, etc.)
When you are finished recording, highlight and zoom in on some selections that look interesting
to study. Something like a few sec worth of data should be plenty. You will export this selection
as a .wav format sound file for further analysis.
For frequency analysis of the .wav file you will use MATLAB. However, you will use a different
analysis script this time. Download the spectrogram analysis script from the course webpage (it is
a .m file). Save this file to exactly the same folder where your .wav files are. Do NOT place it in a
subfolder/directory.
To test whether everything is working ok, type at the command prompt:
>> which drawSpectrogram
You should see a directory/path returned as text. Otherwise, if you get a message like drawSpectrogram not found something has gone wrong. Consult the instructor for help as needed.
Now to use the function, youll need to consult and carefully read the directions found by typing:
>>help drawSpectrogram.

The default values suggested under Example: should be good for now.
In your report, comment on the sound difference you perceive relative to the frequency content,
as revealed in the frequency spectra plot. Can you identify characteristics common to good or
soothing famous voices relative to the average joe? Make substantial qualitative comments, and
be quantitative in your discussion, referring to the frequency spectra as much as possible.

Choose your own Adventure!


Lastly, develop your own little mini-project involving frequency spectra analysis and musical instruments. Be creative and study whatever aspect is interesting to you! If you are stuck (doubt you
will be) consult the instructor for ideas. To help get the wheels turning : you could compare sound
quality from various instruments (piano vs guitar). Or compare sound quality on the different
makes/models of the same instrument (e.g. an upright piano vs a grand (your friend singing vs
your own pipes); an acoustic guitar vs electric. Anything and everything is possible, so let your
imagination run wild!
For your report, describe what you studied, and present your main findings. You should definitely discuss what you heard in relation to how that manifested in the frequency spectra.

Report
You will make an oral report only; You do NOT need to make a written report. The Oral report
should cover: 1) Your Beethoven decomposition; 2) Human voice results; 3) Choose your own
adventure. Emphasize number 3 in your presentation. Be sure to clearly explain what you were
investigating, your methods for investigating it, results (frequency spectra and or spectrograms),
and how you interpreted the results. Each group/presenter will be allotted 15 total minutes for a
presentation. Make judicious use of powerpoint/prezi/whatever software for visual aids.
You will be graded on the following criteria
Presenters spoke audibly and clearly
Visual aids used effectively
Clarity, concision,organization of presentation.
Technical accuracy and thoroughness.

Das könnte Ihnen auch gefallen