Commodore 64 · MOS 6581 / 8580 SID

SID Sound Lab

Three oscillators with four waveforms, hardware envelopes, ring modulation, sync and an analog multimode filter, emulated register by register. It also plays real C64 tunes: a 6510 CPU runs the original player code.

UntestedThis lab has not been properly tested yet. Expect rough edges and bugs, in the sound as well as the page.

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

Output

The SID’s single audio output, after the filter and master volume.

Engine idle
Mixer and analog warmth

Voices

Each voice: a 24-bit phase accumulator, a waveform selector, and an ADSR envelope that the gate bit starts and releases.

Keyboard

Keys Z S X D C V… and Q 2 W 3 E R… play two octaves on the chosen voice with its current waveform and envelope.

Filter and volume

One analog filter for the whole chip. Voices are routed through it or straight to the output; the curve shows the selected modes.

Register map

The 29 registers at $D400–$D41C. Click a byte to edit it; recent writes glow. $D419–$D41C are read-only: paddles, oscillator 3 and envelope 3.

Write log · newest first

    How the chip makes sound

    click to open

    Oscillators

    Every clock cycle (about 1 MHz) each voice adds its 16-bit frequency register to a 24-bit accumulator, so the pitch is freq × clock / 2^24 Hz. The top 12 bits become the sawtooth; the triangle folds them; the pulse compares them with the 12-bit pulse width; the noise is a 23-bit shift register clocked by accumulator bit 19. Choosing several waveforms ANDs them together.

    Sync restarts a voice whenever the previous voice wraps; ring modulation flips its triangle with the previous voice’s top bit.

    Envelopes

    Setting the gate starts the attack, a linear climb to 255; then the decay falls to the sustain level and holds; clearing the gate releases to zero. Decay and release slow down as the level drops, which gives the curves their exponential shape. Rates come from a 15-bit counter compared for equality, so lowering a rate at the wrong moment makes the counter wrap round 32768 first: the famous ADSR delay bug.

    Filter, models and digis

    The 6581 filter’s cutoff curve is steep and varies from chip to chip; the 8580 is close to linear. The 6581 also leaks a DC offset into the output that the master volume scales, so writing the volume register thousands of times a second plays 4-bit samples. That is how many games spoke and drummed; on the 8580 those samples nearly vanish.

    Simplified here: combined waveforms are a plain AND (the real chips are quieter and model-specific), the filter is an ideal state-variable filter with measured cutoff curves, and there is no external audio input or filter distortion.

    Tracker

    Furnace-style, three voices. 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: two hex digits. Volume: 00–0F, and it is global (the SID has one volume). Effect: four hex digits.
    • Two ticks before each new note the voice is hard-reset (test bit, gate off), as in Furnace, so envelopes restart cleanly.
    00xy 01xx 02xx 03xx 04xyArpeggio, slides, portamento, vibrato
    09xx 0Fxx 0AxySpeeds, volume slide
    0Bxx 0Dxx FFxxJump, next pattern at row, stop
    10xxWaveform (1 tri, 2 saw, 4 pulse, 8 noise; add to combine)
    3xxx 12xx 22xx 23xx 1CxyPulse width (fine, coarse), slide up/down, reset
    4xxx 11xx 24xx 25xx 1BxyCutoff (fine, coarse), slide up/down, reset
    13xx 14xxResonance, filter mode (1 low, 2 band, 4 high)
    20xy 21xy 1ExyAttack/decay, sustain/release, single ADSR field, ring, sync, voice 3 off
    15xx 1AxxHard-reset time, no hard reset on this voice
    E1xy E2xy E5xx EAxx ECxx EDxxNote slides, fine pitch, legato, cut, delay