MusicBrainopen hardware · est. NL

Component

SID

v0.5.108

Oscillators & voicesPolyphonicStereoVintage

The Commodore 64 sound chip: three voices and a filter.

Software v0.5.108

Board overview

Overview

The Commodore 64 sound chip: three voices and a filter.

An emulation of the MOS 6581/8580, the sound chip of the Commodore 64, written from scratch for MusicBrain. Each chip has three voices with triangle, saw, pulse and noise, an ADSR envelope per voice and one multimode filter. One module runs one to four chips (the SIDs knob), so up to twelve voices, each chip with its own filter, like a dual or quad-SID machine.

Play it with MIDI-in spread over the voice cells (Poly ▾ → SID ×3, ×6, ×9 or ×12). The waveform switches can be combined, the envelope and filter knobs use the chip's own register values (0–15, cutoff 0–2047), and the Chip switch chooses between the gritty 6581 and the cleaner 8580. Take Mono, the stereo pair L/R (chips spread with Spread), or each chip on its own output S1–S4.

Controls

ControlRangeDefaultWhat it does
TriUit / AanUitTriangle wave on or off.
SawUit / AanUitSawtooth wave on or off.
PulseUit / AanAanPulse wave on or off.
NoiseUit / AanUitNoise on or off; combined with another wave it dies out, as on the chip.
PW0 … 10.5Pulse width: from hollow (narrow) to full (square).
Combo0 … 107How strong combined waveforms are: 0 = pure AND, 4 = 8580, 7 = 6581.
RingUit / AanUitRing-modulates each voice's triangle with the voice before it.
SyncUit / AanUitHard-syncs each voice to the voice before it.
A0 … 150How fast a note comes in (register value 0–15).
D0 … 159How fast it then falls (0–15).
S0 … 1510Sustain level (0–15).
R0 … 159How fast a note fades after the gate closes (0–15).
Coarse-24 … 24 semi0Tuning in semitones.
Fine-100 … 100 ct0Fine tuning in cents.
Vol0 … 1515The chip's 4-bit master volume (0–15).
Level0 … 10.8Output level of the module.
FiltUit / AanUitSends the voices through the filter.
Chip6581 / 85806581Chip model for filter and output: 6581 or 8580.
Cutoff0 … 20471024Filter: the brightness.
Res0 … 150Filter: the resonance.
Curve0 … 10.56581 only: moves the cutoff curve, as no two 6581s are alike (0 = bright, 1 = dark).
LPUit / AanAanLow-pass mode on or off (combine with BP and HP).
BPUit / AanUitBand-pass mode on or off.
HPUit / AanUitHigh-pass mode on or off; LP + HP gives a notch.
SIDs1 … 41How many chips play (1–4), three voices each.
Spread0 … 10.7How far the chips are spread over left and right.

Ports

PortDirectionSignalWhat it carries
voct_1incvPitch of voice 1 (chip 1), 1 V per octave.
voct_2incvPitch of voice 2 (chip 1), 1 V per octave.
voct_3incvPitch of voice 3 (chip 1), 1 V per octave.
voct_4incvPitch of voice 4 (chip 2), 1 V per octave.
voct_5incvPitch of voice 5 (chip 2), 1 V per octave.
voct_6incvPitch of voice 6 (chip 2), 1 V per octave.
voct_7incvPitch of voice 7 (chip 3), 1 V per octave.
voct_8incvPitch of voice 8 (chip 3), 1 V per octave.
voct_9incvPitch of voice 9 (chip 3), 1 V per octave.
voct_10incvPitch of voice 10 (chip 4), 1 V per octave.
voct_11incvPitch of voice 11 (chip 4), 1 V per octave.
voct_12incvPitch of voice 12 (chip 4), 1 V per octave.
gate_1ingateGate of voice 1: starts and releases its envelope.
gate_2ingateGate of voice 2: starts and releases its envelope.
gate_3ingateGate of voice 3: starts and releases its envelope.
gate_4ingateGate of voice 4: starts and releases its envelope.
gate_5ingateGate of voice 5: starts and releases its envelope.
gate_6ingateGate of voice 6: starts and releases its envelope.
gate_7ingateGate of voice 7: starts and releases its envelope.
gate_8ingateGate of voice 8: starts and releases its envelope.
gate_9ingateGate of voice 9: starts and releases its envelope.
gate_10ingateGate of voice 10: starts and releases its envelope.
gate_11ingateGate of voice 11: starts and releases its envelope.
gate_12ingateGate of voice 12: starts and releases its envelope.
Cut+incvAdded to the cutoff; 0 to 1 covers the whole range.
Ext 1inaudioEXT IN of chip 1: any audio through that chip's filter.
2inaudioEXT IN of chip 2, through its filter.
3inaudioEXT IN of chip 3, through its filter.
4inaudioEXT IN of chip 4, through its filter.
S1outaudioChip 1 on its own, to mix and pan yourself.
S2outaudioChip 2 on its own, to mix and pan yourself.
S3outaudioChip 3 on its own, to mix and pan yourself.
S4outaudioChip 4 on its own, to mix and pan yourself.
BendincvPitch bend in V/Oct for all voices.
PW+incvAdded to the pulse width (0 to 1).
LoutaudioLeft: the chips spread over the stereo image with Spread.
RoutaudioRight: the chips spread over the stereo image with Spread.
MonooutaudioMono: all chips summed, with a limiter.

