Sound Synthesis II: Extracting Harmonics
The nSines parameter in an SMS analysis file controls
how many harmonics are analyzed. The following analysis/synthesis
file pair will extract the fundamental partial from the example
trumpet sound: trumpet-c4.wav.
Here is a description of parameters used in the analysis/synthesis
|| Specify harmonic (1) or non-harmonic (2) analysis.
(Default is harmonic analysis).
|| This parameter specifies the number of harmonics to
analyze (when SineMode = 1).
|| This parameter specifies the lowest pitch to search for
in the input soundfile.
|| This parameter specifies the highest pitch in Hz to
search for in the input soundfile.
|| This parameter specifies type of synthesis. Type 1 means
only synthesize the deterministic part (sinewaves) of the
The pitch of the trumpet note is about 260 Hz, so
the LowestPitch was set to 200 Hz and the
HighestPitch was set to 300 Hz. These parameters may or may
not be necessary depending accuracy of detecting the fundamental frequency
on the input sound. For the case of the trumpet sound, the identification
quality for the third harmonic improved when the pitch range was limited.
Now extract the first two harmonics of the trumpet note with the
following analysis/synthesis files:
Notice that the only change in the analysis/synthesis files is to
change nSines from 1 to 2. Now the resynthesis
extracts the first two harmonics of the trumpet sound.
To hear the second partial by itself, you can use the
subtract command to remove the first harmonic from the
sound of the first two harmonics:
subtract trumpet1-2.wav trumpet1.wav trumpet2.wav
To make the extraction of harmonics from a sound less
tedious, here is a command you can use to extract the lowest
harmonics from a soundfile:
smsHarmonics 1 trumpet-c4.wav trumpet1.wav
The above command will extract the first harmonic from the input
file trumpet-c4.wav and write it to
the soundfile trumpet1.wav. The following
example will extract the first two harmonics from
smsHarmonics 2 trumpet-c4.wav trumpet1-2.wav
Here is a table of the first 32 harmonics of the trumpet note:
Harmonic range (Extracted harmonic, Normalized harmonic)
1 (1, 1n)
1-2 (2, 2n)
1-3 (3, 3n)
1-4 (4, 4n)
1-5 (5, 5n)
1-6 (6, 6n)
1-7 (7, 7n)
1-8 (8, 8n)
1-9 (9, 9n)
Here is a soundfile which plays each of the harmonics successively:
- Extract the first seven harmonics from a pitched sound of your
choice. You can look through the sounds on mambo in the
directory /usr/local/sms/sounds, or view the SMS example
sounds on the web. Also, you can try some of the
Instrument Samples from the University of Iowa Electronic
Music Studios which were recorded in an anechoic chamber to reduce
reverberation (which will give the best results for analysis).
- Measure the loudness of each harmonic in the sound you
have chosen. Use the sndpower command available on
mambo to measure the average decibel level for each harmonic.
For example, the trumpet sound above has this average amplitude for
each harmonic of the first seven harmonics:
| harmonic|| frequency || loudness (decibel) || amplitude |
| 1|| C4 (260 Hz) || 0 dB || 0.0105519|
| 2|| C5 (520 Hz) || 7 dB || 0.0220180|
| 3|| G5 (780 Hz) || 12 dB || 0.0389151|
| 4|| C6 (1040 Hz) || 15 dB || 0.0535522|
| 5|| E6 (1300 Hz) || 10 dB || 0.0315712|
| 6|| G6 (1560 Hz) || 15 dB || 0.0532884|
| 7|| B-flat6 (1820 Hz) || 10.5 dB || 0.0325092|
- Extra Credit: Synthesize a synthetic instrument
sound using additive synthesis with the average loudness
of the first seven harmonics. For example, here is the additive
synthesis version of the trumpet sound: trumpetadd.wav
created with the command (on mambo):
addsyn trumpet.addsyn trumpetadd.wav
Compare this sound to the real trumpet's first seven harmonics: trumpet1-7.wav. Describe both sounds and how
they are similar and/or dissimilar.
- Remix the harmonics in different amounts (for example add the 1st,
3rd, 5th, and 7th harmonics together to create a clarinet-like variation
of the instrument). Make a note of interesting harmonic mixtures.
Here is an example using the addsnd program on mambo which
mixes the odd harmoics up to harmonic 31:
addsnd trumpet.wav trumpet.wav trumpetodd.wav
- Remove the 1st harmonic from the original sound. Does the pitch
change? (It should not) Remove the 1st and 2nd harmonics from the
original sound. Does the pitch change? (It probably should not)
How many harmonics must be removed before the pitch changes?
- Extra Credit: How few harmonics can be played yet still
allow you to identify the instrument being played? For example,
can you identify the trumpet from only the fundamental? from only
the first 2 harmonics? At what point does the instrument become
recognizable? Find the minimum that you need in order to identify
the instrument. Then play that sound for someone else who has not
been listening to the noise you have been making. Can they also
recognize the sound?