Introduction

This will be a bit of a deep dive into how music works and worked in video games. Let’s start with the present (and past within the 21st century): Audio is generally recorded or digitally generated and stored as waveform files. It can be compressed in various ways (mp3, aac, ogg, ac3 etc), but in the end, you can imagine it being the same thing as what’s on a cassette tape or CD (if you are old enough to remember either - otherwise it’s just what’s happening when you press that play button in Spotify).

To support games using this (some older ones actually just put CD audio on the CD-ROM as additional tracks), ScummVM supports a ton of audio codecs (as well as video codecs for the same thing in video).

Now on how this worked in the late 80s to early 90s - it was really hard for a computer to play music as we intend today. Computers back then did not have the space (A song in CD quality is 20 megabytes, a floppy disk can store 1.44 of them), and also not the processing power to do any realtime de-compression with its weak CPU.

So how did old DOS games play music? They used the sequence music - the game tells the computer which note to play for how long and how strong to play it. Kind of like sheet music, but for computers. When you sequence music, it’s your computer that makes the sound from scratch. And the part responsible for making the sound is the sound card - A sort of a synthesizer but for your computer.

Generally, the available sound cards can be broken down into three categories:

  • PC Speaker: This was built into any PC. It’s responsible for outputting the “beeps”. It can output square wave sounds and it’s monophonic (it can play one note at a time). This was very limited, but some composers from the era managed to do something great with it.
  • AdLib / Soundblaster: This probably was the standard gaming sound card for that era. If you played those games as a kid, you probably had this one. This sound card uses the Yamaha OPL2 chip. It’s the same chip that you can find in a lot of Yamaha keyboards from the era. To make sound, it uses FM synthesis or frequency modulation. The Sound Blaster was a later sound card with more features, but most of the time it plays in compatible AdLib mode, so the sound doesn’t change.
  • MT32: The Roland MT-32 was a professional sound module released in the late 80s. It was the actual synthesizer that the composers used to compose the soundtrack of the games. It uses LA synthesis, linear arithmetic. It combines really short samples for the initial part of the sound with subtractive synthesis for the sustain part of the sound. This gives you the most 80s cheesy lush sounds and we all love it.

If you want to dive deeper into this, this YouTube video was really helpful: https://www.youtube.com/watch?time_continue=179&v=R14XeuTXwaU&embeds_referring_euri=https%3A%2F%2Fnotegpt.io%2F&embeds_referring_origin=https%3A%2F%2Fnotegpt.io&source_ve_path=MjM4NTE

MIDI

MIDI (Musical Instrument Digital Interface) is a protocol that allows electronic musical instruments, computers, and other devices to communicate and exchange information, but it doesn’t generate sound on its own. Instead, MIDI transmits performance data (like note information, velocity, and control changes) that tells a receiving device how to produce sound using its own internal sound engine or virtual instrument. You can imagine it as a type of music notation, instead of the actual waveforms building the music.

All of this means, that how MIDI music sounds, actually depends a lot on the (physical or virtual) device used.

ScummVM implementation

The default: OPL Emulation

By default, ScummVM comes with multiple OPL emulators which can be used directly if the game supports it, or to synthesize MIDI music.

AdLib devices do not use MIDI. They instead have a chip that produces sound through FM synthesis. While some games do store their audio data using a MIDI-derived format, this is converted by the game to work with the AdLib chip. ScummVM emulates a few different AdLib configurations, and selects the most appropriate for the game:

The original AdLib and SoundBlaster card had one OPL2 chip.

The SoundBlaster Pro 1 had two OPL2 chips

The SoundBlaster Pro 2 and 16 had an OPL3 chip.

The AdLib emulator setting offers MAME, DOSBox and Nuked emulation, with MAME being the least accurate and using the least CPU power, and Nuked being the most accurate and also using the most CPU power - DOSBox is somewhere in between.

Embedded Software Synthesizers for MIDI

FluidSynth is a popular open-source software synthesizer that can play MIDI files using SoundFont (.sf2) files. For the Emscripten build, I opted to use FluidLite, which is a lightweight version of FluidSynth that’s better suited for web deployment due to its smaller size and reduced dependencies.

I’ve included a basic SoundFont file in the build, so MIDI music works out of the box without requiring users to download additional files. This provides a good balance between file size and audio quality.

  • - AUDIO: Add a basic soundfont for fluidlite (August 2)
  • - AUDIO: EMSCRIPTEN: Add fluidlite support (August 2)

