Expand description
Amiga ProTracker / SoundTracker module (“MOD”) support, plus a
structural parser for Scream Tracker v1 (.stm) files.
MOD files are self-contained song data: a 20-byte title, 31 sample descriptors, a pattern order list, a 4-character signature that identifies the channel count, 64×N-channel patterns, then raw signed 8-bit sample bodies.
This crate registers:
- A container (
mod) that slurps the entire file and emits it as a single packet. The “packets” abstraction isn’t natural for MOD — playback is driven by song position + effect state, not per-packet decode — so the container just delivers the bytes to the codec. - A mixed-stereo decoder under codec id
CODEC_ID_STR="mod". Emits one interleaved S16 stereoAudioFrameevery ~1024 samples; the drop-in option for plug-and-play playback. Stereo pan defaults to a partial L/R separation rather than the strict Amiga hard pan — seeplayer::PlayerState::set_pan_separationfor the override and the rationale (Protracker-effects-MODFIL12.txt§11 itself recommends against full hard pan “Especially when using headphones”). - A per-channel decoder under codec id
CODEC_ID_PLANAR_STR="mod_planar". Emits planar S16PAudioFrames with one plane per MOD tracker channel (4 / 6 / 8 / … / 32), post-volume but pre-pan/pre-mix. Consumers that need independent channel streams (DAWs, visualisers, per-instrument remastering) select this codec id instead of"mod". - A container (
stm) that recognises Scream Tracker v1 modules (pre-S3M, 4-channel-fixed), parses the header + instrument table + pattern data + sample bodies, and exposes them for downstream consumers. A minimum STM playback engine is wired via the sharedmixer::MixerVoicecore andmixer::StmC3Pitchpitch model; drive it viastm_player::StmPlayerState::render. The associated codec idCODEC_ID_STM_STR="stm"is still a parsing-only decoder registration (it validates the packet then returns an explicitunsupported), because effect support and global mixer parameters are not yet feature-complete; callers wiring STM into the broader oxideav pipeline should hook upStmPlayerState::renderdirectly for now. - A container (
xm) that recognises FastTracker 2 Extended Module files by the 17-byte"Extended Module: "ASCII banner at offset 0. Parses the 336-byte file header (banner, module/tracker names, version, header size, song length, restart position, channel / pattern / instrument counts, frequency-table flag, default tempo / BPM, 256-entry order table), the variable-length bit-packed patterns (note / instrument / volume-column / effect / effect-param, each optional per mask byte), and the instrument table (per-note sample mapping, volume + panning envelopes, vibrato state, fadeout, multiple samples per instrument with delta-encoded 8- or 16-bit PCM bodies). A minimum XM playback engine is wired via the sharedmixer::MixerVoicecore andmixer::XmPitchpitch model (both Amiga and Linear frequency tables supported); drive it viaxm_player::XmPlayerState::render. Volume + panning envelopes (tick-based linear interpolation with sustain-point hold and loop-start/loop-end looping), fadeout (on key-off / note 97), and key-off events are supported. Vibrato, tone portamento, and the bulk of the Bxy/Dxy/Exy/Fxy/Kxy/Lxy effect space remain unimplemented. The codec idCODEC_ID_XM_STR="xm"remains a parsing-only decoder pending effect-set completeness — usexm::parse_header/xm::parse_patterns/xm::parse_instruments/xm::extract_sample_bodiesfor structural access, or driveXmPlayerStatedirectly for PCM output.
The tracker convention of exposing per-channel streams alongside a
mixed stereo mix is shared across tracker formats — see
MEMORY.md → MOD multichannel for the broader sketch.
Decode only — there is no MOD or STM encoder, by design.
Modules§
- container
- MOD as a container format.
- decoder
- MOD codec decoder — ProTracker playback.
- header
- ProTracker / SoundTracker MOD header parser.
- mixer
- Shared tracker mixer core.
- player
- ProTracker playback engine.
- samples
- Sample-body extraction for MOD files.
- stm
- Scream Tracker v1.0 (“STM”) module parsing.
- stm_
player - Scream Tracker v1 (
.stm) playback engine. - xm
- FastTracker 2 Extended Module (“XM”) structural parser.
- xm_
player - FastTracker 2 Extended Module (
.xm) playback engine.
Constants§
- CODEC_
ID_ PLANAR_ STR - Codec id for the planar per-channel MOD decoder.
- CODEC_
ID_ STM_ STR - Codec id for the STM (Scream Tracker v1) parsing-only decoder.
- CODEC_
ID_ STR - Codec id for the mixed-stereo MOD decoder.
- CODEC_
ID_ XM_ STR - Codec id for the XM (FastTracker 2 Extended Module) parsing-only decoder.
Functions§
- register
- Unified entry point: install every codec and container provided by
oxideav-modinto aRuntimeContext. - register_
codecs - register_
containers