In a pattern, a command is stored as a
number from 1 to 26: 1 is A, 2 is B and so on, with one info byte. The behaviour below is
that of Scream Tracker 3.21: ST3.DOC for what each command is for, the MultimediaWiki notes on its play routine, and the
program itself, St3.exe from st321.zip, whose dispatch tables and handlers were read from a disassembly
(file offsets are given where a statement rests on it). Where libopenmpt plays a command differently the text says so. Commands
marked ‘later’ were not in Scream Tracker; other programs added them. In the Memory
column, % means the effect reuses the channel’s latest non-zero parameter, and * means
the effect keeps a memory of its own.
Effect commands
| Letter | Number | Parameter | Memory | Effect |
|---|---|---|---|---|
| A | 1 | xx | Set speed. 0 is ignored. | |
| B | 2 | xx | Jump to order xx. | |
| C | 3 | xy | Break to row x × 10 + y of the next pattern. Rows of 64 and above are ignored. | |
| D | 4 | xy | % | Volume slide; forms below. |
| E | 5 | xx | % | Portamento down: EFx fine, EEx extra fine. |
| F | 6 | xx | % | Portamento up: FFx fine, FEx extra fine. |
| G | 7 | xx | * | Portamento to note. With no note on the row, the target is the last note played in the channel. |
| H | 8 | xy | * | Vibrato: parameters are multiplied by 4. Shares memory with U. |
| I | 9 | xy | % | Tremor: on x + 1 ticks, off y + 1 ticks. |
| J | 10 | xy | % | Arpeggio: tick 0 of each three ticks plays the note, the next x half notes up, the next y half notes up. J00 uses the memory shared by all effects marked % (see Memory). |
| K | 11 | xy | % | Vibrato and volume slide (H00 + Dxy), but the first tick is skipped, so fine slides do nothing. |
| L | 12 | xy | % | Portamento and volume slide (G00 + Dxy); the same first-tick rule. |
| M | 13 | xx | Set channel volume (later). | |
| N | 14 | xy | Channel volume slide (later). | |
| O | 15 | xx | * | Sample offset. |
| P | 16 | xy | Panning slide with fine forms (later). | |
| Q | 17 | xy | % | Retrigger every y ticks, with volume change x (table below). y = 0 is ignored. |
| R | 18 | xy | % | Tremolo: speed 4x, depth 4y. |
| S | 19 | xy | % | Special commands. |
| T | 20 | xx | Set tempo. Values below 33 are ignored. OpenMPT adds T0x and T1x for tempo slides. | |
| U | 21 | xy | * | Fine vibrato. Shares memory with H. |
| V | 22 | xx | Set global volume, 00 to 40; values above 40 are ignored. | |
| W | 23 | xy | Global volume slide (later). | |
| X | 24 | xx | Set panning, 00 to 80; XA4 enables surround (later). | |
| Y | 25 | xy | Panbrello (later). | |
| Z | 26 | xx | MIDI macro (later). |
Volume slide forms
| Form | Effect |
|---|---|
| D0y | Slide down y on non-zero ticks (and tick 0 if fast slides are on). |
| Dx0 | Slide up x, in the same way. |
| DFy | Fine slide down, on tick 0. |
| DxF | Fine slide up, on tick 0. |
| DFF | Slide up 15 on tick 0. |
| D0F | Slide down 15 every tick. |
| DF0 | Slide up 15 every tick. |
| Dxy, both non-zero | Scream Tracker slides down by y; Impulse Tracker ignores it. |
| D00 | Reuses the last non-zero parameter in the channel. |
Slides change the active volume, not the stored volume.
Retrigger volume changes
| x | Change | x | Change |
|---|---|---|---|
| 0 | None | 8 | No change (documentation uncertain) |
| 1 | −1 | 9 | +1 |
| 2 | −2 | A | +2 |
| 3 | −4 | B | +4 |
| 4 | −8 | C | +8 |
| 5 | −16 | D | +16 |
| 6 | × 10/16 (volume × 10, divided by 16, rounded down) | E | × 24/16 |
| 7 | × 1/2 | F | × 2 |
S sub-commands
| Command | Effect |
|---|---|
| S0x | Filter; not implemented in Scream Tracker. S00 reuses the last non-zero S parameter. |
| S1x | Glissando control: S10 off, S11 on. |
| S2x | Set finetune: the channel’s C-4 speed becomes one of sixteen values (8363 for 0, 7895 for 8, 8280 for F; St3.exe data offset 0xa0c). The note that is playing keeps its period, so it does not change pitch; the next note uses the new speed. (libopenmpt retunes the playing note at once.) |
| S3x | Vibrato waveform: bits 0 and 1 give 0 sine, 1 ramp down, 2 square, 3 random. Bit 2 set means do not reset on a new note. |
| S4x | Tremolo waveform, the same values. |
| S5x | Panbrello waveform (later). |
| S6x | Fine pattern delay: adds x ticks (later). |
| S8x | Set panning, 0 to F. Gravis Ultrasound only in Scream Tracker. |
| S9x | Sound control (later). |
| SAx | Old stereo control. On the Sound Blaster, by channel: SA0 and SA2 normal, SA1 and SA3 reversed, SA4 to SA7 centre with a DC offset, SA8 to SAF no effect. Modern players treat it as S8x. OpenMPT reuses SAx as a high offset. |
| SB0, SBx | Pattern loop: SB0 sets the start, SBx loops back x times. The memory is global, not per channel. |
| SCx | Note cut after x ticks. 0 is ignored. Playback freezes rather than going silent, and resumes with E, F, G, H, J, K, L or U. |
| SDx | Delay the note x ticks. With S0x, the note triggers on tick 0 and again at x. SD0 never plays the note: the first-tick handler skips a cell whose command is SDx and the later-tick handler waits for a counter that is already 0 (St3.exe, 0x2d8bc and 0x2d416); libopenmpt plays it at once. |
| SEx | Pattern delay: repeat the row x times. |
| SFx | FunkRepeat; not implemented in Scream Tracker. |
Memory
Before it runs a command on the first tick, St3.exe (the dispatcher at file offset 0x2cd41) copies the info
byte to a channel byte of its own if the info is not 0, whatever the command is, so the memory marked % is the last
non-zero info byte of any command on the channel, not of the same command. D, E, F, I, J, K (for its volume
slide), L (for its volume slide), Q, R (when both its nibbles are 0, or its speed is 0) and S use it when their info is 0.
This answers the open question for J: Jxy keeps no memory of its own, and J00 repeats whatever the last non-zero
parameter on the channel was, even an A or a T. G has its own memory, H and U share one, and O has its own (it was
added in version 3.20, WHATSNEW.321). The arpeggio takes the tick number counted from the start of the row,
modulo 3 (the counter at 0x1fb0): tick 0, 3, 6 … play the note, 1, 4, 7 … add x half notes, 2, 5, 8 … add y; the note is
the last note on the channel, even after a slide or a note with tone portamento.
Playback notes
- Vibrato, fine vibrato and tremolo read waveforms from
St3.exe’s own tables of 64 values, whichprint-st3-waves.mjsprints from the program: the sine rises to 255 and back to −255; “ramp down” is 0 at the start, then −248 climbing by 8 to −8, 0 at entry 32, then 8 climbing to 248; “square” is 255 for the first 32 entries and 0 for the next 32 (it only goes one way); “random” reads the sine table but moves the position by a random amount each tick. The position advances by the speed x on every tick that runs the effect. Hxy changes the period by wave × y ÷ 32, Uxy by wave × y ÷ 128 (four times finer) and Rxy the volume by wave × y ÷ 128, all rounded down. The position starts again at 0 on a new note and on the first row of a run of vibrato rows after a row with another command, unless bit 2 of S3x or S4x is set. - Hxy and Uxy store the whole parameter in one memory. A parameter of 00 uses it all; when only x is 0 (H0y) the speed
comes from the memory; when only y is 0 (Hx0) there is no such merging, the depth really is 0 and the vibrato stops
(
St3.exe, 0x2d100 and 0x2d162), unlike players that keep the old depth. - Ixy starts a row of tremor with the off phase: the first tick turns the volume to 0 for y + 1 ticks, then on for x + 1 (libopenmpt starts with the on phase). A row with any command but I puts the tremor back to that start.
- A note without a sample retriggers the note and keeps the volume.
- A sample without a note resets the volume and changes sample without retriggering. If the C2 speeds differ, the pitch can be off.
- The active volume is at most 63: setting 64 gives 63. AdLib channels allow 64 as a default, and later changes clip to 0 to 63.
- Vibrato and tremolo use a 256-step cycle. V is processed on tick 1, so at speed 1 it does nothing.
Differences from libopenmpt
Where the program and libopenmpt part, this page and the explorer follow St3.exe (3.21), read from its
code. Offsets are file offsets in St3.exe; a test module is one of the OpenMPT S3M test modules, which
carry recordings of the original program on some channels.
- SD0 never plays the note; libopenmpt plays it.
- S2x does not change the pitch of the note that is playing; libopenmpt retunes it.
- SCx freezes the note instead of stopping it, and E, F, G, H, J, K, L and U wake it; libopenmpt stops it for good. Q does not retrigger a note that SCx or ^^ has cut.
- Q with y = 0 does nothing; libopenmpt retriggers on every tick. Q multiplies the volume by 10/16 for 6 and by 24/16 for E.
- K and L with a fine slide (Kxy with x or y = F): the vibrato or the tone portamento does not run on the later ticks, and the combined slides do not run on the first tick at all (test modules NoCombinedSlidesOnFirstTick-Fast and -Normal).
- T with a parameter of 0x20 or less is ignored (0x2ce0d). V is applied on tick 1, libopenmpt’s on tick 0.
- The tick is 2.5 ÷ tempo seconds; the timer runs at whole hertz (tempo × 0.4 rounded down) and never below 19 Hz, so every tempo below 50 ticks at 19 Hz.
- The period that reaches the mixer is limited on every card to 64 at the low end (0x7fff at the high end), and a period of 0 stops the voice, while the stored period keeps sliding (0x2ea5c to 0x2eab9, limits at data offsets 0x960 and 0x962). Test module PeriodLimit: its two channels play the same, in which one reaches the limit by notes and the other by slides, and test module PeriodLimitUpper, whose recording of Scream Tracker 3 follows the same pitches within a few cents, up to the portamento slide that ends at the 32767 limit. With the Amiga flag the stored period is limited as well (0x1c5 to 0xd60).
- The zero-volume flag (bit 3 of the flags) silences a note with volume 0; libopenmpt ignores it. Glissando rounds as the code at 0x2e9ae does, not to the nearest semitone.
- Hx0 sets the depth to 0 (see above). Test module ParamMemory expects H80 to sound like H88; the code at 0x2d100 stores H80 whole, so the two channels of that module part from pattern 1 row 9 on. The shared memory of R, D, K and L, which the module tests in the rows before it, plays as the module expects. Whether version 3.21 differs from the version that made the module’s expectation cannot be settled without running the program.
- An offset at or past the end of the sample (the loop end of a looping sample) stops the note on a Sound Blaster, while the Gravis Ultrasound wraps to the loop start (test modules OffsetPastSampleEnd and OffsetLoopWraparound; the explorer wraps when its card behaviour is Gravis Ultrasound; test module OffsetLoopWraparound, whose recording is of the Gravis driver, follows that rule window by window in loudness).
- The two drivers differ in two more cases. With the Sound Blaster driver a sample number given without a note swaps
the sample at once and carries on at the old position (the voice stops if the new sample is shorter than that
position). With the Gravis driver a tone portamento row that names another instrument while a sample plays keeps
the card voice playing the old sample and sets the volume; the new sample’s rate (c2spd) still sets the portamento
target, and the new sample, loop and end take over at the next restart of the voice (a Q retrigger or a new note).
The explorer’s “Card behaviour” option chooses the driver; “automatic” takes the card the file was
last saved with (see the sample header’s Gravis address on the instruments page). Traced in
St3.exe: the player routine at 0x2d980 to 0x2dae5 does the same for both cards (it copies the instrument’s c2spd, volume, end, loop and sample address into the channel record, and for commands G and L leaves the current period, position and restart flag alone, setting only the target period). The Sound Blaster mixer reads the record at every tick, so the new sample is heard at once; the Gravis driver programs the card’s addresses only when it starts a voice (0x30484 to 0x30776), so the card goes on with the old sample. (The code at 0x2d9e3 to 0x2d9f3 compares the command with G and L but both branches lead to the same instruction, so it has no effect.) libopenmpt agrees on the sample but also keeps the old c2spd for the Gravis target. - Test modules PortaAfterArp, RetrigSlide (including its AdLib part), PatternDelays, PatternDelaysRetrig, weirdloop
(first 1.4 seconds) and PeriodLimitUpper carry recordings of Scream Tracker 3; the explorer’s playback matches them
in pitch and loudness as stated above. The ParamMemory difference is the only one a recording did not settle.
Other implementations disagree with the program there: libopenmpt, libxmp and Schism keep the vibrato depth on H80,
St3.exe3.21 stores the byte whole and gives depth 0. - An AdLib note next to a tone portamento (G or L) does not run the slide, and the target is heard on the first tick of the next row if that row has no note (3.03 and later; 3.00 and 3.01 slide normally).
- Pattern delays (SEx): when several channels have one, the first in the order of the output channels (left 1 to 8, then right 1 to 8) counts, and an SE0 repeats the last non-zero parameter of the channel. Confirmed by the recording in test module PatternDelays for its first second, and by PatternDelaysRetrig for all of it.