15 September 2026
Converting id Software IMF Audio to WAV: Yamaha OPL2 FM Synthesis in the Browser
Converting id Software IMF Audio to WAV: Yamaha OPL2 FM Synthesis in the Browser
Before digital audio CD tracks and general MIDI wavetable synthesis dominated PC gaming in the mid-1990s, the AdLib and Sound Blaster sound cards reigned supreme. At their beating heart was the Yamaha YM3812 (commonly known as the OPL2)—a dedicated frequency modulation (FM) synthesis sound chip capable of producing nine simultaneous melodic channels.
To bring fast, low-overhead music to early 286 and 386 MS-DOS machines, id Software founders and legendary game composer Bobby Prince created the id Software Music Format (IMF). IMF powered the unforgettable soundtracks of Commander Keen 4–6, Wolfenstein 3D, Spear of Destiny, Bio Menace, Blake Stone, and Corridor 7.
1. The Structure of an IMF File
Unlike tracker modules (MOD, S3M) or MIDI files, an IMF file contains no note abstractions, instruments, or waveform samples. Instead, it is a sequential stream of hardware register commands written directly to the Yamaha YM3812 chip:
- Register (1 byte): The OPL2 register index (e.g.
0x20for operator characteristics,0x40for total level/attenuation,0xA0for frequency number low). - Data (1 byte): The value byte to write into the specified register.
- Delay / Ticks (2 bytes LE): The number of timer interrupt ticks to wait before executing the next register-data command.
A 4-byte command packet is thus represented as:
[Reg: 1 byte] [Data: 1 byte] [Ticks: 2 bytes Little-Endian]
2. The Game Clock Rates: 560 Hz vs 700 Hz
A common mystery for retro audio enthusiasts is why Wolfenstein 3D music played too fast or too slow when played in different source ports. The answer lies in the MS-DOS programmable interval timer (PIT):
- Wolfenstein 3D & Spear of Destiny: The game loop hooked the timer interrupt at 560 Hz (each tick $\approx 1.786$ ms).
- Commander Keen (Goodbye Galaxy & Aliens Ate My Babysitter): The music driver ran at 700 Hz (each tick $\approx 1.428$ ms).
- Duke Nukem II: Used a slower timer tick rate of 280 Hz.
convrtr provides customizable clock rate presets so you can synthesize songs at their authentic intended tempos.
3. Pure In-Browser Yamaha OPL2 Emulation
convrtr emulates the Yamaha YM3812 OPL2 architecture directly in TypeScript:
- Phase Generators & Sine Wave Transforms: Computes carrier and modulator frequencies from frequency number and octave blocks.
- Operator Envelope Generators: Models Attack, Decay, Sustain, and Release (ADSR) state machines for 2-operator FM pairs.
- Feedback & Feedback Modulation: Simulates self-feedback loops on operator 1 for rich brass and percussion textures.
- 16-bit Stereo PCM WAV Rendering: Blends the channels and encodes clean, lossless 44.1 kHz stereo audio.
All synthesis happens 100% client-side in your browser with zero external servers.
Related reading
Converting FastTracker II XM Chiptune Modules to WAV: Architecture and Synthesis
Explore the forensic format of Triton FastTracker II Extended Modules (.xm). Understand 32-channel pattern matrices, linear pitch tables, delta sample compression, and client-side WAV rendering.
Converting Scream Tracker 3 S3M Modules to WAV: Architecture and Synthesis
Examine Future Crew's Scream Tracker 3 (.s3m) format. Learn how 32-channel bit-packed note patterns, 16-bit paragraph sample offsets, and Gus/OPL panning are synthesized into 16-bit linear PCM WAV.
Converting Impulse Tracker IT Modules to WAV: Architecture and Synthesis
Explore Jeffrey Lim's Impulse Tracker (.it) format. Learn about 64-channel matrix structures, C5Speed frequency tables, sample compression, and client-side WAV rendering.
Converting PolyTracker (PTM) to WAV: 32-Channel DOS Game Chiptune Synthesis
Explore Carlos Hasan's PolyTracker PTMF architecture. Learn how 32-channel panning tables, 16-bit PCM samples, ping-pong loops, and tracker synthesis render into CD-quality WAV in browser memory.
Converting Farandole Composer (.far) to WAV: 16-Channel DOS Tracker Synthesis
Dive into Daniel Potter's 1994 Farandole Composer module format. Discover how 16-channel pattern cells, 8-bit PCM samples, custom panning tables, and real-time chiptune synthesis render into pristine 16-bit WAV audio.
Converting Composer 669 (.669) to WAV: 8-Channel DOS Tracker Synthesis
Explore Tomasz Pytel's 1992 Composer 669 tracker format. Learn how 8-channel pattern matrices, 108-byte song messages, 8-bit unsigned PCM waveforms, and software mixing synthesize into clean 16-bit stereo WAV.
Converting AMF Tracker Modules to WAV: Advanced Module Format Audio Synthesis
Dive into Otto Chrons' Advanced Module Format (AMF) and ASYLUM tracker architecture. Learn how 16-channel DOS module tracking and 8-bit PCM software mixing render into studio-quality WAV audio.
Converting DSM Tracker Modules to WAV: RIFF DSMF Multi-Channel Audio Synthesis
Explore DSIK's Dynamic Studio Module (DSM) tracker architecture. Learn how RIFF container chunks, 16-channel pattern matrices, and 8-bit PCM samples synthesize into 16-bit stereo WAV.
Converting Reality Adlib Tracker (RAD) to WAV: 9-Channel OPL2 FM Synthesis
Explore the internal architecture of Reality Adlib Tracker (.rad) files. Learn how Yamaha YM3812 2-operator FM synth parameters synthesize into 16-bit stereo WAV in your browser.
Converting Oktalyzer (OKT) Modules to WAV: Amiga 8-Channel Chiptune Synthesis
Explore Armin Sander's legendary Amiga Oktalyzer (.okt) tracker format. Learn how 8-channel software mixing on the 4-channel Paula sound chip is rendered into studio WAV audio.
Converting MultiTracker (MTM) Modules to WAV: 32-Channel Track Matrix Synthesis
Discover Daniel Gold's Renaissance MultiTracker (.mtm) format. Learn how 32-channel track matrix sequencing, volume panning, and 8-bit PCM samples synthesize to 16-bit WAV.
Converting HMI DOS Game Audio to WAV: Emulating 1990s PC Soundtracks
Explore Human Machine Interfaces (HMI) MIDI audio from Descent, Warcraft II, and Mortal Kombat. Learn how multi-track game sequences synthesize into 16-bit stereo WAV.
Converting AdLib ROL Music to WAV: Emulating 1980s PC FM Synthesis
Discover AdLib Visual Composer (.rol) music from the pioneer era of PC audio. Learn how Yamaha YM3812 (OPL2) FM synthesis converts to 16-bit stereo WAV.
Converting Miles Sound System XMI to WAV: 1990s PC Game Soundtracks
Discover Miles Sound System Extended MIDI (.xmi) audio from Wing Commander, Ultima, and Theme Park. Learn how IFF XMID sequences convert to 16-bit stereo WAV.