Roland MT-32 and CM-32L emulation

ScummVM includes Munt, a software synthesizer that emulates the Roland MT-32, MT-100, and CM-32L audio modules. These were high-end audio devices used by many game composers in the late 80s and early 90s, and many classic adventure games sound significantly better when played with MT-32 emulation.

The good news is that Munt works perfectly in the Emscripten build without any additional changes needed. This means you can experience games like Monkey Island and Indiana Jones with their original intended audio quality, right in your browser.

Using actual MIDI devices: Web MIDI

For those who own physical MIDI hardware, I’ve added support for the Web MIDI API, which allows the browser to communicate with MIDI devices connected to your computer. This means you can use a real hardware synthesizer or MIDI keyboard to play the music from classic games.

I unfortunately threw away the keyboard I had as a kid, so I’m testing this with software synthesizers. But if you have actual MIDI hardware, you can now use it directly in the browser version of ScummVM!

Note: If you have an MT-32, this might not fully work yet as my WebMIDI driver is missing the SysEx extension, which is needed for some MT-32 specific features.

You can test if your MIDI setup works using this online tool: https://www.onlinemusictools.com/webmiditest/

- MIDI: EMSCRIPTEN: Add Web MIDI Driver (February 13)

RetroWave: Using a Real OPL chip

For the ultimate authenticity, I’ve added support for the RetroWave OPL3 hardware device. This is a modern USB device that contains an actual Yamaha OPL3 chip - the same chip that was in the Sound Blaster Pro 2 and Sound Blaster 16 cards.

Using the Web Serial API, the browser can now communicate directly with the RetroWave hardware, meaning you can hear the authentic FM synthesis sound of a real OPL3 chip while playing games in your browser. This is particularly exciting for enthusiasts who want the most accurate retro gaming experience possible.

- AUDIO: EMSCRIPTEN: Add RetroWave with Web Serial API (May 5)

Text to Speech

Text-to-Speech (TTS) support is an important accessibility feature in ScummVM. It allows players with visual impairments to have the game’s text read aloud, making adventure games much more accessible. This feature is particularly valuable for text-heavy games where reading subtitles is essential to gameplay.

For the Emscripten build, I’ve integrated the Web Speech API, which provides high-quality text-to-speech capabilities directly in the browser. The Web Speech API uses the operating system’s built-in voices, so the quality and available languages depend on what’s installed on the user’s system.

You can test the Web Speech API here: https://mdn.github.io/dom-examples/web-speech-api/speak-easy-synthesis/

This implementation makes ScummVM more accessible to a wider audience and aligns with the project’s commitment to inclusive gaming.

  • - BACKENDS: EMSCRIPTEN: Fix missing TTS include (June 30)
  • - EMSCRIPTEN: TTS: Add TTS based on Web Speech API (May 20)

Various other libraries

I also spent time adding and cleaning up various audio and video libraries to improve codec support:

Added libraries:

- DISTS: EMSCRIPTEN: Add libvpx to build (February 4)

libvpx is Google’s VP8/VP9 video codec library. Adding this improves video playback support for games that use these modern codecs.

Music Tracker support:

Music Trackers are a unique way of creating music that was popular in the demoscene and some games. libmikmod is a portable sound library that can play module music files in formats like MOD, S3M, IT, and XM.

  • - DISTS: EMSCRIPTEN: Add libmikmod to build (February 10)
  • - DISTS: EMSCRIPTEN: Add libmpcdec to build (February 12)

URL updates and cleanup:

Several libraries had their source archives disappear from SourceForge, so I updated the build to use VideoLAN’s maintained forks:

- DISTS: EMSCRIPTEN: Change the upstream URL for a52dec to VideoLAN (July 21)

  • - DISTS: EMSCRIPTEN: Disable unused audio components (February 4)
  • - DISTS: EMSCRIPTEN: Change the upstream URL for libmpeg2 to VideoLAN (June 30)

I disabled several audio components that were being built but weren’t actually usable in the browser environment: timidity (requires external patch sets), sndio (OpenBSD audio framework), and /dev/snd/seq (Linux ALSA sequencer). This reduces build time and output size.

- EMSCRIPTEN: CI: Build with more libraries (July 26)

I also took the chance to switch the emscripten versions for libvorbis and libogg to directly use properly versioned upstream releases: https://github.com/emscripten-core/emscripten/pull/25274