I’ve played around with CSound’s foscil
opcode before but, I wasn’t satisfied I really understood what was going on. This article summarizes my learning of Frequency Modulation (FM) synthesis in seven key ideas.
A PDF version of Seven Things I’ve Learned About FM Synthesis that includes some math is available. I hope it can serve as a gentle introduction for others.
- We can think of frequency as a function of time rather than a constant. It can be helpful to describe instantaneous frequency as a sum of a fixed carrier frequency and a scaled modulating function.
- Simple FM has a modulating function that is a fixed frequency sinusoidal signal.
The modulation index indicates, as you might guess, the degree of modulation. For simple FM, the index is the ratio of the frequency deviation, to the modulation frequency.
- Frequency Modulation is essentially the same thing as Phase Modulation (PM). Well, that’s an overstatement. They are not interchangeable. For example a radio receiver built to decode phase modulated signals, will not be able to decode a signal from an FM transmitter. But, for synthesis purposes we are interested in the modulated signal, rather than the modulating signal. In this case, we can achieve the same effects with PM that we can with FM, provided the modulating signal is sinusoidal.
- The effect of simple frequency modulation is the addition of sidebands that are centered at the carrier frequency and spaced at multiples of the modulating frequency. There are theoretically an infinite number of sidebands. But almost all of the power of the resulting spectrum is contained in the first (modulationIndex + 1 ) sidebands. This means when the modulation index is elevated, the power will be spread out to a larger number of sideband frequencies.
Care must be taken to insure that the frequency of the sidebands do not exceed the Nyquist criteria unless aliasing is a desired effect.
When the ratio of the modulation to carrier frequency is rational, sidebands belong to a harmonic series. If the ratio is irrational, the sound is metallic or possibly noisy at high levels of modulation index.
- CSound’s foscil opcode implements simple FM. Its parameters are:
kcps: carrier frequency
kcarfac: carrier frequency divided by kcps. (Hence I often use 1)
kmodfac: modulation frequency divided by kcps
kindex: the modulation index
ifn: function table number, should be a sine for simple FM
iphase: (optional) initial phase into lookup table
- Simple FM can be extended by:
- Modulating the modulation function (cascade) to create additional sidebands
- Feedback (self modulation)
- Summing multiple sinusoidal modulators (Parallel modulators)
- Non sinusoidal carriers and/or modulators: noise, audio, etc…
While some of these algorithms are available in commercial synthesizers, all of them provide the FM synthesis student inspiration for further study and experimentation.
After some basic exploration of foscil, I have begun my own experiments with some simple CSound instruments that modulate a sine wave with an audio signal. Its a very interesting effect. When I get a decent example. I’ll post here and maybe at the bigwinky page on the freesound project.
Benson, Dave. Music: a Mathematical Offering. Cambridge: Cambridge UP, 2007. Music: a Mathematical Offering. 9 Mar. 2008 <http://www.maths.abdn.ac.uk/~bensondj/html/music.pdf>.
Lesurf, Jim. “Frequency Modulation, Phase Modulation, and FM Spectra.” Scot’s Guide to Electronics. 15 June 2005. University of St. Andrews. 5 Mar. 2008 <http://www.st-andrews.ac.uk/~jcgl/Scots_Guide/RadCom/part12/page1.html>.
Pinkston, Russell. “FM Synthesis in CSound.” The CSound Book. Ed. Richard Boulanger. Cambridge, Massachusetts: The MIT P, 2000. 261-270.
Reid, Gordon. “Synth Secrets.” Sound on Sound. Apr. 2000. 9 Mar. 2008 <http://www.soundonsound.com/sos/apr00/articles/synthsecrets.htm>.
Schottstaedt, Bill. “An Introduction to FM.” CCRMA. 11 Feb. 2008. Stanford University. 7 Mar. 2008 <http://ccrma.stanford.edu/software/snd/snd/fm.html>.
Vercoe, Barry, and Et Al. “Foscil.” Csounds.Com. 1992. MIT Media Lab. 10 Mar. 2008 <http://www.csounds.com/manual/html/foscil.html>.
Wikipedia contributors. “Phase modulation” [Internet]. Wikipedia, The Free Encyclopedia; 08:10 16 February 2008 UTC<http://en.wikipedia.org/wiki/Phase_modulation> [accessed 2008 Mar 7].
Wikipedia contributors. “Frequency modulation”, Wikipedia, The Free Encyclopedia, 21:37 2 March 2008 UTC <http://en.wikipedia.org/wiki/Frequency_modulation> [accessed 2008 Mar 7].