Decode tracker modules with @audio/decode-mod
master@audio/decode-mod decodes tracker modules (MOD, XM, S3M, IT, MPTM, etc.) into PCM float samples using a WASM-compiled version of libopenmpt. It is designed for playing back chiptunes in the browser or bulk-converting tracker files to PCM/WAV.
Important Note: A tracker module is a program (samples + patterns + playback sequence), not raw audio. Because of this, decode() requires the complete file; it cannot perform meaningful partial parsing of a truncated module.
import decode, { decoder, info } from '@audio/decode-mod'
// Basic decoding to PCM
let { channelData, sampleRate } = await decode(modBytes)
// Extract metadata without rendering audio
let meta = await info(modBytes)
// meta contains: { title, artist, type, typeLong, tracker, message, duration, channels, patterns, orders, instruments, samples }