The YM2413 is a FM sound generator produced by Yamaha.

YM3812 / OPL-2 comparisons

The YM3812 has 9 channels each with its own set of registers for defining the type of sound coming from it. The YM2413 simplifies the design: each channel has a 4-bit instrument number, the instrument being a group of predefined register settings stored in an internal ROM.

Of the 16 available instrument types the first one is a user defined instrument that is controlled by a set of programmable registers. There is no limit on the allocation of instruments; the user instrument or any of the fixed ones can be used by multiple channels.

Sound generation

A slot (also known as 'operator') generates a waveform that has several attributes:

The YM2413 allocates two slots per channel, called the carrier and modulator. The output of the carrier is combined with the modulator, and the resulting sound is output on a given channel.

Each channel has its own attributes as well:

Rhythm mode

Rhythm mode is used to create percussion type sounds which cannot be made normally by FM sound generation. Several slots are used for this purpose, which changes the distribution of slots per channel:

The allocation of slots for the rhythm instruments are:

The rhythm channels have their own dedicated volume control and key-on bits. The normally used frequency and volume settings for the channels that share these operators need to be set up in a fixed way as advised by Yamaha:

Reg. Setting Purpose $16 - Set to $20 F-Num LSB for channel 7 (slots 13,16) $17 - Set to $50 F-Num LSB for channel 8 (slots 14,17) $18 - Set to $C0 F-Num LSB for channel 9 (slots 15,19) $26 - Set to $05 Block/F-Num MSB for channel 7 $27 - Set to $05 Block/F-Num MSB for channel 8 $28 - Set to $01 Block/F-Num MSB for channel 9

Notice that the key-on bits are reset so that the dedicated ones in register $0E can be used.

Because of the way rhythm mode works, it isn't possible to disable some rhythm channels to "free up" the operators so the channel can be used in melodic mode.

Return to top