# Command Reference

## Standard commands:

The following is a list of all available hex commands that may be used in a song. In all cases, the parameters are listed in the order in which they are to be used after the initial command. If a parameter is a number, then that parameter must be the specified constant instead of being variable.

Command | Purpose | Description | Parameters
--- | --- | --- | ---
$DA | Instrument | Sets the instrument for the current channel. | $XX | Instrument to set to. Default limit is $00 to $12.
$DB | Pan | Sets the panning for the current channel. | $XX | Panning value. Must be between $00 and $13. $0A is centered. Note that setting the highest two bits will enable surround sound.
$DC | Pan fade | Fades the pan over time | $XX | Duration
$YY | Final panning value
$DD | Pitch bend | Slides from the currently playing note to the specified note smoothly. | $XX | Delay
$YY | Duration
$ZZ | Note
$DE | Vibrato | Turns on vibrato for the current channel | $XX | Delay
$YY | Duration
$ZZ | Amplitude
$DF | Vibrato off | Turns off vibrato.
$E0 | Global volume | Sets the song's global volume | $XX | Volume
$E1 | Global volume fade | Fades the song's global volume | $XX | Duration
$YY | Volume
$E2 | Tempo | Sets the tempo to the specified value | $XX | Tempo
$E3 | Tempo fade | Fades the tempo to the specified value | $XX | Duration
$YY | Value
$E4 | Global transpose | Transposes all instruments by the value | $XX | Transposition
$E5 | Tremolo | Enables tremolo for the current channel | $XX | Delay
$YY | Duration
$ZZ | Amplitude
$E6 | Subloop start | Sets the starting point for a subloop | $00 |
$E6 | Subloop end | Sets the ending point for a subloop | $XX | Loop count
$E7 | Volume | Sets the volume for the current channel | $XX | Volume
$E8 | Volume fade | Fades the volume for the current channel | $XX | Duration
$YY | Volume
$E9 | Loop | Normal loop. Do not use manually. | $XX | Loop point, low byte
$YY | Loop point, high byte
$ZZ | Loop count
$EA | Vibrato fade | Fades to the amplitude specified by $DE over the specified period of time. | $XX | Duration
$EB | Pitch envelope (release) | Bends all subsequent notes from the current note to the current note + the specified number of semitones (negative values--i.e. values above $80--are allowed). | $XX | Delay
$YY | Duration
$ZZ | Semitone difference
$EC | Pitch envelope (attack) | Bends all subsequent notes from the current note + the specified number of semitones to the current note (negative values--i.e. values above $80--are allowed). | $XX | Delay
$YY | Duration
$ZZ | Semitone difference
$ED | ADSR | Enables a custom ADSR on the current channel. $DA must not be be > $7F. See here for more information. | $DA | Delay (3 bits), attack (7 bits); 0dddaaaa
$SR | Sustain (3 bits), Release (5 bits); sssrrrrr
$ED | GAIN | Enables a custom GAIN on the current channel. | $80 |
$YY | GAIN
$EE | Tune channel | Sets the pitch modifier for this channel. | $XX | Tuning
$EF | Echo 1 | Sets some of the echo parameters for this song. | $XX | Which channels have echo, bitwise (76543210)
$YY | Echo volume, left
$ZZ | Echo volume, right
$F0 | Echo off | Turns off echo
$F1 | Echo 2 | Sets some of the echo parameters for this song. | $XX | Echo delay. May only be 00 - 0F
$YY | feedback/reverberation
$ZZ | FIR filter to use. See the echofilter tables in main.asm for more details, but for 99% of the userbase, $01 is "on" and $00 is "off".
$F2 | Echo fade | Fades the echo volume | $XX | Duration
$YY | Final echo volume for left speaker
$ZZ | Final echo volume for right speaker
$F3 | Sample load | Starts playing the specified sample. Note that the ("", $) command is highly preferred over this. | $XX | Sample to use
$YY | Multiplication pitch
$F4 | Yoshi drums | Enables yoshi drums on channel #5 | $00 |
$F4 | Legato | Toggle legato (notes will be played with no break between. This also means that samples will not be rekeyed, so new notes will not start the sample playing from the beginning). Note that when turning off legato, you must do so in the middle of the last note to use this effect, instead of in between notes. | $01 |
$F4 | Light staccato | Toggle light staccato (notes will be played with less of a delay between). | $02 |
$F4 | Echo toggle | Toggles the echo for this channel | $03 |
$F4 | SNES sync | Sends the current song's position to the output registers. | $05 |
$F4 | Yoshi drums | Enables yoshi drums on the current channel | $06 |
$F4 | Tempo hike off | Disables the tempo hike caused by the "time is running out!" sound effect. Use this on songs that should never be affected by this, such as the course clear music, game over music, etc. | $07 |
$F4 | Velocity table | Toggle which velocity table to use. By default, a song will use smw's velocity table, which is rather quiet. Use this once to use the standard n-spc velocity table, which is a bit louder. The alternative to this command is "#louder". | $08 |
$F5 | FIR filter | Sets the fir filter coefficients. | $X0 | Coefficient 1
$X1 | Coefficient 2
$X2 | Coefficient 3
$X3 | Coefficient 4
$X4 | Coefficient 5
$X5 | Coefficient 6
$X6 | Coefficient 7
$X7 | Coefficient 8
$F6 | DSP write | Write a value directly to the DSP | $XX | Register to write to
$YY | Value to write
$F8 | Enable noise | Enables noise for the current channel. Using an instrument that does not use noise will disable it. | $XX | "Pitch" of the noise.
$F9 | Data send | Sends two bytes of data to the SNES. See asm/SNES/patch.asm for more info. | $XX | The first byte to send.
$YY | The second byte to send.
$FA | Pitch modulation | Enables pitch modulation | $00 |
$XX | Which channels to enable pitch modulation on, bitwise (7654321-). Channel 0 cannot have pitch modulation.
$FA | GAIN | Enables GAIN on the current channel | $01 |
$XX | The GAIN value to use
$FA | Semitone tune | Tunes the current channel by the specified number of semitones | $02 |
$XX | Number of semitones to tune by
$FA | Amplify | Multiplies the volume of the current channel by this value + 1. 0 will not modify the volume, whereas FF will (just shy of) double it. Be warned of clipping, however, as smw's engine was not built to assume high volumes. In other words, don't use this to make your song louder; use it if a specific instrument or something is already playing at max volume and still isn't loud enough.
$03
$XX | Value to multiply the volume by
$FA | Echo buffer reserve | You do not need to use this command manually. In fact, you probably shouldn't. This is inserted at the beginning of every song by the program, and doesn't have much use otherwise. Its sole purpose is to reserve an echo buffer large enough for the song's longest echo delay. This is to prevent the normal echo command from having to do it itself, which is a time-consuming operation that would cause a pause in the middle of the song. Note that if hex command validation is turned off, this command will not be inserted.
$04
$XX | The largest echo buffer you plan to use
$FA | Rest/GAIN replace | Using this command will change how rests work; instead of cutting the currently playing note, it will keep playing the note but with the GAIN value that you have specified. The currently playing channel does not need to have GAIN enabled for this to work, though be advised that certain ADSR or GAIN values may not work as expected. In general, having no envelope (which is different from an instrument's default envelope) will work the best.
$05
$XX | The GAIN value to use. $00 turns the effect off.
$FB | Arpeggio | Specifies an arpeggio. Each note after this will play with a specified pattern. Note that this command and its subcommands are compatible with the $F4 $01 command, and in fact combining the two is recommended for certain circumstances. | $XX | Number of notes in the sequence (must be less than $80). If this is 0, then arpeggio is turned off.
$YY | The duration of each note
$... | The sequence of notes. Each byte is the change in pitch from the currently playing note. For example, $FF 00 would alternate between playing one semitone below the current note and the current note itself. A value of $80 at any point indicates a loop point; the sequence will restart there instead of the beginning if one is specified.
$FB | Trill | A specialized version of the arpeggio command. It implies that you want to alternate between only two notes. | $80 |
$YY | The duration of each note
$ZZ | The change of pitch between the currently playing note and the trilled note.
$FB | Glissando | If glissando is turned on, then the current note will be rekeyed at increasingly higher/lower pitches. Analogous to sliding your hand down a keyboard. Unlike the other two subcommands, this one's effect is turned off after one note. | $81 |
$YY | The duration of each note
$ZZ | The number of semitones to step up or down by for each new note
$FC | Anticipation GAIN | Turns on GAIN some time before a note ends. Similar to $FA $05 $XX, except this does not require a rest to activate, only another note. Be aware that if a note is shorter than the specified duration, then the GAIN change will not occur at all. $FC $00 $00 will disable the effect. | $XX | Time until GAIN
$YY | GAIN

## Parameter reference

### Note

For use with the $DD command. Note that for instrument @2, you must subtract 5 from the value in this table. For @9, add 5. For @15, subtract 8. If you need pitches higher or lower than this, use the multiplier/submultiplier instrument bytes.
Note that you may use a normal note (such as g, f+, o2c, >a-, etc.) instead for this parameter.

| c | c+ | d | d+ | e | f | f+ | g | g+ | a | a+ | b
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
o1 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 8A | 8B
o2 | 8C | 8D | 8E | 8F | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97
o3 | 98 | 99 | 9A | 9B | 9C | 9D | 9E | 9F | A0 | A1 | A2 | A3
o4 | A4 | A5 | A6 | A7 | A8 | A9 | AA | AB | AC | AD | AE | AF
o5 | B0 | B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | BA | BB
o6 | BC | BD | BE | BF | C0 | C1 | C2 | C3 | C4 | C5 |  |

### Length

For any parameter that requests a length of time (duration, delay, etc.), use this table as reference.

$C0 | Whole note
$80 | Whole triplet
$60 | Half note
$40 | Half triplet
$30 | Quarter note
$20 | Quarter triplet
$18 | Eighth note
$10 | Eighth triplet
$0C | 16th note
$09 | 16th triplet
$06 | 32nd note
$04 | 32nd triplet
$03 | 64th note
$02 | 64th triplet

Any value in between these may be used as well. For example, $48 is equal to a quarter note tied to an eighth note.

### ADSR

Click on a value in the table to modify the graph.

Value | Attack (seconds) | Decay (seconds) | Sustain (% of normal) | Release (seconds)
00 | 4.1 | 1.2 | 1/8 | Infinity
01 | 2.6 | 0.74 | 2/8 | 38
02 | 1.5 | 0.44 | 3/8 | 28
03 | 1.0 | 0.29 | 4/8 | 24
04 | 0.640 | 0.18 | 5/8 | 19
05 | 0.380 | 0.11 | 6/8 | 14
06 | 0.260 | 0.074 | 7/8 | 12
07 | 0.160 | 0.037 | 1 | 9.4
08 | 0.096 |  |  | 7.1
09 | 0.064 |  |  | 5.9
0A | 0.040 |  |  | 4.7
0B | 0.024 |  |  | 3.5
0C | 0.016 |  |  | 2.9
0D | 0.010 |  |  | 2.4
0E | 0.006 |  |  | 1.8
0F | 0 |  |  | 1.5
10 |  |  |  | 1.2
11 |  |  |  | 0.88
12 |  |  |  | 0.74
13 |  |  |  | 0.59
14 |  |  |  | 0.44
15 |  |  |  | 0.37
16 |  |  |  | 0.29
17 |  |  |  | 0.22
18 |  |  |  | 0.18
19 |  |  |  | 0.15
1A |  |  |  | 0.11
1B |  |  |  | 0.092
1C |  |  |  | 0.074
1D |  |  |  | 0.055
1E |  |  |  | 0.037
1F |  |  |  | 0.018

Time (seconds)

Zoom in | Zoom out

Return to the main page