algorithm Arduino electronics hardware PCB

Making music with a Yamaha YM2413 Synthesizer – Part 1

When researching material for the SN76489 sound generator (documented in these previous articles) I discovered that many early microcomputer systems incorporated both the SN76489 and a YM2413 FM synthesizer. The Yamaha synthesizer looked like an interesting piece of hardware to explore. Here’s the result.

The YM2413 synthesizer IC

The YM2413, or OPLL, is a cost-reduced FM synthesis sound chip manufactured by Yamaha Corporation and based on their YM3812 (OPL2).

Its main historical application was the generation of music and sound effects in microprocessor systems. It was extensively used in early game consoles, arcade games, home computers and low-cost synthesizer keyboards.

The cost reducing simplifications created a cut down IC that allowed for one user-defined instrument and fifteen read-only hard-coded instrument profiles (violin, guitar, piano, flute, clarinet, oboe, trumpet, organ, horn, synthesizer, harpsichord, vibraphone, synthesizer bass, acoustic bass and electric guitar). The IC can operate either as nine channels of melodic instruments or six melodic channels and five hard-coded percussion instruments (high hat, top cymbal, and tom tom, snare and bass drums).

The IC comes in an 18 pin DIP or a 24 pin SOP package with the following pinout signals

D0-D7Register Address and Command byte inputs for OPLL command
/WEActive low Write Enable (latches data)
/CSActive low Chip Select (connect to GND or, if more than one IC shares D0-D7, a MCU output )
/ICChip reset (pull up to Vcc or connect to MCU reset)
AOAddress/Data discriminator for D0-D7
MOMelody Audio Output
RORhythm Sudio Output
CLK3.579545 MHz clock signal
VCC5V power input

The block diagram for the IC provides an overview how the pins control the IC. It has an 8 bit bus interface (D0-D7) with one address line (A0) to select one of two write-only registers. One register is used to select the byte address to access a block of 8 of the 271 internal register bits, and the other is used to write the data into the the selected 8 bit register.

The IC is made active by setting /CS low, allowing more than one device (YM2413 or otherwise) to share the same data lines. The /WE line is used to latch the current data on D0-D7 into the IC address/data registers. The interaction between the bus control signals is shown in the table below:

1xxChip not selected, inactive mode
01xData bus inhibited mode
000Address write mode
001Data write mode

On the analog output side there are two audio outputs, one each for the Rhythm and Melody (RO, MO) that must be amplified.

Yamaha produced an application manual for this IC documenting all the internal registers, handshake timing and model circuits. This is available for download from here.

Test hardware

Like the previous SN74689 project, I decided to directly connect the hardware to MCU I/O.

This time, however, I elected to design an Arduino Uno shield that includes both the synthesizer and an audio amplifier. The output from the shield can be fed directly into a speaker.

The circuit schematic is shown below (click on the image to enlarge).

There are 2 parts to the circuit

  • The first is the direct digital interface interface between the MCU outputs and the YM2413 inputs. This is a straightforward connection between digital outputs on the MCU and the data and control lines of the synthesizer IC.
  • The second is the sound amplifier. The audio output from MO and RO of the IC are combined into a mono signal to feed a TEA2025 amplifier. The TEA2025 circuit is based on the model circuit found on the amplifier’s data sheet.

The circuit and PCB layout were created using Eagle CAD and sent for manufacturing. The schematic and PCB layout files are available from this location.

The pictures below sown the different stages of the PCB from DEsign to fully populated. The TEA2025 warms up when the volume is turned up, so it has a heatsink attached to keep the heat under control.

In the next part we’ll start communicating with the test hardware and producing sound.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s