Frequency Modulation (FM) Synthesis

A prominent, yet not always clearly understood, synthesis process is Frequency Modulation. It had been used widely for radio transmission, but was not used for music until the early 1970s when John Chowning discovered its usefulness. FM synthesis is quite efficient in that it can create complex sounds from a few simple sine waves. The Yamaha DX7 synthesisizer was the first widely availible synthesizer to use FM synthesis. Below is the diagram of a simple implementation in jMusic.

As you can see, there are two wavetables, each of which uses a sine wave oscillator. The top-most wavetable is called the 'modulator' because it is not heard directly, just indirectly via the effect it has on the bottom wavetable, which is called the 'carrier'.

There are two important varibles which effect the timbre, firstly, the relative frequencies of the carrier and modulator. This is referred to as the modulation ratio or the C:M ratio. For example, if the carrier frequency is 400hz and the modulator frequency is 600hz, then the C:M ratio is 1.5. The C:M ratio will determine the spread of overtones produced, and thus the timbre. Simple integer ratios will produce harmonic (pleasant) sounds while non-simple ratios will produce inharmonic (clanging) sounds. The second imporant variable is the amplitude of the modulator, called the 'modulation index.' The modulation index will effect the loudness of the sideband overtones, so the higher the modulation index the more prominent the n overtones will be. In this way the modulation index acts similarly to a low pass filter in a subtractive synthesis system.

The final Audio file will sound like this:

To simply use FM (rather than mess with it) try the FMTest class in the demos directory of the jMusic download.

Lets have a closer look at the core of the FM instrument class.

 	public void createChain()throws AOException{
	    // modulator
	    Value modFrequency = new Value(this, this.sampleRate, 
			this.channels, Value.NOTE_PITCH);
	    Oscillator modulator = new Oscillator(modFrequency, 
Oscillator.SINE_WAVE, Oscillator.FREQUENCY);
modulator.setFrqRatio(frqRatio);
modulator.setAmp((float)modIndex);
Envelope env = new Envelope(modulator,
new double[] {0.0, 0.0, 0.5, 1.0, 1.0, 0.0});
// constant Value constFreq = new Value(this, this.sampleRate, this.channels, Value.NOTE_PITCH); Add add = new Add(new AudioObject[] {constFreq, env}); // carrier Oscillator carrier = new Oscillator(add, Oscillator.SINE_WAVE, Oscillator.FREQUENCY); Envelope env2 = new Envelope(carrier, new double[] {0.0, 0.0, 0.1, 1.0, 1.0, 0.0}); Volume amp = new Volume(env2); //, 200.0); SampleOut sout = new SampleOut(amp); }

A class to test this instrument is shown below:

Click here to view source.

 import jm.JMC;
import jm.music.data.*;
import jm.midi.*;
import jm.audio.*;
import util.View;
import util.Write;
  /** * @author Andrew Brown */ public final class FMTest implements JMC{ public static void main(String[] args){ Score s = new Score(); Part p = new Part("Flute",0); Phrase phr = new Phrase(); SimpleFMInst inst = new SimpleFMInst(22000, 400, 7.2); Instrument[] ensemble = {inst}; //create the scale phrase note by note for(int i=0;i<6;i++) { Note n = new Note(A2+i*6, 0.5*(i+1)); phr.addNote(n); } p.addPhrase(phr); s.addPart(p); s.show(); Write.au(s, "FMTest.au",ensemble); } }

To understand how audio instruments are used, see  Audio 101.  The only new thing here is how the SimpleFMInst is created.  There are three parametres in its constructor: The first is the sample rate, the second is the Modulation index, and the last is the Carrier/Modulator pitch ratio.  Try playing with the settings and see how it affects the sound!




© 2001 Andrew Brown

jMusic Tutorial Index