RasterCore

FM Synthesis: The Sound of the OPL Chip

:: SysOp

The Metallic Symphony

If you played PC games between 1987 and 1993, the soundtrack of your childhood wasn’t an orchestra or a rock band—it was a mathematical approximation of them. It was the sound of FM Synthesis, generated by the Yamaha OPL (Operator Type-L) chips.

While the Commodore Amiga was playing back actual digital recordings (samples), the PC was taking a different, more “scientific” approach. FM synthesis builds complex timbres by vibrating one waveform (the modulator) against another (the carrier).

The AdLib Card (1987)

The PC’s audio revolution began with the AdLib Music Synthesizer Card. Before this, the PC was limited to the “PC Speaker,” a beeper capable of only one square wave at a time. The AdLib card used the Yamaha YM3812 (OPL2) chip.

  • 9 Melodic Channels: Each channel could play a different instrument.
  • Two Operators per Channel: The building blocks of the sound.
  • Waveforms: Unlike earlier FM chips that only used Sine waves, the OPL2 offered 4 waveforms (Sine, Half-Sine, Absolute Sine, Pulse Sine). This allowed for brighter, “buzzier” sounds.

How FM Works (The Math)

In standard subtractive synthesis (like a Moog synthesizer), you start with a rich wave (sawtooth) and cut frequencies out with a filter. In FM, you start with a pure tone and add complexity.

Formula: Output = Amplitude * Sine(CarrierFreq + ModulationIndex * Sine(ModulatorFreq))

  • Carrier: The main oscillator that you hear.
  • Modulator: The oscillator that shakes the carrier’s frequency.

If the Modulator is slow (e.g., 5 Hz), you get Vibrato. If the Modulator is fast (e.g., 400 Hz), you get Timbre—metallic bells, gritty basses, or hollow woodwinds.

Programming the OPL2

The OPL2 is controlled via two I/O ports: 0x388 (Address) and 0x389 (Data). It has a bank of registers that control the ADSR envelope, frequency, and feedback for each operator.

// C Pseudo-code: Playing a note on Channel 0
void play_note(int freq_num, int octave) {
    // 1. Set Modulator Characteristics (Operator 0)
    // Attack/Decay: Quick attack, long decay
    write_opl(0x60, 0xF0); 
    // Sustain/Release: Med sustain, long release
    write_opl(0x80, 0x77); 
    // Level/Output: Loud, Frequency Multiplier x1
    write_opl(0x40, 0x00); // 0x00 = Max Volume

    // 2. Set Carrier Characteristics (Operator 3)
    write_opl(0x63, 0xF0); 
    write_opl(0x83, 0x77); 
    write_opl(0x43, 0x00); // Max Volume

    // 3. Set Frequency
    // Frequency Number (F-Num) is a 10-bit value derived from Hz
    // Block (Octave) is 3 bits.
    // Key On bit triggers the envelope.
    
    int f_low = freq_num & 0xFF;
    int f_high = ((freq_num >> 8) & 0x03) | (octave << 2) | 0x20; // 0x20 = Key On
    
    write_opl(0xA0, f_low);
    write_opl(0xB0, f_high);
}

This register-heavy interface meant that few programmers wrote music drivers from scratch. Instead, they used libraries like the Miles Sound System or the ROL (AdLib Visual Composer) format.

The Sound Blaster and OPL3

In 1989, Creative Labs released the Sound Blaster. Crucially, it included the same OPL2 chip as the AdLib, ensuring 100% backward compatibility. It added a separate Digital Audio channel (DAC) for sound effects, creating the standard “FM for Music, DMA for Speech” paradigm of early 90s gaming.

The successor, the Sound Blaster Pro 2.0 and Sound Blaster 16, introduced the OPL3 (YMF262).

  • 18 Channels (or 6 in 4-operator mode).
  • Stereo Output: You could pan sounds Left, Right, or Center.
  • 4-Operator Synthesis: By combining two channels, you could stack 4 oscillators. This allowed for much richer, lush pads and complex instruments that rivaled expensive professional synthesizers.

The “OPL Sound”

The OPL chips had a very distinct aesthetic. They were excellent at:

  • Bells, chimes, and electric pianos (the “DX7” sound).
  • Slap bass and plucked strings.
  • Sci-fi sound effects.

They were terrible at:

  • Real drums (snare drums sounded like sneezing static).
  • Piano (sounded like a harpsichord underwater).
  • Orchestral strings (sounded like kazoos).

Despite these limitations, composers like Frank Klepacki (Dune II, Command & Conquer) and Bobby Prince (Doom, Duke Nukem 3D) leaned into the strengths of the chip. The Doom soundtrack, with its distorted guitars and driving bass, is a masterclass in FM programming.

Legacy

FM synthesis fell out of favor in the mid-90s with the rise of “Wavetable” cards (Sound Blaster AWE32, Gravis Ultrasound) which used real samples. However, the OPL sound has seen a resurgence in the Synthwave and Chiptune scenes. Modern VST plugins (like VOPM or Chipsynth PortaFM) allow producers to use the exact algorithms of the OPL chip in modern DAWs.


Source & Further Reading

  • “The OPL2/OPL3 Programming Guide”: The definitive technical reference for chip registers.
  • “8-Bit Music Theory”: YouTube analysis of FM synthesis in classic gaming.
  • The Yamaha YM3812 Datasheet: Original engineering specifications from 1985.
  • “AdLib Visual Composer”: The tool that defined the early PC music workflow.