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
| Command | Syntax | Contents |
|---|---|---|
| 0x80 | 0x80, duration | Rest |
| 0x81-0xFF | note, duration | Note |
| 0x00 | 0x00 | Ends the channel’s sequence. |
| 0x01 | 0x01, byte instrument | Sets the channel’s instrument (source number). |
| 0x02 | 0x02, sbyte left, sbyte right | Sets the channel’s left and right volume. |
| 0x03 | 0x03, ushort address | Moves the read position to the specified address. |
| 0x04 | 0x04, byte count, ushort address | Plays the sequence at the specified address repeatedly, the specified number of times. |
| 0x05 | 0x05 | Marks the end of a subroutine. |
| 0x06 | 0x06, byte duration // normal | Fixes the length of subsequent notes and rests (default duration mode). |
| 0x07 | 0x07 | Cancels default duration mode. |
| 0x08 | 0x08, byte delay, byte interval, byte count, sbyte delta, byte reverse | Sets a pitch bend. Uses the change amount as is. |
| 0x09 | 0x09, byte delay, byte interval, byte count, sbyte delta, byte reverse | Sets a pitch bend. Uses the change amount with its sign inverted. |
| 0x0A | 0x0A | Disables pitch bend. |
| 0x0B | 0x0B, byte tempo | Sets the BGM tempo. |
| 0x0C | 0x0C, sbyte delta | Adds a value to the BGM tempo. |
| 0x0D | 0x0D, byte length, byte rate, sbyte depth | Sets vibrato without delay. |
| 0x0E | 0x0E | Disables vibrato. |
| 0x0F | 0x0F, byte length, byte rate, sbyte depth, byte delay | Sets vibrato with delay. |
| 0x10 | 0x10, byte adsr1, byte adsr2 | Sets the channel’s envelope (ADSR). |
| 0x11 | - | Undefined |
| 0x12 | 0x12, sbyte tuning | Sets the channel’s tuning value. |
| 0x13 | 0x13, sbyte transpose | Sets the channel’s transpose value. |
| 0x14 | 0x14, sbyte delta | Adds a value to the channel’s transpose value. |
| 0x15 | 0x15, sbyte feedback, sbyte left, sbyte right | Sets the echo feedback and volume, and enables echo. |
| 0x16 | 0x16 | Enables echo on the channel. |
| 0x17 | 0x17 | Disables echo on the channel. |
| 0x18 | 0x18, sbyte c0, sbyte c1, sbyte c2, sbyte c3, sbyte c4, sbyte c5, sbyte c6, sbyte c7 | Sets the echo FIR filter coefficients. |
| 0x19 | 0x19, byte clock | Sets the DSP noise frequency. |
| 0x1A | 0x1A | Switches the channel’s sound source to noise. |
| 0x1B | 0x1B | Switches the channel’s sound source back to the sample. |
| 0x1C | 0x1C, byte note | Sets the note number used by note events 0xE0, 0xE2-0xFF. |
| 0x1D | 0x1D, byte note | Sets the note number used by note event 0xE1. |
| 0x1E | 0x1E, sbyte left1, sbyte right1, sbyte left2, sbyte right2 | Registers two volume presets. |
| 0x1F | 0x1F, byte delay | Sets the echo delay and allocates the echo buffer. |
| 0x20 | 0x20 | Sets volume preset 1 as the channel volume. |
| 0x21 | 0x21, ushort address | Plays the sequence at the specified address only once. |
| 0x22 | 0x22, byte instrument, sbyte transpose, sbyte tuning, sbyte left, sbyte right, byte adsr1, byte adsr2 | Sets instrument, transpose, tuning, volume and ADSR all at once. |
| 0x23 | 0x23, sbyte volume | Sets the channel’s left and right volume to the same value. |
| 0x24 | 0x24, byte scale | Sets the volume scale of the BGM channels. |
| 0x25 | - | Undefined |
| 0x26 | 0x26, byte delay, byte interval, byte count, sbyte delta | Sets a pitch bend that goes back and forth the same number of times. Uses the change amount with its sign inverted. |
| 0x27 | 0x27, byte delay, byte interval, byte count, sbyte delta | Sets a pitch bend that goes back and forth the same number of times. |
| 0x28 | - | Undefined |
| 0x29 | - | Undefined |
| 0x2A | - | Undefined |
| 0x2B | 0x2B | Switches to the mode in which note lengths are specified in 16 bits. |
| 0x2C | 0x2C | Switches back to the mode in which note lengths are specified in 8 bits. |
| 0x2D | - | Undefined |
| 0x2E | - | Undefined |
| 0x2F | - | Undefined |
| 0x30 | 0x30 | Disables echo on the channel. An alias of command 0x17. |
| 0x31 | 0x31 | Sets volume preset 2 as the channel volume. |
| 0x32 | 0x32 | Disables echo on the channel. An alias of command 0x17. |