NerdySID

Interactive C64 SID audio tutorial

Hello! This application provides a built-in 6502 assembler and SID emulator for runnable examples. The SID file is dynamically built from the editor contents, so you can change things and hear the result. We will build a simple sound engine in incremental steps.

1 - Playing a square wave

Load
Square wave

Registers

Control - $D404, $D40b, $D412

Each channel has a control byte which determines its wave type.

76543210
||||||||
|||||||+- Gate
||||||+-- Sync
|||||+--- Ringmod
||||+---- Test
|||+----- Triangle
||+------ Sawtooth
|+------- Pulse
+-------- Noise

Frequency - $D400-1, $D407-8, $D40e-f

These 2 bytes make a 16-bit value which is added to a phase accumulator. The higher the value, the higher the channel's pitch.

Duty (pulse width) - $D402-3, $D409-a, $D410-1

Only bits 0-3 of the second (high) byte are used, making a 12-bit value. $800 (the midpoint) is a square wave.

Attack/decay - $D405, $D40c, $D413

76543210
||||||||
||||++++- Decay
++++----- Attack

Sustain/release - $D406, $D40d, $D414

76543210
||||||||
||||++++- Release
++++----- Sustain

Filter cutoff - $D415-6

Only bits 0-3 of the first (low) byte are used, making a 12-bit value.

Filter resonance, routing - $D417

76543210
||||||||
|||||||+- Voice 1
||||||+-- Voice 2
|||||+--- Voice 3
||||+---- External input
++++----- Resonance

Filter mode, volume - $D418

76543210
||||||||
||||++++- Volume
|||+----- Lowpass
||+------ Bandpass
|+------- Highpass
+-------- Mute voice 3
Debugger

A: xx; X: xx, Y: xx, PC: xxxx, SP: xx, nv--dizc


From: $ To: $