Difference between revisions of "YM2612"

From Sega Retro

(Added a paragraph detailing about the YM2612's built-in digital-to-analog converter as well as the crossover distortion produced by the original chip design)
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{cleanup}}
 
 
{{ICBob
 
{{ICBob
 
| image=Ym2612.jpg
 
| image=Ym2612.jpg
Line 6: Line 5:
 
| date=
 
| date=
 
}}
 
}}
The '''Yamaha YM2612''' (also incorrectly called YM-2612) is a sound synthesizer integrated circuit by [[Yamaha]] [http://www.vorc.org/text/column/hally/ymxxxx.html known to have first appeared in the late 1980s]. The chip implements Yamaha Operator Type-N (OPN) frequency modulation synthesis, and is given the designation '''OPN2''', however it is not the second OPN chip — the YM2203 (OPN) and YM2608 (OPNA) are known to precede it, with possible others as well. A CMOS version, the '''YM3438'''/'''OPN2C''', was also manufactured by Yamaha.
+
The Yamaha '''YM2612''', also known as its designation '''OPN2''' (and sometimes incorrectly called as "YM-2612"), is a sound chip by [[Yamaha]] that implements frequency modulation (FM) synthesis based on Yamaha's FM Operator Type-N (OPN) series, [https://upload.wikimedia.org/wikipedia/commons/0/05/Yamaha_YM2612_top_metal_die_shot.jpg first released in 1988]. It is not the second OPN chip, however — the YM2203 (OPN), YM2608 (OPNA) and YM2610 (OPNB) are known to precede it. A CMOS version of the YM2612, the '''YM3438''' (OPN2C), was also manufactured.
  
By default, the chip can generate six simultaneous tones, each with their own configuration of FM operators. As with all OPN chips, the third channel can be modified to have each operator run at a different frequency this is often called "special" or "multifrequency" mode. The sixth channel can be swapped out for a software-controlled 8-bit PCM channel mixed directly into the output waveform. Finally, there is a single LFO which acts on all FM channels, but each channel can be set to be affected by it differently.
+
The YM2612 and its variants were notably used on the [[Sega Mega Drive]] game console and the Fujitsu FM Towns series of computers. However, its use on the Mega Drive meant it was also used on hardware derived from it including arcade boards such as the [[Sega System C]] and [[Sega System 32]] arcade boards, where the YM3438 was used. Many revisions of the Mega Drive 2 also used the YM3438 core, integrated into the main ASIC.
  
The YM2612/YM3438 was only notably used on the [[Sega Mega Drive]] game console, [[Sega System 32]] arcade board, and the Fujitsu FM Towns computer. However, its use on the Mega Drive meant it was also used on hardware derived from it including arcade boards, where the YM3438 was used. Several Mega Drive 2s also used the YM3438 core.
+
==Details==
 +
OPN-based FM synthesis is very similar to other forms of Yamaha FM synthesis used in chips such as the [[YM2151]], in that it consists of a number of operators connected in a variety of ways, with each operator consisting of a modified ADSR envelope, rate scaling, frequency multiplication, and detuning. By default, the chip can generate up to six simultaneous tones, each with their own configuration of FM operators. As with all OPN chips, the third channel can be modified to have each operator run at a different frequency this is often called "special" or "multifrequency" mode. It also contains an SSG envelope generator (the YM2612 does not include the YM2149 [AY-3-8910 clone] core found in other OPN chips, but still retains its envelope generators directly on the core). Finally, there is a single sine-wave LFO which acts on all FM channels, but each channel can be set to be affected by it differently.
  
==Details==
+
The YM2612 does not have a separate address and data bus. As a result, communication with the YM2612 is multiplexed on the 8-bit parallel bus. Each parameter the chip provides is accessed by first sending a register number to the chip, and then the register's value. Since Yamaha's register layout only allows up to four channels on a single register map, the YM2612 uses two ports on the chip to access each group of three channels.
{{stub}}
 
OPN FM synthesis is similar to other forms of Yamaha FM synthesis, in that it consists of a number of operators connected in a variety of ways, each operator consisting of a modified ADSR envelope, rate scaling, frequency multiplication, detuning, and a SSG envelope generator (the YM2612 does not include the YM2149 [AY-3-8910 clone] core found in other OPN chips, but the envelope generator remains).
 
  
The YM2612 does not have a separate address and data bus. As a result, communication with the YM2612 is multiplexed on the 8-bit parallel bus. Each parameter the chip provides is accessed by first sending a register number to the chip, then the register's value. Because Yamaha's register layout only allows four channels on a single register map, the YM2612 uses two ports to access each group of three channels.
+
The YM2612 also contains two timers — the high frequency Timer A and lower frequency Timer B. These timers can be set to interrupt a CPU when a timer reaches zero. Unfortunately, Sega never made these connections directly in hardware for the Mega Drive, meaning that timers have to be checked in software.
  
The YM2612 also contains two timers — the high frequency Timer A and lower frequency Timer B. While the YM2612 can be set to interrupt a CPU when a timer reaches zero, sadly Sega did not make this connection on the Mega Drive, requiring timers to be checked in software.
+
The sixth channel can be swapped out for a software-controlled 8-bit PCM channel (also known as the "DAC channel" or "DAC mode") mixed directly into the output waveform. In this mode, the controlling CPU must stream 8-bit unsigned PCM data to the YM2612 fast enough to be played back at the optimal playback speed. The maximum sample rate depends on the sample rate of the chip, but keep in mind that register writes must be synchronized to when the chip is ready — this is checked by polling the YM2612's status register and seeing if its Busy bit is set or not.
  
When Channel 6 is in DAC mode, the controlling CPU must stream 8-bit unsigned PCM data to the YM2612 fast enough to be played back at the optimal playback speed. The maximum sample rate depends on the sample rate of the chip, but keep in mind that register writes must be synchronized to when the chip is ready — this is checked by polling the YM2612's status register and seeing if its Busy bit is set or not.
+
Unlike with most Yamaha FM sound chips, the YM2612 does not use an external DAC chip such as the YM3016 or similar to convert its digital signals into analog audio signals, and instead included a built-in DAC (not to be confused with the sixth channel's "DAC mode") to play back all six channels via [[wikipedia:Time-division multiplexing|time-division multiplexing]], similar to the [[YM2413]]. A side effect to this is that it produces a form of [[wikipedia:Crossover distortion|crossover distortion]] known as ''low volume distortion'', where each output that is low in volume exhibits some noticeable quantisation noise. Additional distortion may also be generated when playing sounds at very high volumes due to the limited dynamic range of the built-in DAC, leading to clipping. Later versions of the YM2612 such as the YM3438 reduced the presence of the low volume distortion bug by improving the built-in DAC from the original YM2612 design to allow for a more higher signal-to-noise ratio over the original chip design with less crossover distortion.
  
 
==Technical specifications==
 
==Technical specifications==
Line 26: Line 24:
  
 
* Clock rate:
 
* Clock rate:
:* Maximum: 8.8 MHz{{ref|1=[https://www.youtube.com/watch?v=fYWclV9H2eY YM2612 with Teensy: playing audio at 44.1 kHz]}}
 
 
:* [[Sega Mega Drive]]: 7.670453 MHz (NTSC), 7.600489 MHz (PAL)
 
:* [[Sega Mega Drive]]: 7.670453 MHz (NTSC), 7.600489 MHz (PAL)
 
:* [[Sega System 32]]: 8.053975 MHz
 
:* [[Sega System 32]]: 8.053975 MHz
 
* Sound output: Mono, Stereo{{fileref|GenesisTechnicalOverview.pdf}}
 
* Sound output: Mono, Stereo{{fileref|GenesisTechnicalOverview.pdf}}
 
:* Output frequency: 53.267 kHz (NTSC), 52.781 kHz (PAL){{ref|[https://github.com/RetroAchievements/RASuite/blob/master/bizhawk/BizHawk.Emulation.Common/Sound/YM2612.cs Yamaha YM2612 Emulation Core]}}
 
:* Output frequency: 53.267 kHz (NTSC), 52.781 kHz (PAL){{ref|[https://github.com/RetroAchievements/RASuite/blob/master/bizhawk/BizHawk.Emulation.Common/Sound/YM2612.cs Yamaha YM2612 Emulation Core]}}
* Sound channels: 7
+
* Sound channels: 6
:* Default hardware configuration: 7 channels (6 FM channels, 1 LFO channel)
+
:* Default configuration: 6 channels (6 FM channels)
:* Alternative hardware configuration: 7 channels (5 FM channels, 1 PCM channel, 1 LFO channel)
+
:* Alternative configuration: 6 channels (5 FM channels, 1 PCM channel)
 
* [[wikia:w:c:electronicmusic:Frequency modulation|FM synthesis]]:
 
* [[wikia:w:c:electronicmusic:Frequency modulation|FM synthesis]]:
 
:* FM channels: 5-6 channels (5 channels with PCM, 6 channels without PCM)
 
:* FM channels: 5-6 channels (5 channels with PCM, 6 channels without PCM)
Line 40: Line 37:
 
::* Sample [[wikipedia:Audio bit depth|depth]]: 8‑bit{{ref|[http://www.alyjameslab.com/wa_files/FMDRIVE_USER_MANUAL.pdf FM-Drive User Manual]}}
 
::* Sample [[wikipedia:Audio bit depth|depth]]: 8‑bit{{ref|[http://www.alyjameslab.com/wa_files/FMDRIVE_USER_MANUAL.pdf FM-Drive User Manual]}}
 
::* [[wikipedia:Sampling rate|Sample rate]]:
 
::* [[wikipedia:Sampling rate|Sample rate]]:
:::* Maximum: 44.1 kHz{{ref|1=[https://www.youtube.com/watch?v=fYWclV9H2eY YM2612 with Teensy: playing audio at 44.1 kHz]}}
+
:::* Maximum: over 44.1 kHz{{ref|1=[https://www.youtube.com/watch?v=fYWclV9H2eY YM2612 with Teensy: playing audio at 44.1 kHz]}}
:::* Sega Mega Drive: 32 kHz{{ref|[https://github.com/Stephane-D/SGDK/blob/master/bin/rescomp.txt ResComp 1.5 (April 2016)]}}
+
:::* Sega Mega Drive: 26.3 kHz
:::* Sega System 32: 40.4 kHz
+
:::* Sega System 32: ~29 kHz
::* PCM bitrate:
 
:::* Maximum: 1411 [[Byte|Kbps]]
 
:::* Sega Mega Drive: 1024 Kbps (16 kHz), 720 Kbps (22.5 kHz), 512 Kbps (32 kHz){{ref|[https://github.com/Stephane-D/SGDK/blob/master/bin/rescomp.txt ResComp 1.5 (April 2016)]}}{{ref|[http://sonicresearch.org/community/index.php?threads/dual-pcm.4791/ Dual PCM]}}
 
:::* Sega System 32: 1292 Kbps
 
 
* [[wikipedia:Low-frequency oscillation|LFO]]: 1 [[wikipedia:sine wave|sine wave]] LFO (low frequency oscillator) channel
 
* [[wikipedia:Low-frequency oscillation|LFO]]: 1 [[wikipedia:sine wave|sine wave]] LFO (low frequency oscillator) channel
 
* [[wikipedia:Interrupt request|IRQ]] interrupt capabilities: IRQ2 sound interrupt{{ref|[https://github.com/mamedev/mess-cvs/blob/master/src/drivers/genesis.c Genesis (MESS)]}}
 
* [[wikipedia:Interrupt request|IRQ]] interrupt capabilities: IRQ2 sound interrupt{{ref|[https://github.com/mamedev/mess-cvs/blob/master/src/drivers/genesis.c Genesis (MESS)]}}
* [[Sega Mega Drive]] software mixing capabilities:
+
 
:* Sound channels: 7-11 channels (5 FM channels, 1-4 PCM channels, 1 LFO channel)
+
==Documentation==
:* Extended [[PCM]] capabilities:
+
<gallery>
::* PCM channels: 1-4{{ref|[https://github.com/Stephane-D/SGDK/blob/master/bin/rescomp.txt ResComp 1.5 (April 2016)]}}
+
YM2612 manual.pdf|Official manual
::* Audio compression formats: [[PCM|DPCM]],{{ref|[http://sonicresearch.org/community/index.php?threads/dual-pcm.4791/ Dual PCM]}} [[PCM|ADPCM]], [[VGM]], XGM, [[Echo|TFM]]{{ref|[https://github.com/Stephane-D/SGDK/blob/master/bin/rescomp.txt ResComp 1.5 (April 2016)]}} [[wikipedia:MOD (file format)|MOD]]{{ref|1=[http://forums.sonicretro.org/index.php?showtopic=13458 MOD player for the Sega Genesis]}}
+
</gallery>
::* Sample depth: 8‑bit (PCM), 4-bit (DPCM/ADPCM){{ref|[http://sonicresearch.org/community/index.php?threads/dual-pcm.4791/ Dual PCM]}}{{ref|[https://github.com/Stephane-D/SGDK/blob/master/bin/rescomp.txt ResComp 1.5 (April 2016)]}}
 
::* Sample rate: 32 kHz (1 channel), 22.5 kHz (2 channels), 16 kHz (4 channels){{ref|[https://github.com/Stephane-D/SGDK/blob/master/bin/rescomp.txt ResComp 1.5 (April 2016)]}}{{ref|[http://sonicresearch.org/community/index.php?threads/dual-pcm.4791/ Dual PCM]}}
 
  
 
==External links==
 
==External links==
*[http://www7.plala.or.jp/kikekike/fm/ YM3438 information, including official manuals (Japanese, link is now dead.)] ([http://web.archive.org/web/20140804044038/http://www7.plala.or.jp/kikekike/fm/ Archived, not complete])
+
*[http://www7.plala.or.jp/kikekike/fm/ YM3438 information, including official manuals (Japanese, link is now dead.)] ([http://web.archive.org/web/20140804044038/http://www7.plala.or.jp/kikekike/fm/ Archived, incomplete])
 
*[http://www.smspower.org/maxim/Documents/YM2612 A transcription of Sega's '''incomplete, sometimes incorrect''' YM2612 documentation from the sega2.doc file]
 
*[http://www.smspower.org/maxim/Documents/YM2612 A transcription of Sega's '''incomplete, sometimes incorrect''' YM2612 documentation from the sega2.doc file]
  
 
==References==
 
==References==
 
<references />
 
<references />

Revision as of 10:15, 29 September 2024

Ym2612.jpg
YM2612
Designer: Yamaha

The Yamaha YM2612, also known as its designation OPN2 (and sometimes incorrectly called as "YM-2612"), is a sound chip by Yamaha that implements frequency modulation (FM) synthesis based on Yamaha's FM Operator Type-N (OPN) series, first released in 1988. It is not the second OPN chip, however — the YM2203 (OPN), YM2608 (OPNA) and YM2610 (OPNB) are known to precede it. A CMOS version of the YM2612, the YM3438 (OPN2C), was also manufactured.

The YM2612 and its variants were notably used on the Sega Mega Drive game console and the Fujitsu FM Towns series of computers. However, its use on the Mega Drive meant it was also used on hardware derived from it — including arcade boards such as the Sega System C and Sega System 32 arcade boards, where the YM3438 was used. Many revisions of the Mega Drive 2 also used the YM3438 core, integrated into the main ASIC.

Details

OPN-based FM synthesis is very similar to other forms of Yamaha FM synthesis used in chips such as the YM2151, in that it consists of a number of operators connected in a variety of ways, with each operator consisting of a modified ADSR envelope, rate scaling, frequency multiplication, and detuning. By default, the chip can generate up to six simultaneous tones, each with their own configuration of FM operators. As with all OPN chips, the third channel can be modified to have each operator run at a different frequency — this is often called "special" or "multifrequency" mode. It also contains an SSG envelope generator (the YM2612 does not include the YM2149 [AY-3-8910 clone] core found in other OPN chips, but still retains its envelope generators directly on the core). Finally, there is a single sine-wave LFO which acts on all FM channels, but each channel can be set to be affected by it differently.

The YM2612 does not have a separate address and data bus. As a result, communication with the YM2612 is multiplexed on the 8-bit parallel bus. Each parameter the chip provides is accessed by first sending a register number to the chip, and then the register's value. Since Yamaha's register layout only allows up to four channels on a single register map, the YM2612 uses two ports on the chip to access each group of three channels.

The YM2612 also contains two timers — the high frequency Timer A and lower frequency Timer B. These timers can be set to interrupt a CPU when a timer reaches zero. Unfortunately, Sega never made these connections directly in hardware for the Mega Drive, meaning that timers have to be checked in software.

The sixth channel can be swapped out for a software-controlled 8-bit PCM channel (also known as the "DAC channel" or "DAC mode") mixed directly into the output waveform. In this mode, the controlling CPU must stream 8-bit unsigned PCM data to the YM2612 fast enough to be played back at the optimal playback speed. The maximum sample rate depends on the sample rate of the chip, but keep in mind that register writes must be synchronized to when the chip is ready — this is checked by polling the YM2612's status register and seeing if its Busy bit is set or not.

Unlike with most Yamaha FM sound chips, the YM2612 does not use an external DAC chip such as the YM3016 or similar to convert its digital signals into analog audio signals, and instead included a built-in DAC (not to be confused with the sixth channel's "DAC mode") to play back all six channels via time-division multiplexing, similar to the YM2413. A side effect to this is that it produces a form of crossover distortion known as low volume distortion, where each output that is low in volume exhibits some noticeable quantisation noise. Additional distortion may also be generated when playing sounds at very high volumes due to the limited dynamic range of the built-in DAC, leading to clipping. Later versions of the YM2612 such as the YM3438 reduced the presence of the low volume distortion bug by improving the built-in DAC from the original YM2612 design to allow for a more higher signal-to-noise ratio over the original chip design with less crossover distortion.

Technical specifications

See Sega Mega Drive: Technical specifications for further information
  • Clock rate:
  • Sound output: Mono, Stereo[1]
  • Output frequency: 53.267 kHz (NTSC), 52.781 kHz (PAL)[2]
  • Sound channels: 6
  • Default configuration: 6 channels (6 FM channels)
  • Alternative configuration: 6 channels (5 FM channels, 1 PCM channel)
  • FM channels: 5-6 channels (5 channels with PCM, 6 channels without PCM)
  • FM sample rate: 53.267 kHz (NTSC), 52.781 kHz (PAL)[2]
  • Maximum: over 44.1 kHz[4]
  • Sega Mega Drive: 26.3 kHz
  • Sega System 32: ~29 kHz
  • LFO: 1 sine wave LFO (low frequency oscillator) channel
  • IRQ interrupt capabilities: IRQ2 sound interrupt[5]

Documentation

External links

References