SIDin #2 — Matt Gray's Driller music routine (Stefano Tognon, 2002)
Stefano Tognon's reverse-engineering of the driller player, published in his free SID e-zine sidin in 2002 — the documentation of the matt-gray-player as it was in 1987: song/track/pattern structure, the pattern command bytes, the two 8-byte instrument tables, and how arpeggio, vibrato and portamento are computed. The chapter ends with a fully commented listing.
Key claims#
- Done from "the psid rip of Driller that is present in the HVSC", so "probably not a 100% version of the engine, as the rip did not contains the sound fx"; the rip contains an unused note pattern. Tognon notes that Gray had earlier used "RockMonitor 2/3 and MusicMaster" (soundmonitor). The code's rights "remain to the two authors".
- Songs: a
songstable of low/high pointers to three tracks per song (ltr1/htr1 … ltr3/htr3); song 0 means volume off. To play, store the song number insongsNumber; the engine sets it to$AB("current song") once started. - Tracks are lists of pattern numbers, e.g.
drillerMainTr1: .byte $01, $01, $07, $09, $09, $09, $01, $07;$FFrestarts the track,$FEstops the sound. Pattern pointers sit inpatptl/patpth(orderlist). - Pattern bytes:
$00= gate off for the previous note (release starts — "you can hear this effect in the last long sound at the end of the tune");$xx= note number;$FA nn= instrumentnn;$FB mm= negative portamento ofmm;$FC pp= positive portamento;$FD kk= note durationkk;$FF= end of pattern. Example:.byte $FA,$0C / $FD,$01 / $31,$3D,$49,$3D / $31,$3D,$49,$3D / $FF— instrument$0C, very short duration, notes$31 $3D $49 $3D(a 12-semitone stack). Another:$FA,$13 / $FD,$07 / $FC,$37,$45 / $FD,$2F / $47 / $FD,$07 / $FB,$7F,$47— slide up into$45with intensity$37, hold$47for$2F, then slide it down by$7F(pitch-slide-and-portamento). - Instruments = two 8-byte tables. Table 1: byte 0 pulse width as two nibbles
xxyy→ low bytexx00, high byte00yy; 1 control register (waveform + gate); 2 attack/decay; 3 sustain/release; 4 pulse inc/dec step — the high byte bounces between the hard-coded limits$08and$0E("pulse from 2048 to 3584"); 5 arpeggioxxyy= number of notesxxand arpeggio-table indexyy; 6 control register written "at the end of the note, but in the same frame of when setting the new note"; 7 effect bits: bit 0 a frequency/wave effect, bit 1 re-set the instrument's pulse at each new note (otherwise the last pulse value carries over), bit 2 waveform switch "to be used for drums effect" — for the first two frames of a note the control register from table 2 byte 2 is used, then the normal one (instrument-tables, wavetable-programming, hard-restart). - Table 2: byte 0 vibrato frequency step, 1 vibrato length, 2 control register for those first two frames (and for effect bit 0), 3 portamento value, 4 portamento flag (
$00none,$01negative on the low byte,$02positive low,$03negative on the high byte, other = positive high), 5 length of the effect-1 cycle, 6–7 unused. - Arpeggio: pointer tables to short lists of semitone offsets, e.g.
Table0: $00,$08,$12(length 3),Table1: $00,$08(2),Table2: $00,$04,$08(3); an instrument value30means Table0 with 3 values,22Table2 with only 2 — "this method allow to use a very complex arpeggio effect" (chord-arpeggio). - Vibrato: with step V, length L and frequency F the routine runs F−V for L frames, then F+V for 2L, F−V for 2L … starting from a half cycle; "V=10 and L=2 with an A4 note (440Hz)" gives 430, 420, 430, 440, 450, 460, 450, 440, 430, 420 … — a triangle on the raw frequency value, so deeper in cents at low pitch (vibrato; compare Gray's own description in s-c64com-matt-gray-interview).
- Effect bit 0: alternates the instrument's control register with noise (
$81) while a high-frequency value is decremented and XORed with$23each tick — Tognon is unsure of the exact behaviour ("I have not yet experimented this flag"). - Rastertime: minimum 10 raster lines (sound-effect case), "when reading new notes/patterns, the maximum grown until 34!" (sid-player-routine). "The Matt's engine was used in the past even by Tomas Danko and Jon Wells for a total of 11 tunes."
- The listing (PSID header "Driller / Matt Gray / 1988 Incentive"; note the header comment's typo "1997") is what codebase64 and the ACME conversion in s-realdmx-sid-players reproduce.
Practical takeaways#
- A complete, small driver design to learn from: three tracks of pattern numbers, patterns of note bytes with a few
$Fxcommands, instruments as two fixed 8-byte rows plus shared arpeggio lists. Compare the Soundmonitor sound of 24 bytes (s-64er-soundmonitor-article) and MUSICFILE's 8-byte rows (s-realdmx-sid-players). - Gray's "drum" is a 2-frame waveform switch (noise first), his pulse "EG" a bounce between fixed limits, his vibrato a triangle — all effects that goattracker and sid-wizard later expose as table entries.
Notable quotes#
"May be now you know better how Matt had created a so beautiful sound. However, you should experiment with the source if you want to understand better how the engine works."
Relevance to the wiki#
Primary technical source for matt-gray-player and driller; concrete 1987 examples for instrument-tables, chord-arpeggio, vibrato, pitch-slide-and-portamento, pulse-width-modulation and sid-player-routine; creates sidin.
Pages touched#
matt-gray-player · matt-gray · driller · sidin · sid-player-routine · instrument-tables · chord-arpeggio · vibrato · pitch-slide-and-portamento · pulse-width-modulation · wavetable-programming · hard-restart · orderlist · hvsc