How it works

Each voice has a 24-bit phase accumulator. Saw, triangle and pulse come from its bits, noise from a 23-bit shift register clocked by accumulator bit 19. Every jump in a waveform is smoothed with a PolyBLEP at its exact moment, to keep aliasing down. Ring and Sync link each voice to the one before it (3 → 1 → 2 → 3). Combined waveforms use our own bit-line model: a 0 pulls harder than a 1, so the result is like a weakened AND; the Combo knob sets how weak, with the 8580 and 6581 marked on the scale. Noise in a combination dies out, as on the chip. The ADSR is cycle-exact, with the period table, the pseudo-exponential decay and the 15-bit rate counter, so the famous ADSR bug (a wait of up to about 33 ms) happens by itself.

The filter is a two-pole state-variable filter, 12 dB per octave, with LP, BP and HP as separate switches (LP + HP gives a notch). In 8580 mode the cutoff runs nearly linearly from about 30 Hz to 12 kHz and resonance goes up to Q ≈ 4. In 6581 mode the cutoff follows an S-curve (stuck around 220 Hz at the bottom, steep in the middle, up to about 16 kHz), Curve moves that middle to mimic different chips, resonance is weaker, loud signals distort, and each voice gives a dull click when it starts, as does a volume change. The combined-waveform strengths and the filter curves are tuned by ear, not measured on a chip. A 10 Hz high-pass on the output plays the role of the C64's coupling capacitor. A chip whose voices are all silent costs almost nothing; a playing chip costs about 6 % of the Teensy (measured on 0.5.86).

Runs on

  • Teensy 4.1 (the MusicBrain Brain): about 11.3 % CPU per instance (one note, default settings), measured on firmware 0.5.108.
  • The browser: the editor's simulator runs the same C++ code as WebAssembly, so what you hear while patching is what the Brain plays.

Try it

Patches to play (open them in the editor from their page): SID piano (AT vibrato + comp + studio buizen).

In the editor's example set: 🕹️ SID ×3 (C64), 🕹️ SID ×6 (2 chips, stereo), 🕹️ SID ×9 (3 chips, stereo), 🕹️ SID ×12 (4 chips, stereo), 👾 SID ×3.

Editor: https://editor.musicbrain.nl

Sources & licences

  • Our own clean-room emulation at register level (mmb_dsp/sid.h), written from public documentation: the datasheet, the Commodore 64 Programmer's Reference Guide and published descriptions of the chip's behaviour.
  • It contains no code from reSID or reSIDfp, which are GPL. The MusicBrain code is MIT licensed.
  • The browser simulator runs the same C++ header as WebAssembly.

Versions

  • 0.5.88: EXT IN per chip (Ext 1–4, each through its own chip's filter); twelve SID sounds in the module presets.
  • 0.5.87: noise combined with another waveform no longer overloads the Teensy; chips share their waveform tables.
  • 0.5.86: one to four chips in one module, twelve voice cells, stereo L/R with Spread and separate outputs per chip.
  • 0.5.85: silent chips are skipped and the oscillator avoids doubles; a playing chip went from about 12 % to 8 % CPU.
  • 0.5.84: the engine keeps settings per voice (used by the sister module SID 3-osc).
  • 0.5.83: 6581 model for filter and output, with the Chip switch and Curve.
  • 0.5.82: the filter, 8580 model.
  • 0.5.81: combined waveforms as a bit-line model, with the Combo knob.
  • 0.5.80: DC blocker on the output.
  • 0.5.79: first version: three voices, four waveforms, ring and sync, cycle-exact ADSR; no filter yet.