Sound Synthesis II: Inharmonic Analysis




Up to now, we have been analyzing sounfiles with harmonic frequencies. This lab demonstrates how to do non-harmonic analysis of soundfiles to extract (or remove) the most prominent frequencies.

First, lets start with an example noise file created on mambo with the following command:

   whitenoise -d 4.0 -a "0 0, 5 1, 95 1, 100 0" source.wav
This will create a soundfile containing 4 seconds of whitenoise with an amplitude envelope that starts at 0 in the beginning of the soundfile, then increases to 1 at 5% into the file, then starts to decay back to 0% starting at 95% of the way into the soundfile.

Analysis file:
InputSoundFile source.wav
OutputSmsFile temp.sms
nSines 100
SineModel 2
FrameRate 344.53125
LowestPitch 100
HighestPitch 1000
Synthesis file:
InputSmsFile temp.sms
OutputSoundFile 100sines.wav
Type 1
SamplingRate 44100

Notice the parameter SineModel 2 in the analysis file. This indicates to the sms program to analysis the input soundfile inharmonically. The sms program will sort the sinewaves in the input by how loud they are, rather than how they are related to the measured pitch of the soundfile.

The above example extracts up to 100 sinewaves at any given point in time in the input soundfile.

Here are successively few and few sinewaves analyzed from source.wav:

100sines.wav up to 100 sinewaves at any given time.
050sines.wav up to 50 sinewaves at any given time.
025sines.wav up to 25 sinewaves at any given time.
012sines.wav up to 12 sinewaves at any given time.
006sines.wav up to 6 sinewaves at any given time.
003sines.wav up to 3 sinewaves at any given time.
001sines.wav up to 1 sinewave at any given time.

The number of sinewaves extracted from the sound at any given point in the soundfile can be specified as a fuction in the nSines analysis parameter. The following example starts with one sinewave at any given time in the analysis, then at 10% of the way into the file, 2 sinewaves are permitted, then at 20% of the way into the file, 3 sinewaves are permitted, and so on.

Analysis file:
InputSoundFile source.wav
OutputSmsFile temp.sms
nSines 0 1 0.1 2 0.2 3 0.3 4 0.4 5 0.5 6 0.6 5 0.7 4 0.8 3 0.9 2 1.0 1
SineModel 2
FrameRate 344.53125
LowestFreq 50
HighestFreq 5000
Synthesis file:
InputSmsFile temp.sms
OutputSoundFile sinz.wav
Type 1
TimeStretch 4
SamplingRate 44100

Next is an example of extracting imaginary harmonics from a soundfile and stretching them out 64 times the original speed. Frequencies which are harmonics of a pitch between 500 and 520 Hz are extracted from the input whitenoise. Up to 3 harmonics are extracted at any given time.

Analysis file:
InputSoundFile shortn.wav
OutputSmsFile temp.sms
nSines 3
SineModel 2
FrameRate 344.53125
LowestPitch 500
HighestPitch 520
Synthesis file:
InputSmsFile temp.sms
OutputSoundFile sinestretch.wav
Type 1
TimeStretch 64
SamplingRate 44100


Exercises

  1. Experiment with extracting frequencies from whitenoise by controling the analysis frequencies, number of sines to analysze, and the time stretch factor in the synthesis score-file.

  2. Analyze a bell sound and note the most important frequencies. Search for a bell sound on the web at findsounds.com. What is the most dominant frequency at any given time?

  3. Timestretch a harmonic instrument (or voice) sound using the inharmonic analysis method, using 400 sinewaves for the analysis. Then timestretch the same sound using a harmonic anlaysis. What are the differences between the two analysis/synthesis procedures?