Sega Mega Drive / Genesis · Yamaha YM2612 + TI SN76489

YM2612 Sound Lab

Six 4-operator FM channels and the Master System’s PSG, emulated register by register. Pick an algorithm, shape each operator’s envelope, and hear the patch change.

All sound labsGame Boy · NES · Master System · Mega Drive · C64 · SNES
Region
Browsers keep audio off until you click. Effects and keys start it too.

Output

FM and PSG mixed, left and right together.

Engine idle
Mixer and analog warmth

Tracker

Furnace-style, ten channels: FM 1–6 and PSG 1–4. Click the grid and play the piano keys. Space plays the pattern, Enter the song.

Songs: files and library
Orders
Row
Instruments · the selected one is used for new notes

in this pattern · 03 playing now · bar and ×count: plays in the song (blue: among the most used) · faded: never played · struck: makes no sound (hover for why)

Keys and effects
  • Z–M and Q–I enter a note. [ ] change octave.
  • 1 enters note off (OFF), = a note release (===).
  • Instrument and volume: two hex digits (FM volume 00–7F, PSG 00–0F). Effect: four hex digits.
00xy 01xx 02xx 03xx 04xyArpeggio, slides, portamento, vibrato
08xy 80xxFM panning (x left, y right; or linear)
09xx 0Fxx 0Axy FAxySpeeds, volume slide, fast volume slide
0Bxx 0Dxx FFxxJump, next pattern at row, stop
10xyLFO: x on/off, y speed
11xx 12xx–15xx 16xyFeedback, operator level, multiplier
17xxDAC mode on FM 6 (samples)
19xx–1Dxx 50xy–5FxxAttack, AM, SL, RR, DT, RS, SSG, DR, D2R
61xx 62xx 63xxAlgorithm, LFO FM and AM depth
20xyPSG noise mode
E1xy E2xy E5xx EAxx ECxx EDxxNote slides, fine pitch, legato, cut, delay

FM channels

Each channel is four operators wired by one of eight algorithms. Carriers (outlined) are heard; modulators bend the carriers’ phase.

PSG channels

The SN76489 inside the VDP: three square waves and noise, written through port $7F.

DAC

Register $2B bit 7 turns FM channel 6 into an 8-bit DAC; the CPU (or a stream) then writes samples to $2A.

Keyboard

Keys Z S X D C V… and Q 2 W 3 E R… play two octaves on the chosen channel.

Register map

Both YM2612 banks ($000–$0FF through ports $4000/$4001, $100–$1FF through $4002/$4003) and the PSG. Click a byte to edit it; recent writes glow.

Write log · newest first

    Build an FM sound, step by step

    Six short steps from one sine wave to a four-operator patch. Each step plays on a chip of its own, so the song and the panels above are not touched.

    How the chip makes sound

    click to open

    Operators

    Each operator is a sine generator with its own envelope. Its phase advances by (fnum × 2^block / 2 + detune) × multiple every chip sample (clock / 144, about 53.3 kHz), so a tone is fnum × 2^(block−1) × clock / 144 / 2^20 Hz. The sine comes from a log-sine table and an exponent table, the way the chip computes it.

    Algorithms

    An algorithm decides which operators modulate which. Algorithm 0 is a chain of four (one carrier, rich and bright); algorithm 7 is four parallel sines (an organ). Operator 1 can feed back into itself for buzzier tones.

    Envelopes

    Attack rate, decay rate to the sustain level, a second decay rate while held, and a release rate. Rates are 5-bit (release 4-bit) and speed up with pitch when rate scaling is on. The envelope is stepped every three chip samples; every four rate steps halve the time.

    Not emulated: SSG-EG envelope shapes, the timers, the DAC’s 9-bit ladder distortion, and the test register.

    From one sine to a sound

    A channel’s sound is the sum of its carriers. A carrier on its own is a sine; a modulator feeding it shifts its sine’s phase back and forth at the modulator’s frequency, which bends the wave and adds harmonics. How far it bends depends on the modulator’s level, which harmonics on the ratio of the two frequencies (their multiples), and an envelope on the modulator makes that change over the note. Drawn by the chip, each three cycles of A4: