- Python - I'm using version 2.7, but 2.6 or 2.5 should work as well
- Marsyas - compiled with the swig python bindings
- marsyas_util - found in src/marsyas_python/ from the Marsyas svn repository
- plot_spectrogram - from the same location
A tutorial on installing Marsyas and swig python bindings can be found here.
I'm also assuming you have some experience with classes in python, and object oriented programming in general.
The easiest and most commonly used version of FM synthesis is to have two sine wave generators. One is called the carrier; it is where we get our output from, and the other is called the modulator; it controls the frequency of the carrier.
Both are normally set to be in the audible range, but some neat aliasing effects can be achieved if they are not(this also depends on the sample rate of the system). See this.
The two most import parameters when working with FM synthesis are:
- Modulation Index
- Modulation Ratio
If the ratio is a whole number our sidebands will be harmonic. Otherwise we will end up with an enharmonic spectrum.
modulation frequency = base frequency x ratio
The modulation index is used to calculate how many hz our signal should be modulated by:
The higher the index the more high frequencies will show up in our output. The actual amplitude of each sideband is scaled by a Bessel function, and the amount a sideband is scaled by will change depending on the mod index. See this for a bunch of math you don't really need to know to play with FM synthesis.
modulation depth = base frequency x modulation index
It is important to note that as our mod index gets higher then three the spectrum starts becoming harder to predict.
One approach to generating these harmonics would be to simply have one FM pair, and have the modulation ratio set high enough to generate eight harmonics.
As you can see though as the modulation ratio starts getting higher energy starts getting lost from the fundamental. This doesn't exactly stick with the idea of having most of our energy in the first harmonic. Also, there is not enough energy in the sixth harmonic.
By using two of these pairs one 6 times higher, and keeping the modulation ratio of both less than three we get a much more predictable spectrum.
This also gives us that extra energy needed around the sixth harmonic.