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 · SNESThe SID’s single audio output, after the filter and master volume.
Each voice: a 24-bit phase accumulator, a waveform selector, and an ADSR envelope that the gate bit starts and releases.
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.
One analog filter for the whole chip. Voices are routed through it or straight to the output; the curve shows the selected modes.
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.
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.
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.
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.
Furnace-style, three voices. Click the grid and play the piano keys. Space plays the pattern, Enter the song.
| Row |
|---|
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)
Songs taken from games keep each vibrato or slide as a list of pitch offsets (1/32 semitone per tick); a note picks one, shown as ~NN after its instrument. Shaded: the part that repeats.
OFF), = a note release (===).00xy 01xx 02xx 03xx 04xy | Arpeggio, slides, portamento, vibrato |
09xx 0Fxx 0Axy | Speeds, volume slide |
0Bxx 0Dxx FFxx | Jump, next pattern at row, stop |
10xx | Waveform (1 tri, 2 saw, 4 pulse, 8 noise; add to combine) |
3xxx 12xx 22xx 23xx 1Cxy | Pulse width (fine, coarse), slide up/down, reset |
4xxx 11xx 24xx 25xx 1Bxy | Cutoff (fine, coarse), slide up/down, reset |
13xx 14xx | Resonance, filter mode (1 low, 2 band, 4 high) |
20xy 21xy 1Exy | Attack/decay, sustain/release, single ADSR field, ring, sync, voice 3 off |
15xx 1Axx | Hard-reset time, no hard reset on this voice |
E1xy E2xy E5xx EAxx ECxx EDxx | Note slides, fine pitch, legato, cut, delay |