C64 Audio
The Commodore 64 makes sound with the SID chip, the 6581 in early machines and the 8580 later. It has three independent voices, each a full synthesiser with its own frequency, waveform and envelope, plus a shared filter and master volume. Its registers sit at $D400–$D41C.
- Overview
- The three voices
- Voice register map
- Filter and volume
- Register map
- Channel capabilities
- Sequencer commands
- Sampled audio
Overview
SID is a three-voice analogue synthesiser on a chip. Each voice generates a waveform at a chosen pitch, shapes its volume with an ADSR envelope, and can be routed through a shared filter. A master volume sets the overall level. Once its registers are written the chip plays on its own, so music runs under a game.
| Property | Value |
|---|---|
| Chip | SID 6581 (early) or 8580 (late) |
| Registers | $D400–$D41C |
| Voices | 3, each 7 registers |
| Waveforms | Triangle, sawtooth, pulse, noise |
| Envelope | ADSR per voice |
| Filter | One shared, low-pass, band-pass, high-pass |
The three voices
Each voice has a 16-bit frequency, so pitch is set finely across the audible range. The waveform is chosen by the control register: triangle, sawtooth, a pulse whose width comes from a 12-bit register, or noise. A voice's volume over time follows its ADSR envelope, started and released by the gate bit.
| Parameter | Width | Role |
|---|---|---|
| Frequency | 16 bits | Pitch of the voice. |
| Pulse width | 12 bits | Duty of the pulse waveform. |
| Waveform | 4 select bits | Triangle, sawtooth, pulse, noise. |
| Attack / decay | 4 bits each | Rise, then fall to sustain. |
| Sustain / release | 4 bits each | Held level, then fall to silence. |
Voice register map
Each voice occupies seven consecutive registers. Voice 1 starts at $D400, voice 2 at $D407, voice 3 at $D40E; the layout repeats. The control register holds the gate bit and the four waveform selects along with ring modulation and sync flags.
| Offset | Register | Contents |
|---|---|---|
| +0 | Frequency low | Low 8 bits of the 16-bit frequency. |
| +1 | Frequency high | High 8 bits of the frequency. |
| +2 | Pulse width low | Low 8 bits of the 12-bit pulse width. |
| +3 | Pulse width high | High 4 bits of the pulse width. |
| +4 | Control | Gate (bit 0), sync, ring mod, test, and waveform selects (triangle, sawtooth, pulse, noise). |
| +5 | Attack / decay | Attack in the high nibble, decay in the low nibble. |
| +6 | Sustain / release | Sustain in the high nibble, release in the low nibble. |
Filter and volume
SID has one filter shared by the voices. Its cutoff is 11 bits across two registers, and the resonance and per-voice routing sit in another. The mode-and-volume register $D418 picks low-pass, band-pass or high-pass, cuts voice 3 if wanted, and sets the 4-bit master volume in its low nibble.
| Register | Contents |
|---|---|
| $D415 | Filter cutoff low (3 bits used). |
| $D416 | Filter cutoff high (8 bits). |
| $D417 | Resonance (high nibble) and filter enable per voice (low bits). |
| $D418 | Filter mode (LP, BP, HP bits), voice 3 off, and master volume (low nibble). |
Setting more than one mode bit combines responses; low-pass and high-pass together give a notch. The filter shapes whichever voices are routed to it while the rest pass through untouched.
Register map
The whole chip fits in 29 registers from $D400. The three voices take the first 21, the filter and volume the next four, and the last four are read-only sensing registers.
| Address | Use |
|---|---|
| $D400–$D406 | Voice 1 (7 registers). |
| $D407–$D40D | Voice 2 (7 registers). |
| $D40E–$D414 | Voice 3 (7 registers). |
| $D415–$D418 | Filter cutoff, resonance, mode and master volume. |
| $D419–$D41A | Paddle X and Y (analogue inputs, read-only). |
| $D41B | Voice 3 oscillator output (read-only). |
| $D41C | Voice 3 envelope output (read-only). |
Channel capabilities
SID has three identical voices: voice 1 at $D400, voice 2 at $D407, voice 3 at $D40E. The addresses below are voice 1; add 7 or 14 for the others. The filter and the master volume are single units shared by all three voices. Each subsection is one capability the sequencer can drive, with its parameters and where they live in hardware.
Pitch
Sets the fundamental frequency of the voice, linear across the audible range.
| Parameter | Bits | Range | Register |
|---|---|---|---|
| Frequency | 16 | 0–65535 (linear) | $D400 low, $D401 high |
Waveform
Selects one of four shapes, which may be combined by setting more than one bit for metallic tones.
| Parameter | Bits | Range | Register |
|---|---|---|---|
| Triangle | 1 | On/off | $D404 bit 4 |
| Sawtooth | 1 | On/off | $D404 bit 5 |
| Pulse | 1 | On/off | $D404 bit 6 |
| Noise | 1 | On/off | $D404 bit 7 |
Duty (pulse width)
The width of the pulse waveform, from a thin nasal tone to a hollow square; modulating it over time is done by the player.
| Parameter | Bits | Range | Register |
|---|---|---|---|
| Pulse width | 12 | 0–4095 (0–100%) | $D402 low, $D403 high (4 bits) |
Amplitude envelope
A per-voice ADSR that shapes the volume; the gate bit starts the attack and releases the note.
| Parameter | Bits | Range | Register |
|---|---|---|---|
| Gate | 1 | On/off (trigger) | $D404 bit 0 |
| Attack | 4 | 16 rates | $D405 high nibble |
| Decay | 4 | 16 rates | $D405 low nibble |
| Sustain | 4 | 0–15 level | $D406 high nibble |
| Release | 4 | 16 rates | $D406 low nibble |
Ring modulation
Replaces the voice's triangle with a ring-modulated product of it and the previous voice's oscillator, for bell and clang tones.
| Parameter | Bits | Range | Register |
|---|---|---|---|
| Ring-mod enable | 1 | On/off | $D404 bit 2 |
Hard sync
Resets this voice's oscillator from the previous voice's, for a tearing sync-lead timbre.
| Parameter | Bits | Range | Register |
|---|---|---|---|
| Sync enable | 1 | On/off | $D404 bit 1 |
Noise
The noise waveform, pitched by the same 16-bit frequency, for drums and hiss.
| Parameter | Bits | Range | Register |
|---|---|---|---|
| Noise select | 1 | On/off | $D404 bit 7 |
| Pitch | 16 | 0–65535 | $D400 low, $D401 high |
Filter (shared)
One multimode filter, shared by the voices, each of which can be routed in or bypassed. The mode bits can be combined, and low plus high gives a notch.
| Parameter | Bits | Range | Register |
|---|---|---|---|
| Cutoff | 11 | 0–2047 | $D415 low (3 bits), $D416 high (8 bits) |
| Resonance | 4 | 0–15 | $D417 high nibble |
| Voice routing | 3 | Enable per voice | $D417 bits 0–2 |
| Mode (LP/BP/HP) | 3 | Combinable | $D418 bits 4–6 |
Master volume
A single global level for the whole chip; per-voice loudness otherwise comes from the ADSR sustain.
| Parameter | Bits | Range | Register |
|---|---|---|---|
| Master volume | 4 | 0–15 | $D418 bits 0–3 |
Sequencer commands
The native operations a sequence drives on the SID, and whether each runs on its own once set or must be updated every tick. SID latches almost everything: set the registers and gate a voice, and the envelope, waveform, filter and ring modulation run without the CPU. Only time-varying effects need per-tick driving.
| Command | What it does | Automatic or driven |
|---|---|---|
| Note / pitch | 16-bit frequency per voice | Automatic |
| Gate | Start and release the ADSR envelope | Automatic |
| Waveform | Triangle, sawtooth, pulse or noise | Automatic |
| Pulse width | 12-bit duty of the pulse wave | Automatic; PWM sweep is driven |
| Filter | Cutoff, resonance and mode, shared | Automatic; a sweep is driven |
| Ring-mod / sync | Modulate or sync a voice from its neighbour | Automatic |
| Master volume | Global 4-bit level | Automatic |
Sampled audio
SID has no sample channel, but the 4-bit master volume in the low nibble of $D418 can be used as a rough DAC. Writing a stream of volume values from a fast, timer-driven or raster interrupt makes the output level follow a recorded waveform, giving 4-bit digitised playback; this is the trick behind speech in games such as Ghostbusters. On the 6581 a quirk of the chip makes those volume changes audible on their own, so the samples come straight out. On the later 8580 that path is nearly silent, so players sound a voice with the test bit or a combined waveform to give the volume something to scale.
Playback ties up the CPU with precise timing, so it suits short speech and drums rather than continuous music, though advanced players reach several effective bits by combining the volume register with pulse-width tricks on a voice.
| Method | How it works | Depth | Max sample rate |
|---|---|---|---|
| Volume-register DAC | Timer or raster interrupt writes the $D418 low nibble | 4 bits | ~4 to 8 kHz |
| Combined waveform (8580) | Gate a voice so the volume has a signal to modulate | 4 bits | ~8 kHz |