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.

C64 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.

PropertyValue
ChipSID 6581 (early) or 8580 (late)
Registers$D400–$D41C
Voices3, each 7 registers
WaveformsTriangle, sawtooth, pulse, noise
EnvelopeADSR per voice
FilterOne 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.

ParameterWidthRole
Frequency16 bitsPitch of the voice.
Pulse width12 bitsDuty of the pulse waveform.
Waveform4 select bitsTriangle, sawtooth, pulse, noise.
Attack / decay4 bits eachRise, then fall to sustain.
Sustain / release4 bits eachHeld 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.

OffsetRegisterContents
+0Frequency lowLow 8 bits of the 16-bit frequency.
+1Frequency highHigh 8 bits of the frequency.
+2Pulse width lowLow 8 bits of the 12-bit pulse width.
+3Pulse width highHigh 4 bits of the pulse width.
+4ControlGate (bit 0), sync, ring mod, test, and waveform selects (triangle, sawtooth, pulse, noise).
+5Attack / decayAttack in the high nibble, decay in the low nibble.
+6Sustain / releaseSustain 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.

RegisterContents
$D415Filter cutoff low (3 bits used).
$D416Filter cutoff high (8 bits).
$D417Resonance (high nibble) and filter enable per voice (low bits).
$D418Filter 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.

AddressUse
$D400–$D406Voice 1 (7 registers).
$D407–$D40DVoice 2 (7 registers).
$D40E–$D414Voice 3 (7 registers).
$D415–$D418Filter cutoff, resonance, mode and master volume.
$D419–$D41APaddle X and Y (analogue inputs, read-only).
$D41BVoice 3 oscillator output (read-only).
$D41CVoice 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.

ParameterBitsRangeRegister
Frequency160–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.

ParameterBitsRangeRegister
Triangle1On/off$D404 bit 4
Sawtooth1On/off$D404 bit 5
Pulse1On/off$D404 bit 6
Noise1On/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.

ParameterBitsRangeRegister
Pulse width120–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.

ParameterBitsRangeRegister
Gate1On/off (trigger)$D404 bit 0
Attack416 rates$D405 high nibble
Decay416 rates$D405 low nibble
Sustain40–15 level$D406 high nibble
Release416 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.

ParameterBitsRangeRegister
Ring-mod enable1On/off$D404 bit 2

Hard sync

Resets this voice's oscillator from the previous voice's, for a tearing sync-lead timbre.

ParameterBitsRangeRegister
Sync enable1On/off$D404 bit 1

Noise

The noise waveform, pitched by the same 16-bit frequency, for drums and hiss.

ParameterBitsRangeRegister
Noise select1On/off$D404 bit 7
Pitch160–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.

ParameterBitsRangeRegister
Cutoff110–2047$D415 low (3 bits), $D416 high (8 bits)
Resonance40–15$D417 high nibble
Voice routing3Enable per voice$D417 bits 0–2
Mode (LP/BP/HP)3Combinable$D418 bits 4–6

Master volume

A single global level for the whole chip; per-voice loudness otherwise comes from the ADSR sustain.

ParameterBitsRangeRegister
Master volume40–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.

CommandWhat it doesAutomatic or driven
Note / pitch16-bit frequency per voiceAutomatic
GateStart and release the ADSR envelopeAutomatic
WaveformTriangle, sawtooth, pulse or noiseAutomatic
Pulse width12-bit duty of the pulse waveAutomatic; PWM sweep is driven
FilterCutoff, resonance and mode, sharedAutomatic; a sweep is driven
Ring-mod / syncModulate or sync a voice from its neighbourAutomatic
Master volumeGlobal 4-bit levelAutomatic

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.

MethodHow it worksDepthMax sample rate
Volume-register DACTimer or raster interrupt writes the $D418 low nibble4 bits~4 to 8 kHz
Combined waveform (8580)Gate a voice so the volume has a signal to modulate4 bits~8 kHz