Before going deeper into YM2612 details, these Yamaha pages are a good starting point for the general idea of FM tone generation.
The YM2612 is a sound chip developed by Yamaha. It was used in Sega’s Mega Drive / Genesis video game console.
This chip has:
http://www.chipdir.nl/pinusr/ym2612.txt
+--()--+
GND | 1 24| 0M(CLK)
D0 | 2 23| Vcc
D1 | 3 22| A.Vcc
D2 | 4 21| MOL
D3 | 5 20| MOR
D4 | 6 19| A.GND
D5 | 7 18| A1
D6 | 8 17| A0
D7 | 9 16| /RD
? |10 15| /WR
/IC |11 14| /CS
GND |12 13| /IRQ
+------+
GND: digital groundA.GND: analog ground for the audio output sectionVcc: digital power supplyA.Vcc: analog power supply for the audio output section0M (CLK): master clock input
MOL: left audio output pinMOR: right audio output pin
D0-D7: 8-bit bidirectional data busA0: address select pinA1: address select pin
/RD: read signal (active low)/WR: write signal (active low)/CS: chip select signal (active low)/IRQ: interrupt request signal (active low)/IC: reset signal (active low)
Pin 10: usually unused in normal applications
Some references describe it as NC, while others describe it as a TEST pin.Before going deeper into PCM / DAC, it is helpful to first look at how YM2612 makes FM tones.
The main idea is:
DT, MULTI, TL, AR, D1R, D2R, SL, and RR shape the sound of each operatorYou can try these interactive pages first:
operator1.html
Learn how a single operator changes when you adjust DT, MULTI, TL, AR, D1R, D2R, SL, and RR.operator2.html
Try two operators together and see how modulation and algorithm changes affect the tone.YM2612 synth demo
Combine multiple operators and channels to design more complex sounds in a playable demo.A0 and A1 choose which control port is being accessed.
They switch between address/data access and port 0/port 1 access.
A1=0, A0=0: address port 0A1=0, A0=1: data port 0A1=1, A0=0: address port 1A1=1, A0=1: data port 1chip.write() maps to YM2612 pinsvoid ym2612::write(uint32_t offset, uint8_t data) is a simplified interface.
offset corresponds to the access selected by A1 and A0data corresponds to the 8-bit value on D0-D7The mapping is:
offset = 0: A1=0, A0=0 -> address port 0offset = 1: A1=0, A0=1 -> data port 0offset = 2: A1=1, A0=0 -> address port 1offset = 3: A1=1, A0=1 -> data port 1Example:
chip.write(0, 0x30);
chip.write(1, 0x01);
This means:
0x30 on address port 0.0x01 to that register on data port 0.In other words, software is not changing the sound by magic. It is sending YM2612-specific control values through these chip pins and writing them into YM2612 registers.
The YM2612 is mainly known as a 6-channel FM chip, but it also has a simple DAC playback path.
0x2A: DAC data0x2B: DAC enableWhen DAC playback is enabled, channel 6 can be used for PCM-style sample playback instead of normal FM output.
This is not a separate large PCM engine like later chips. It is a simpler DAC path where software keeps writing sample bytes to the chip.
In practice, this is important for:
In this repository, the current PCM-related browser support is mainly handled through the VGM playback path. That path reads VGM DAC/stream commands and forwards the sample bytes to YM2612 DAC register writes.
Q: Why are there two types of ground, GND and A.GND?
A: The chip has both digital and analog sections.
The analog section is used for audio output, so A.Vcc and A.GND are used for the audio output circuitry behind MOL and MOR.
Q: Why do we need /CS?
A: /CS tells the YM2612 that the current bus access is for this chip.
Without it, multiple chips on the same bus could respond at the same time.
Q: Why do we need /IRQ?
A: /IRQ is mainly used to notify the CPU when an internal timer event occurs.
Q: Why do we need /RD and /WR?
A: /RD and /WR are control signals, not data lines.
The actual data is carried on D0-D7.
Q: What are D0-D7 for?
A: D0-D7 are 8-bit data pins.
They carry digital data between the CPU and the YM2612.
Q: What is /IC for?
A: /IC is the reset signal.
It initializes the chip and clears its registers.