Sequence syntax

Describes the sequence data format and the specification of all commands of the RareWare Sound Driver used in Donkey Kong Country 2/3, Diddy’s Kong Quest and Dixie Kong’s Double Trouble.
A disassembly and an equivalent implementation are published at RareSpc.
For the DKC1 driver, see DKC1 development documents - Sequence syntax.

Contents of this section

Structure of sequence data
Describes specifications common to all sequence data, such as the layout of sequence data, event types, how note lengths are specified, and tempo.

Event list

CommandSyntaxContents
0x800x80, durationRest
0x81-0xFFnote, durationNote
0x000x00Ends the channel’s sequence.
0x010x01, byte instrumentSets the channel’s instrument (source number).
0x020x02, sbyte left, sbyte rightSets the channel’s left and right volume.
0x030x03, ushort addressMoves the read position to the specified address.
0x040x04, byte count, ushort addressPlays the sequence at the specified address repeatedly, the specified number of times.
0x050x05Marks the end of a subroutine.
0x060x06, byte duration // normalFixes the length of subsequent notes and rests (default duration mode).
0x070x07Cancels default duration mode.
0x080x08, byte delay, byte interval, byte count, sbyte delta, byte reverseSets a pitch bend. Uses the change amount as is.
0x090x09, byte delay, byte interval, byte count, sbyte delta, byte reverseSets a pitch bend. Uses the change amount with its sign inverted.
0x0A0x0ADisables pitch bend.
0x0B0x0B, byte tempoSets the BGM tempo.
0x0C0x0C, sbyte deltaAdds a value to the BGM tempo.
0x0D0x0D, byte length, byte rate, sbyte depthSets vibrato without delay.
0x0E0x0EDisables vibrato.
0x0F0x0F, byte length, byte rate, sbyte depth, byte delaySets vibrato with delay.
0x100x10, byte adsr1, byte adsr2Sets the channel’s envelope (ADSR).
0x11-Undefined
0x120x12, sbyte tuningSets the channel’s tuning value.
0x130x13, sbyte transposeSets the channel’s transpose value.
0x140x14, sbyte deltaAdds a value to the channel’s transpose value.
0x150x15, sbyte feedback, sbyte left, sbyte rightSets the echo feedback and volume, and enables echo.
0x160x16Enables echo on the channel.
0x170x17Disables echo on the channel.
0x180x18, sbyte c0, sbyte c1, sbyte c2, sbyte c3, sbyte c4, sbyte c5, sbyte c6, sbyte c7Sets the echo FIR filter coefficients.
0x190x19, byte clockSets the DSP noise frequency.
0x1A0x1ASwitches the channel’s sound source to noise.
0x1B0x1BSwitches the channel’s sound source back to the sample.
0x1C0x1C, byte noteSets the note number used by note events 0xE0, 0xE2-0xFF.
0x1D0x1D, byte noteSets the note number used by note event 0xE1.
0x1E0x1E, sbyte left1, sbyte right1, sbyte left2, sbyte right2Registers two volume presets.
0x1F0x1F, byte delaySets the echo delay and allocates the echo buffer.
0x200x20Sets volume preset 1 as the channel volume.
0x210x21, ushort addressPlays the sequence at the specified address only once.
0x220x22, byte instrument, sbyte transpose, sbyte tuning, sbyte left, sbyte right, byte adsr1, byte adsr2Sets instrument, transpose, tuning, volume and ADSR all at once.
0x230x23, sbyte volumeSets the channel’s left and right volume to the same value.
0x240x24, byte scaleSets the volume scale of the BGM channels.
0x25-Undefined
0x260x26, byte delay, byte interval, byte count, sbyte deltaSets a pitch bend that goes back and forth the same number of times. Uses the change amount with its sign inverted.
0x270x27, byte delay, byte interval, byte count, sbyte deltaSets a pitch bend that goes back and forth the same number of times.
0x28-Undefined
0x29-Undefined
0x2A-Undefined
0x2B0x2BSwitches to the mode in which note lengths are specified in 16 bits.
0x2C0x2CSwitches back to the mode in which note lengths are specified in 8 bits.
0x2D-Undefined
0x2E-Undefined
0x2F-Undefined
0x300x30Disables echo on the channel. An alias of command 0x17.
0x310x31Sets volume preset 2 as the channel volume.
0x320x32Disables echo on the channel. An alias of command 0x17.