Yamaha YM3812

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Yamaha YM3812
An audio sample of music written for and played on YM3812

The Yamaha YM3812, also known as the OPL2, is a sound chip created by Yamaha Corporation in 1985 and famous for its wide use in IBM PC-based sound cards such as the AdLib, Sound Blaster and Pro AudioSpectrum (8bit),[1] as well as several arcade games by Nichibutsu, Toaplan and others.


It is backwards compatible with the Yamaha YM3526, to which it is very similar – in fact, it only adds 3 new waveforms. An upgraded version of the OPL2, the Yamaha YMF262 (OPL3), was also popular in later sound cards such as the Sound Blaster 16. Another related chip is the YM2413 (OPLL), which is a cut down version.

The circuit has 244 different write-only registers. It can produce 9 channels of sound, each made of two oscillators or 6 channels with 5 percussion instruments available. Each oscillator can produce sine waves which may also be modified into 3 other waveforms – the negative part of the sine can be muted or inverted, and pseudo sawtooth waves (¼ sine waves upward only with silent sections in between) can also be produced. This odd way of producing waveforms give the YM3812 a characteristic sound. Each wave generator has its own ADSR envelope generator. Its main method of synthesis is frequency modulation synthesis, accomplished via phase modulation of the phase of one channel's oscillators by the output of another.

YM3812 oscillator waveforms

Internal operation[edit]

The internal operation of the chip is completely digital. Each FM-tone is generated by a digital oscillator using a form of direct digital synthesis. A quarter of the log-transformed sine waveform is stored as a sampled approximation in a 256-word read-only memory (ROM) table. The rest of the sine-waveform is extrapolated via its property of symmetry. Scaling the output of an oscillator to a wanted volume would normally be done by multiplication, but the YM3812 avoids multiplications by operating on log-transformed signals, which reduces multiplications into computationally cheaper additions[2].

Another 256-word ROM stores the exponential function as a lookup table, used to convert the logarithmic scale signal back to linear scale when required, as the final stage where the oscillator-outputs are summed together (just prior to the DAC-output bus), with the modulator waveform always delayed by one sample before the carrier waveform.[3] The YM3812's output, a sequence of floating point numbers clocked at a sampling frequency of approximately 49716 Hz, is sent to a separate digital-to-analog converter (DAC) chip, the YM3014B.

Overview of a channel's registers:

For the whole channel:

  • Main frequency (10 bits)
  • Octave (3 bits)
  • Note on/off
  • Synthesis mode (FM or just additive)
  • Feedback (0–7, the modulator modulating itself)

For each one of the 2 oscillators:

  • Frequency multiply (can be set to ½, 1 to 10, 12 or 15)
  • Waveform (Sine, half-sine, absolute-sine, quarter-sine)
  • Volume (0–63, logarithmic)
  • Attack, Decay, Sustain, Release (4 bits each, logarithmic)
  • Tremolo (On or off)
  • Vibrato (On or off)
  • Sustain (On or off)
  • Envelope scaling per key (On or off)
  • Volume scaling per key (0–3)

There are also a few parameters that can be set for the whole chip:

  • Vibrato depth
  • Tremolo depth
  • Percussion mode (uses 3 channels to provide 5 percussion sounds)
  • Composite sine mode (see Sinewave synthesis)


Synthesizers that use the YM3812:[4]

  • Yamaha PSR-11 49-keys 16-sounds (1986)
  • Yamaha PSR-12 49-keys 32-sounds (1987)
  • Yamaha PSR-21 49-keys 16-sounds, 2 steps sliders (1986)
  • Yamaha PSR-22 49-keys 32-sounds, 2 steps sliders (1987)
  • Yamaha PSR-31 61-keys 16-sounds, additional YM3301 chip[5] for drums (1991)
  • Yamaha PSR-32 61-keys 32-sounds, additional YM3301 chip[5] for drums (1987)
  • Yamaha PSS-360 49 mini-keys 21-sounds, 5 steps sliders, low-cost mono version of PSS-460 (1986)
  • Yamaha PSS-460 49 mini-keys 21-sounds, 5 steps sliders (1986)
  • Yamaha PSS-470 49 mini-keys 21-sounds, 5 steps sliders (1987)
  • Yamaha PSS-560 49 mini-keys 21-sounds, 5 steps sliders, additional YM3301 chip[5] for drums (1986)
  • Yamaha PSS-570 49 mini-keys 21-sounds, 5 steps sliders, additional YM3301 chip[5] for drums (1987)

Synths that use the YM2413 (cost reduced YM3812):[4]

  • Yamaha PSR-6 49-keys 100-sounds (1994)
  • Yamaha PSS-140 37 mini-keys 100-sounds (1988)
  • Yamaha PSS-170 44 mini-keys 100-sounds (1986)
  • Yamaha PSS-270 49 mini-keys 100-sounds (1986)

See also[edit]


  1. ^ https://www.youtube.com/watch?v=z3DU2mNBa6M&t=10m11s
  2. ^ https://docs.google.com/document/d/18IGx18NQY_Q1PJVZ-bHywao9bhsDoAqoIn1rIm42nwo/
  3. ^ http://dev.kewl.org/misc/ymf262/ymf262.c
  4. ^ a b "Meet the little-known "Soundblaster" Keyboards". The 8-Bit Guy, Youtube. Retrieved 19 August 2015.
  5. ^ a b c d "Edward D-tech, Yamaha Chips, YM series". Edward D-tech. Archived from the original on 16 May 2016. Retrieved 25 January 2016.