Problem Set 2.2 Spring 2009
Harmonics and Complex Sounds

Download ps2-2temp09.xlsm from Weekly Schedule

A. Introduction
This problem set is an extension of Project 1. We are going to calculate the harmonics of a fundamental frequency based (roughly) on musical scales to create complex waves that approximate the sounds of synthesized musical instruments.  The process of combining sinusoids to create complex waves is called additive synthesis (related to Fourier synthesis).  The fundamental frequency, F0, that we will use is the same frequency to which musicians tune their instruments, A4 or 440 Hz.  To generate the fundamental frequency and harmonics of that frequency, the function s(n) = A · sin(2 · π · f  · n/Fs + ф) will be modified, adding a new parameter for the harmonics, H. The amplitude, A0, and the frequency of the sine waves will be modified by H, according to principles derived from Fourier analysis of complex sounds.


B. Mathematics
The equation for a digital sine wave designated as an harmonic of some fundamental frequency, F0, is:

  SH(n) = A0/H · sin ( 2 · π · ( H · F0 ) · n/Fs + ф)

where

A0 is an amplitude value
H is the harmonic number of a given component
F0 is the fundamental frequency of the harmonic series in Hz
Fs is the sample rate in samples/second (Fs = 11025 Hz)
n is the sample number, n = 0, 1, 2, 3, . . .
ф is the starting phase in radians

For the stimuli in this assignment, the parameters of the fundamental frequency are given as follows: F0 = 440 Hz (A4), A = 15000, ф = 0 radians.  You must determine the parameters for subsequent harmonic components:  H = 1, 3, . . ., 8.


C. Problem Set Description
The Excel spreadsheet ps2-2temp.xlsm from the Weekly Schedule provides you with an example of the first three harmonics of a sawtooth wave. The functions sH(n) must be added together to produce a particular complex sound of a given waveform shape.  As detailed in Section 2.3, the sawtooth is used to represent the oboe in digital music synthesis and consists of a sum of harmonics with phase = 0 radians.  Likewise, the complex sound known as a square wave represents the clarinet in digital music synthesis.  To produce a square wave, only the odd harmonics (H = 1, 3, 5, . . .) of some fundamental frequency are added together.


D. Specific Instructions
In this homework, the sampled waveforms will be manipulated as arrays or named ranges.  Arrays or named ranges are useful when working with large blocks of data such as long columns.  They are especially useful in making the mathematical formulas in Excel look like more standard mathematical notation.  Arrays are usually given names.  Please see 'Instructions for Using Named Ranges and Arrays in Excel' from the Resources menu.

  1. Compute harmonics H4 to H8 using arrays or named ranges to define each harmonic waveform.  To compute a sawtooth waveform based on all seven harmonics, you may alter the formula for the sawtooth to include H4 to H8, for a total of eight harmonics.   Graph and print the first 100 points of the resulting sawtooth waveform.

  2. Approximate a square wave by computing a new array that consists of the sum of the odd harmonics.  Graph and print the first 200 points of the square wave.

  3. For both the sawtooth and square waves, create and insert .wav files into the spreadsheet and listen to the two sounds.

  4. Next, explore the effects of changing parameters of the sawtooth and square waves.   As you manipulate component amplitudes, phases, and frequencies, observe the effects on the visual shape of the waveforms in your graphs.  Also, create additional sound files and icons that represent the changes you have made.  Then listen to those changes and note how a particular change alters the sound of the waveform (use your notes to answer the questions below).  Also try adding more harmonics to the waveforms.

E. Report Questions for PS 2.2

  1. Compare the graphs of your synthesized sawtooth and square waves with "true" sawtooth and square wave functions.  For the same, large number of harmonic components (say h1 to h30), which synthesized shape (sawtooth or square wave) will be closer to the "ideal" shape produced by an infinite number of components?  Explain your answer.

  2. Based on your own manipulations of the harmonics in Excel, answer the following questions.

    1. What is the effect of changing the fundamental frequency, F0 by two? How do the original and 2 X F0 waveforms sound different?
    2. What is the effect of changing the phase of one harmonic component in the square wave by π /2?
    3. Can you hear a difference between the original and the phase-altered signal?
    4. What is the effect of removing a harmonic?

F.  Instructions on Submitting Your Assignment

  1. Turn in a brief printed report with answers to the questions above and the graphs created in Excel.

  2. Load your .doc and Excel files into your Module 2 drop box.