Composing in SID Factory II, Part 4 — Instruments (Chordian)
A tutorial blog post by chordian on making instruments in sid-factory-ii: what the ADSR bytes do, why hard restart exists, the four waveforms and their combinations on old and new chips, the noise lock-up and the test bit, and how the wave table works — ending with an "oldskool snare drum" recipe. Written hands-on: every claim comes with values to type and a song to play.
Key claims#
- ADSR: each of attack, decay, sustain, release is a 4-bit nibble. Examples on instrument bytes:
04 69= instant attack, short decay 4 to sustain 6, long release 9 (an audible volume bump at the start);00 a0= instant everything at sustain A, "louder";9b 2a= slow fade-in, slower decay to a quiet 2, slow release. Note-off "drops everything it's doing … and immediately starts fading it out, regardless of what volume level the attack or decay timers had actually reached" — with long attacks the notes "never really get started". - Hard restart: a sequence of short notes kept gated until the next one makes "the ADSR stumble here and there"; some values alleviate it. Hard restart "works by gating off and resetting the ADSR values a few ticks before the next note triggers"; most SID Factory II drivers do it "exactly two ticks before". Example: a 15-tick note plays 13 ticks, then the restart gates off and applies the HR ADSR — possibly "a tiny bit staccato", but "the next note always triggers perfectly". Enable it with bit
$80of the instrument's third byte; the HR table pair defaults to0F 00— "I have never had to change it". - Waveforms as wave-table bytes with gate:
11triangle ("closest … to the sine"),21sawtooth,41pulse ("the only waveform that can be modulated. Great for leaders"),81noise. Combinations:31tri+saw "virtually inaudible" on the 6581, thin on the 8580;51tri+pulse "the most used combined waveform since it's clearly audible on both";61saw+pulse almost inaudible old, organ-like new;71all three virtually inaudible old, thinner than31new. Chip history: 6581 (1982) — combined waveforms were never intended by bob-yannes; 8580 (1986, white 64C) — more responsive filter, much improved combining. SID Factory II defaults to the 8580. - Noise lock-up and the test bit: combining noise with another waveform (
91and up) produces silence and locks the noise generator so that81stays silent afterwards, until the test bit is set. The instrument flag$10(third byte) sets the test bit briefly at the start of every note ("also known as the oscillator reset") — "Setting the test bit has no downsides." - Pulse is inaudible until a pulse width is set; minimal pulse table
84 00 00/7f 00 00. - Wave table: one row per tick from the instrument's wave index until a
7f xxloop row; repeated rows slow the alternation ("Repeating lines in the wave table can often make instruments sound more pleasant"); second byte = semitone offset (0c= +1 octave) — but slide/portamento/vibrato only work while the offset is00, so leave the sustained rows at00; offsets that leave the 8-octave frequency table sound "somewhat random". Values80–dfare static notes taken straight from the frequency table, unaffected by the played note — for a static hi-hat before a bass note, or a fully static drum. - Snare recipe:
81 ca(noise, high, one tick) ·41 a8·41 a4(pulse at two medium static pitches — a "thunk" slide) ·80 ca(noise, gate off) ·7f 08(loop on the gated-off noise). Gating off inside the loop sends the drum into release even when the sequence holds+++; every note key gives the same drum. Keeping notes gated with+++packs smaller than---rows. Advice: keep wave-table rows gated on until the looping part, because gate on/off across rows gives "a wobbling volume that you can't always trust". - SID Factory II facts in passing: F10 file selector,
Ctrl+1/2/3toggle tracks,Alt+i/w/pinstrument/wave/pulse tables,Shift+q…play an instrument,Ctrl+Enterjumps from an instrument's table index to the table,Shift+Enteropens a bit editor for a flag byte; Vincenzo's two SID Factory II video tutorials on YouTube (StrayBoom).
Practical takeaways#
Three rules worth carrying to any SID tracker: enable hard restart and leave its ADSR at 0F00; always set the test bit on the first frame; put the pitch offsets only on the short attack rows of a wave table so slides and vibrato keep working. The snare recipe is the same shape as the classic wavetable drum in wavetable-programming.
Notable quotes#
"Hard restart was invented to defeat this ADSR bug."
"Setting the test bit has no downsides. If you want, you can always leave it enabled."
Pages touched#
sid-factory-ii · chordian · hard-restart · adsr-envelope · sid · wavetable-programming · instrument-design · ring-modulation-and-sync · pulse-width-modulation · bob-yannes · octave-bass · semitone-math · melody-writing · diatonic-chords · sound-effects