Recent from talks
Nothing was collected or created yet.
MOD (file format)
View on WikipediaThis article may lack focus or be about more than one topic. (September 2017) |
| MOD | |
|---|---|
| Filename extension |
.mod |
| Internet media type |
audio/mod, audio/x-mod |
| Magic number | 4 bytes "M.K." at offset 0x438 |
| Developed by | Karsten "Obi" Obarski |
| Initial release | 1987 |
| Type of format | Video/music |
| Extended to | XM |
MOD is a computer file format used primarily to represent music, and was the first module file format. It contains a set of instruments in the form of samples, a number of patterns indicating how and when the samples are to be played, and a list of what patterns to play in what order. MOD files use the “.MOD” file extension, except on the Amiga which doesn't rely on filename extensions and instead reads the file's header to determine its format.
History
[edit]The first version of the format was created by Karsten Obarski for use in the Ultimate Soundtracker, a music tracker software released for the Amiga computer in 1987.[1][2] The format has since been supported by hundreds of playback programs and dozens of other trackers.[3]
The original version of the MOD format featured four channels of simultaneous audio playback, corresponding to the capabilities of the original Amiga chipset, and up to 15 instruments.
Later variations of the format have extended this to up to 32 channels and 31 instruments.
The format was designed to be directly playable on the Amiga without additional processing: for example, samples are stored in 8-bit PCM format ready to be played on the Amiga DACs, and pattern data is not packed. Playback required very little CPU time on an Amiga, and many games used MOD files for their background music.
A common misconception is that the magic number "M.K." in the 0x438 offset of MOD files are the initials of Mahoney and Kaktus, two prominent Amiga demomakers at the time, who played an important part in the popularity of the format. They in fact stand for the initials of Michael Kleps a.k.a. Unknown / DOC, another developer of the format.[4]
| Demoscene |
|---|
| Concepts |
| Alternative demo platforms |
| Current parties |
| Websites |
| Magazines |
| Software |
After the Amiga's production ceased, the MOD format has had continued popularity in the Demoscene and as background music for independent video games and Chiptunes. It is not uncommon to hear MOD music in keygens either.
Format overview
[edit]A pattern is typically represented in a sequencer user interface as a table with one column per channel, thus having four columns – one for each Amiga hardware channel. Each column has 64 rows.
A cell in the table can cause one of several actions to happen on its column's channel when its row's time is reached:
- Start an instrument playing a new note in this channel at a given volume, possibly with a special effect applied on it
- Change the volume or special effect being applied to the current note
- Change pattern flow; jump to a specific song or pattern position or loop inside a pattern
- Do nothing; any existing note playing in this channel will continue to play
An instrument is a single sample along with an optional indication of which portion of the sample can be repeated to hold a sustained note.
Timing
[edit]In the original MOD file the minimum time frame was 0.02 seconds, or a "vertical blanking" (VSync) interval, because the original software used the VSync timing of the monitor running at 50 Hz (for PAL) or 60 Hz (for NTSC) for timing.
The rate at which pattern data is played is defined by a speed setting. Each row in the pattern data lasts one vertical blanking (or 0.02 seconds) times the current speed setting. The speed setting varied from 1 to 255. In later versions of the format, the vertical blanking was replaced with an adjustable time period staying in the range [0.01, 0.078] seconds. The old speed setting command was replaced with a new one that was used to change both the old speed setting and the new adjustable time period. Unfortunately, some of the old functionality was broken, because the new speed setting command had an identical code value to the old command. Values in the range [1, 31] were interpreted as the old speed settings, but other values were regarded as modifications to the adjustable time period. Hence, values in the range [32, 255] used in some old songs broke in new versions of the player.
Further information on the MOD format can be found at the alt.binaries.sounds.mods FAQ.[5]
Other formats that use the MOD extension
[edit]MOD is the file extension for several other applications:
- The video file format used on many digital camcorders, such as the JVC Everio, the Canon FS100 and the Panasonic D-Snap SD-card camcorders.[6]
- Game modules in Neverwinter Nights.
- AMPL model files.
- Old phpBB modification templates.
- Module files in Femap
- The extension for the binary variant of the Wavefront .obj format.
- The extension for some games using the Vassal game engine.
- The extension for Fortran module files.[7]
- The extension for legacy Visual Basic module files, for versions before the release of Visual Basic .NET.
- The extension for Go module files, used for package versioning.
- Module for ABB Robotics IRC5 and S4 robot controllers. Contains robotic motion programs written in the language RAPID.
- Lanner WITNESS simulation software model files
- Paradox Development Studio uses a ".MOD" format for user-created modifications of their games.
- DND adventure modules for Fantasy Grounds, a virtual tabletop application.
- GNU GRUB boot modules (when found in /boot)
- Modified ECU Map files when exported from ECM Titanium (ECU Map editing software)
See also
[edit]References
[edit]- ^ Driscoll, Kevin & Diaz, Joshua (2009). "Endless loop: A brief history of chiptunes". Transformative Works and Cultures (2). doi:10.3983/twc.2009.0096. Retrieved 2011-02-13.
Most importantly, Soundtracker provided an environment in which nonprogrammers could access the sophisticated music tools in their home computers without needing to learn a programming language.
- ^ www.soundtracker.org same named later clone of Obarski's soundtracker
- ^ Sweet, Michael (2014). Writing Interactive Music for Video Games. Addison-Wesley. pp. 272–273. ISBN 978-0-321-96158-7.
- ^ "Ultimate Soundtracker module format description". Archived from the original on 2010-09-21. Retrieved 2014-07-02., by Michael Schwendt, 1997; distributed in the source of the xmp module player; published at io.debian.net
- ^ "The alt.binaries.sounds.mods FAQ on the MOD format". Retrieved 2020-04-15.
- ^ "MOD and TOD", Wikipedia, 2024-09-22, retrieved 2025-08-05
- ^ "Fortran Programs with Modules".
External links
[edit]MOD (file format)
View on GrokipediaHistory and Development
Origins and Creation
The MOD file format originated in 1987 with the development of the Ultimate Soundtracker software by German programmer Karsten Obarski for the Commodore Amiga platform. Designed as a pioneering tool for music composition within the constraints of early home computer hardware, Ultimate Soundtracker introduced the concept of module files to enable efficient storage and playback of digital music. This format marked the birth of tracker-based music production, allowing users to sequence short audio samples into complex compositions without requiring extensive waveform data or real-time synthesis.[4][5] The original specifications were tailored to the Amiga's Paula sound chip, limiting modules to four audio channels for simultaneous playback and supporting up to 15 instruments, each consisting of 8-bit pulse-code modulation (PCM) samples directly compatible with the system's digital-to-analog converters (DACs). These constraints ensured low CPU overhead, making it feasible to integrate music into resource-intensive applications like games and demos. Sample lengths were capped to fit within available memory, typically ranging from a few kilobytes per instrument, promoting creative reuse of sounds rather than full recordings.[4][5] The primary purpose of the MOD format was to empower demoscene artists, game developers, and hobbyist musicians to craft intricate, multi-layered tracks using a grid-based pattern editor, where notes, volumes, and effects could be arranged modularly. By separating sample data from sequencing instructions, it facilitated compact file sizes—often under 100 KB—ideal for floppy disk distribution in the late 1980s era. This approach revolutionized Amiga music production, shifting from hardcoded chiptunes to sample-driven compositions that mimicked professional studio techniques on consumer hardware.[6][5] A key identifier in the format is the magic number "M.K.", located at byte offset 0x438 (decimal 1080), which serves to distinguish standard 31-instrument MOD files from earlier 15-instrument variants lacking this marker; its inclusion helped early players and loaders verify file integrity and sample count during parsing. While the original Ultimate Soundtracker modules did not include this signature, it became integral to the format's evolution, ensuring compatibility across subsequent tools.[4][5]Evolution Across Trackers
Following the introduction of the MOD format by Ultimate Soundtracker in 1987, which established the original 4-channel limitation, subsequent Amiga trackers began refining the format starting in 1989. NoiseTracker, released in August 1989 by Pex Tufvesson (Mahoney) and Anders Berkeman (Kaktus) of North Star, marked the first major evolution by addressing bugs in the original software and expanding the instrument limit from 15 to 31 samples.[7][5] It also enhanced pattern editing capabilities, allowing for more intuitive composition through improved user interface elements like better cursor navigation and undo functions, while preserving backward compatibility with existing 15-instrument files by lacking a dedicated format signature.[7] ProTracker, released in 1990 by the Amiga Freelancers group (original developers Lars Hamre, Anders Hamre, Sven Vahsen, and Rune Johnsrud), further advanced the format by standardizing the 31-instrument capacity and introducing finer volume control ranging from 0 to 64, enabling more nuanced sample mixing.[5][8] It expanded the effects repertoire, including commands for tempo adjustment (Fxx) and pattern delays, which allowed composers greater expressive flexibility beyond the hardware-tied constraints of earlier versions.[5] This led to ProTracker's widespread adoption as the preferred tool in the Amiga community, with its "M.K." file signature helping players identify 31-instrument modules.[8] Within the demoscene, these developments prompted informal standardization efforts, as groups favored ProTracker's features for their reliability and compatibility with demo productions.[5] However, compatibility challenges persisted between 15-instrument (often signature-less) and 31-instrument files, requiring players to scan for the signature or default to the older format to avoid misinterpreting sample data lengths and causing playback errors.[5] These refinements solidified the MOD format's role in the late 1980s Amiga era, profoundly influencing chiptune music in demoscene productions such as Fairlight's early intros, where sampled instruments combined with Paula chip synthesis created dense, replayable soundtracks.[6]Core Format Specifications
Header and Metadata
The header of a MOD file serves as the initial fixed-size structure containing essential metadata for the song title, sample descriptions, and playback sequencing, preceding the actual sample data and pattern information. This header varies in size between variants: 600 bytes for the 15-instrument format (common in early trackers like Ultimate Soundtracker) and 1084 bytes for the 31-instrument format (standard in ProTracker and later tools).[4] The structure ensures compatibility across Amiga-based music trackers by providing pointers and parameters for up to 31 discrete samples, which are raw 8-bit audio waveforms.[9] The header opens with a 20-byte field for the song title, encoded in ASCII and padded with null bytes (0x00) to fill the space; titles are typically uppercase in original files and can include module author credits or descriptions.[4] Immediately following are the sample descriptions, with 15 entries in the shorter variant or 31 in the longer one, each occupying exactly 30 bytes. Each description begins with a 22-byte ASCII sample name (padded with nulls), followed by a 2-byte big-endian value for the sample length in words (where 1 word equals 2 bytes, allowing up to 65535 words or 131070 bytes theoretically, though Amiga hardware limits practical sizes to around 32 KB per sample).[9] The next byte encodes finetune as a 4-bit value in the low nibble (0x00 to 0x0F, mapping to pitch shifts of 0, +1/8, +2/8, +3/8, +4/8, +5/8, +6/8, +7/8, -8/8, -7/8, -6/8, -5/8, -4/8, -3/8, -2/8, -1/8 semitones), while the subsequent byte specifies default volume as an unsigned value from 0 to 64 (where 64 represents full amplitude).[4] The description concludes with two 2-byte big-endian fields: repeat start position (offset in words from the sample beginning) and repeat length (duration in words, with a value of 1 indicating no loop).[9] These fields enable basic looping and envelope control without embedded waveform data. After the sample descriptions, the header includes a 1-byte song length field (values 1 to 128), indicating the number of positions in the playback order before looping.[4] This is followed by a 1-byte restart position, historically set to 0x7F (127) in ProTracker modules to disable restarting or 0x78 in earlier formats, though it is largely obsolete and ignored by modern players in favor of pattern jump effects.[9] The core sequencing data appears next as a 128-byte pattern order list (also called the song structure or position list), where each byte holds an 8-bit unsigned index (0 to 127) referencing a pattern to play in sequence; values of 0x7F or higher typically signal the end of the song.[4] In 31-instrument files, the header terminates with a 4-byte ASCII signature (e.g., "M.K." for ProTracker or "M!K!" for variants with extended pattern numbers), which identifies the format and ensures loader compatibility; 15-instrument files omit this field.[9] MOD files employ the .mod file extension and are assigned the Internet media type audio/mod for web transmission and identification. This metadata setup allows efficient parsing by trackers and players, with the order list directly informing the sequence of patterns that follow the header and sample blocks in the file.[4]Sample and Instrument Storage
In the MOD file format, audio samples, which serve as the instruments, are stored as raw 8-bit signed pulse-code modulation (PCM) data in big-endian byte order, immediately following the pattern data section. Each sample's data block is a contiguous sequence of bytes representing the waveform, with lengths specified in the earlier sample descriptors (not covered here). The total sample data for all instruments is limited to even byte counts, typically up to 128 KB per sample, though practical constraints from Amiga hardware often kept individual samples between 10 KB and 60 KB. Samples are stored sequentially without any interleaving or additional metadata between them, enabling direct memory loading for playback.[9][10][2] The looping mechanism in MOD files supports three basic modes determined by the loop start and length values from the sample descriptors: non-looped playback (where the sample plays once to completion), forward looping (repeating a defined segment from the loop start to the loop end indefinitely), or no loop if the length is 1. Loop points are defined in words (16-bit units), ranging from 0 to 0xFFFF, which translate to byte offsets by multiplying by 2, ensuring even alignment. Forward loops begin at the specified start point and repeat the designated length segment, with the first two bytes of each sample often zeroed by players like ProTracker to facilitate clean repetition or termination. The format does not natively support ping-pong looping (bidirectional playback), though some modern players may emulate it for compatibility; standard MOD playback relies solely on forward repetition for seamless sustains in instruments like pads or basslines.[9][11][5] Instrument limits vary by MOD variant: the original Soundtracker format supports up to 15 samples (indexed 1-15), while extended versions like ProTracker accommodate 31 samples (indexed 1-31). These samples function as monophonic instruments without multi-sample layering, modulation envelopes, or velocity sensitivity, reflecting the format's simplicity for Amiga's four-channel audio hardware. During playback, patterns reference these samples by index to trigger them on channels.[9][10][2] MOD files store samples without any compression, preserving raw PCM data for immediate access by the Amiga's Paula sound chip, which required unpacked waveforms for real-time mixing. This uncompressed approach ensured low-latency playback but limited file sizes and sample quality to the era's hardware constraints, such as 8-bit resolution and no delta encoding.[9][11][10]Pattern Encoding and Orders
In the MOD file format, musical patterns represent the sequential arrangement of notes, samples, and effects across multiple channels, forming the core of the composition's structure. Each pattern is allocated 1024 bytes, comprising 64 rows and 4 channels, with 16 bytes per row (4 bytes per channel). These patterns are stored sequentially in the file immediately following the header, allowing for a maximum of 128 patterns, though most modules utilize far fewer—typically 32 or less—to conserve space. Empty patterns, which contain no note or effect data, are sometimes employed to facilitate pattern jumps or breaks during playback, enabling composers to skip sections without redundant storage.[9] The encoding of data within each channel of a pattern uses a compact 4-byte structure per row position, optimized for the Amiga's hardware constraints. The first byte combines the high nibble of the period value (representing note frequency, bits 11-8) with the high nibble of the sample number (sample >> 4). The second byte holds the low 8 bits of the period value (bits 7-0). The third byte merges the high nibble of the effect command with the low nibble of the sample number (sample & 0x0F). Finally, the fourth byte provides the 8-bit parameter for the effect. This packed format allows for efficient parsing during playback, where a period value of zero indicates no new note, and a sample number of zero signifies no change from the previous sample assignment.[4][5] The order list, also known as the pattern table, sequences the patterns to define the overall song structure and is located at file offset 952, spanning 128 bytes. Each byte in this list references a pattern number from 0 to 127, dictating the order in which patterns are played during module playback; the effective song length is specified by a preceding byte (1-128), but the full list allows for loops or extensions. The total number of patterns in a module is determined by the highest index value in the order list plus one, ensuring only necessary patterns are loaded. In standard 4-channel ProTracker modules identified by the "M.K." tag, indices are typically limited to 0-63, though later variants support higher values.[9][5]| Byte | Bits Breakdown | Description |
|---|---|---|
| 0 | 7-4: Period (11-8) 3-0: Sample high nibble (sample >> 4) | High period and high sample nibbles |
| 1 | 7-0: Period (7-0) | Low period byte |
| 2 | 7-4: Effect command 3-0: Sample low nibble (sample & 0x0F) | Effect type and low sample nibble |
| 3 | 7-0: Effect parameter | Effect data value |
