Development: Formats/S3M

From OpenMPT Wiki
Jump to navigation Jump to search

General information concerning the S3M file format. Variable names and hexadecimal numbers (in little-endian formats) are indicated by a monospace font.

Tracker IDs[edit]

The S3M header contains a field, Cwt/v, which is used to identify the application that was used to create the file. The following custom tracker IDs (read as little-endian hexadecimal numbers) are known to be found in the Cwt/v field:

  • 0208 - Found in some tracks by Yerzmyey, appears to be from a tracker called Akord (Polish localized version of a tracker called Squeak Tracker)
  • 1xyy - Scream Tracker x.yy - Many other trackers, like ModPlug Tracker, disguise as Scream Tracker 3.20, so this is not a reliable way to tell if a file was really made with Scream Tracker, see below.
  • 2xyy - Imago Orpheus x.yy
  • 2013 - PlayerPRO on little-endian platforms
  • 3xyy - Impulse Tracker x.yy. Impulse Tracker v1.03 (and possibly v1.02) writes 3320. For even older Impulse Tracker versions, see below.
  • 4xyy - Schism Tracker x.yy up to Schism Tracker v0.50, later versions encode a timestamp in the version number - see Schism Tracker’s version.c or OpenMPT’s Load_it.cpp.
  • 5xyy - OpenMPT x.yy - lower two bytes of version number are stored in the two reserved bytes at offset 54 starting from OpenMPT 1.29.10.00.
  • 5xyy - Liquid Tracker x.yy - OpenMPT unfortunately shares this tracker ID with Liquid Tracker. Only one S3M file made with Liquid Tracker has been found in the wild. The two programs can be told apart, though: Either by the fact that the full OpenMPT version info is present, or for older OpenMPT versions by checking the ultraclick value (Liquid Tracker writes an ultraclick value of 16, while OpenMPT versions before the addition of the full version information wrote an ultraclick value of 8. Shortly after the full version information was added, the ultraclick value was changed to 16).
  • 57yy - NESMusa 7.yy
  • 5447 - Graoumf Tracker (appears as "GT" magic bytes on disk)
  • 6xyy - BeRoTracker x.yy
  • 7xyy - CreamTracker x.yy
  • CA00 - Camoto / libgamemusic

Note: BeRoTracker used the ID 4100 since 2004, but has switched to using the 6xyy scheme in 2012. Luckily, this version is not used by Schism Tracker, so it is still possible to tell the two trackers apart.

Are you a tracker developer and you tracker can save S3M files? Please add your Tracker ID to this list!

Detecting trackers disguising as Scream Tracker[edit]

Some trackers disguise as Scream Tracker 3, but there are ways to uncover this disguise:

ModPlug Tracker[edit]

ModPlug Tracker and OpenMPT up to version 1.17.03.01 identifies as Scream Tracker 3.20 in the Cwt/v field, but it puts zeroes for the special field, only ever sets flags 10 (Amiga Limits) and 40 (Fast Volume Slides), writes multiples of 16 orders, always saves channel pannings, and writes zero into the ultraclick removal field (Scream Tracker 3 always puts either 16, 24, or 32 there).

ModPlug Tracker versions up to 1.0 alpha 5 can be identified by not setting the stereo bit on the master volume. Versions 1.0 alpha 6 up to 1.16.203 can be told apart from later versions if less than 32 channels are used: In the extended panning table, all channels have bit 5 (use panning) set, even those past the last used channel. Later versions write 08 (center panning, do not use) for such channels instead.

Early Impulse Tracker versions[edit]

Impulse Tracker v1.01 (and potentially v1.00 and v1.02) identifies as Scream Tracker 3.20, puts zeros for the special and ultraclick fields, and sets flag 8 (zero-volume optimizations). It does not use the channel panning table, which sets it apart from real Scream Tracker 3.20.

Velvet Studio / PlayePRO[edit]

Velvet Studio and PlayerPRO also pretend to be Scream Tracker 3.20, but write zeroes for special, ultraclick, and flags, and do not save channel pannings. Velvet Studio also writes a fairly recognizable LRRL pattern for the channels.

To tell the two trackers apart: PlayerPRO always writes a global volume of 64 and a mix volume of 48 (mono). On the other hand, Velvet Studio always writes the stereo flag.

PlayerPRO also writes an extra 16 bytes of padding between sample headers.

Sound Club 2[edit]

Sound Club two writes "SCLUB2.0" into the 8 consecutive reserved bytes in the file header.

UNMO3[edit]

Nowadays, the MO3 format has support for storing the original value of the Cwt/v field, so recent UNMO3 versions make use of this. When this information is not available, or if an older UNMO3 version is used, it can be identified as follows: It pretends to be Scream Tacker 3.01, special and ultraclick are 0, channel pannings are always saved (a feature not supported by Scream Tracker 3.01). The only flags it should ever write are Fast Slides and Amiga Limits. Mix volume should always indicate stereo mixing.

deMODifier[edit]

deMODifier is a converter for SoundSmith files to S3M format. It disguises as Scream Tracker 3.01, flags, special and ultraclick are 0, global volume is always 48, mix volume is 176 (48 + stereo), tempo is always 150 and no panning table is present. Sample filenames of non-empty sample slots always end in .IFF.

Note: This detection should only take place after it can be ruled out that the file was saved with Scream Tracker (see #Output driver detection).

To-S3M[edit]

To-S3M is a converter for MTM modules to S3M format. It disguises as Scream Tracker 3.01, flags, special and ultraclick are 0, global volume is always 64, mix volume is 176 (48 + stereo), speed is always 6, tempo is always 125 and no panning table is present. Files with and without the stereo flag have been spotted, but ignoring that, the mix volume is always 48.

Note: This detection should only take place after it can be ruled out that the file was saved with Scream Tracker (see #Output driver detection).

Detecting other trackers[edit]

Scream Tracker 3.10 / 3.20 / 3.21 normally only writes 16, 24 or 32 in the ultraclick removal field (earlier versions write 0 there), so this could be a way to check if a file was not saved with Scream Tracker 3. However, Scream Tracker does not sanitize this field when re-saving a file made with another tracker, so even if the file was saved with Scream Tracker, a different value might still be carried over from another tracker. See the following section for more reliable fingerprinting.

Output driver detection[edit]

Scream Tracker’s Gravis Ultrasound and Sound Blaster drivers differ in their interpretation of various pattern effects, which affects playback of some modules noticeably. Luckily, there is a way to tell which driver was loaded when the S3M file was last saved in Scream Tracker, which can serve as a detection heuristic: If the file was saved with the Gravis Ultrasound driver loaded, every non-empty sample header will have a unique Int:Gp value. If the file was saved with the Sound Blaster driver loaded, every non-empty sample header will have 1 in this field. Note that the first GUS sample also uses address 1, so if there is only one non-empty sample slot, GUS and SB cannot be told apart.

Note that some S3Ms saved with Scream Tracker 3.00 (cwtv = 1300) have a Int:Gp value of 0 for all samples. There is probably a very early version of Scream Tracker 3.00 (probably from 1992) which does not support the Gravis Ultrasound. For higher cwtv values, the fact that all Int:Gp values are 0 can be used for detecting other trackers or tools disguising as Scream Tracker (e.g. automatic PSM to S3M conversions).

Impulse Tracker Edit Timer[edit]

Impulse Tracker hides its edit timer in the file header; there is a section of 8 reserved bytes, of which the first and last two are zero, and the four bytes in the middle contain the edit timer in the same format as in the IT format.