The radical music of SlipSpeed
The radical music of SlipSpeed
Chiptunes for DOS
SlipSpeed is an upcoming top-down racing game for DOS and Windows 95/98 PCs, made in the tradition of early 90s shareware. It's a project by Tom "voxel" Purnell, who is doing all the coding and graphics and whatnot. For some reason I was put in charge of the music, and as a fan of both DOS and racing games, I'm more than happy to contribute.
I feel that everything involved with creating chiptunes for DOS is a bit of a murky world to outsiders. Although a lot of people are aware of for example the SID chip inside a Commodore 64, I get the impression the OPL chip found on AdLib and SoundBlaster cards is a lot less embraced by both people inside and outside of the scene. Maybe I'm wrong, but when I visisted a demo party in Germany last year, I think I was just about the only one with an OPL3 / DOS music entry. So I thought I'd take this opportunity of working on an actual DOS game to share some of the background, explain the technology a bit and hopefully demystify the whole thing.
A soundtrack in less than half a megabyte
Now because SlipSpeed is running in DOS, one of our goals was to make sure the game fits on a floppy disk. A 3.5" high density diskette has a capacity of about 1.44 MB. With the game taking up about 0.9 MB, that leaves about half a megabyte of disk space for the whole soundtrack.
For comparison, an MP3 file that takes up 0.5 MB can fit about 30 seconds worth of music when encoded at 128 kbps. That's a bit short for a whole game's soundtrack, so this approach is not really the way to go ahead.
We did consider forgetting about floppy disks and using CD instead. A standard CD-ROM has a capacity of 650 MB and since the game is still only 900 KB, that leaves loads of space for music. We could even use actual "Red Book" CD audio, so the music could play in any CD player. It's a neat idea, but doesn't really work with the whole "shareware" concept. It also just doesn't feel right to have the music take up so much more space than the entirety of the game itself. So we decided to do what the demoscene people do, and use a tracker.
Trackers: what do they do? Do they do things?? Let's find out!
Trackers originated in the late 80s on the Amiga, but quickly found their way to other systems. It became a popular way to make interesting-sounding music that takes up very little disk space and has been used in tons of demos and games over the years.
There are a lot of different tracker programs available, but what they all have in common is that they offer a bunch of channels which hold information on what note to play at what time, typically presented next to each other in columns. The music is then played from top to bottom, triggering notes and effects in each of the channels as the playhead moves down.
The reason why music produced using a tracker is so small in filesize compared to digital audio files, is that a tracker file only contains the information stored in the channels. It can be compared to how MIDI files work, which also only store which note to play at what time and using what instrument, but not the actual sound that is produced as a result.
With MIDI, the note information is typically sent to a MIDI-compatible sound device, such as a synthesizer or a sampler which contains a set of sounds known as General MIDI. This acts as a "standard library" for music, including such things as various "pianos", "guitars", "basses" and so forth. The composer simply selects which of the 128 available sounds they want to be used with what channel, and the MIDI sound device will do the rest. And while this is pretty convenient, there is little extra what the composer can do to spice things up a bit. There are no real effects which can be used, and sounds can only be manipulated in very limited ways. This is why MIDI music often feels a bit basic, because in all honesty - despite some commendable efforts - it just kind of is.
Things are very different however over in the world of trackers, where there isn't such a "standard library" of instruments at all. In fact, the way sound is produced between different trackers can vary wildly. The oldest trackers started by using audio samples, which are simply very short sound clips. By pitching these short clips up and down, you can make a single sample play all the different notes found on a piano, while still only occupying minimal disk space. On top of pitching, most trackers offer a wild array of features to further control and enhance the sounds that are played back, from varying the start and end positions of the sample to all sorts of effects.
Some systems are very capable at playing audio samples, such as the Amiga with its 4-channel built-in hardware mixer. But other systems have very different audio hardware capabilities and thus require a different approach in how to generate sounds. Some systems have a built-in synthesizer chip, which can produce various sounds in real-time by adjusting a bunch of parameters. Examples of these are the Commodore 64 with its SID chip, or the NES/Famicon with its own weird 5-channel audio system. There are all sorts of trackers available which support all kinds of different systems. Including ones that work for DOS games.
A typical mid-90s DOS machine is probably more than capable of playing Amiga-style sample-based tracker music. But there is also a popular synthesizer chip available in one form or another in a lot PCs: the OPL3. And that's what we decided to use for SlipSpeed.
A short history of PC sound stuff
When the IBM PC was released in the summer of 1981 it was a computer aimed at doing work. IBM wasn't called "International Business Machines" for nothing, so they designed their system with the business user in mind. And although that meant the PC was pretty competent in some departments, an area where it was decively lacking was sound. It came with a 1-bit 1-channel square wave generator known as the "PC speaker", often affectionally called "the beeper" or "the squaker". It could play only one thing at a time and there was no volume control whatsoever. It was really only intended for playing back short beeps, no doubt to alert the user of something business related. Games did make use of it, but you can imagine the results were very mixed.
The state of IBM PC audio remained pretty much the same for a number of years for most users, until in 1987 a Canadian company called Ad Lib Inc. released the AdLib Music Synthesizer Card. A lot of games added support it in the late 80s, quickly turning AdLib into the defacto standard for music in games on PC-compatible hardware.
OPL2, the people's synthesizer
The AdLib card was really very simple in its design. It's based entirely around the Yamaha YM3812 sound chip, also known as OPL2. This single chip does all the heavy lifting of actually generating the sound. In the early 80s Yamaha Corporation had revolutionised the music industry with the release of the world's first successful digital synthesizer, the DX7. Following their success, Yamaha went on to create a vast line of different sound chips, all based around the same core technology. Many of these chips ended up in video game hardware, from arcade machines to home computers and consoles.
That technology used by Yamaha, and later others, is called FM synthesis. It works very differently than the more traditional subtractive synthesis, commonly found in analog synthesizers. Subtractive synthesis typically uses filters and the results are often described as "warm" and "fuzzy" sounding. Digital FM synthesis on the other hand can be described as "harsh", "chilly" or "glassy". And maybe that doesn't sound appealing to you now, but in the 80s this cold digital sound was very hip indeed.
Try it for yourself!
If you want to try out what FM synthesis sounds like, you can for example play around with this awesome web FM synth someone made: taktech.org/takm/WebFMSynth/. If you look at the synth from this link, you might notice that, for a synthesizer, there are actually very little parameters you can adjust. That is because FM synthesis is fairly basic in the way it works. There aren't a lot of different components, which is why Yamaha was so successful in incorporating an entire multitimbral synthesizer onto single low-cost chips in the 1980s.
OPL3 and the death of AdLib
The OPL2 chip found on AdLib sound cards was later followed by an improved version, the OPL3, or Yamaha YMF262. The OPL3 is not that different to the previous version, but it does add a few cool things, such as support for stereo. Just like the OPL2, the OPL3 chip was used in many computer sound devices, most notably the Creative Labs Sound Blaster 16.
While the AdLib card had proven to be very successful in the late 80s to provide PC gamers with some good tunes, it did lack one notable feature: it couldn't play actual digital audio files, only music through its synthesizer. Some games did try to use the OPL2 chip at audio rates in order to play sound effects and speech, such as MicroProse's F-15 Strike Eagle II. This technique is similar to what was tried earlier with playing PCM audio through the PC speaker, such as the intro to Mach III.
But really these hacks don't hold up in the end. It requires a lot of CPU power to play audio this way and the results, albeit impressive on a technical level, don't sound particularly good. This is why the Creative Labs Sound Blaster could quickly gain a lot of market share throughout the 90s: they offered AdLib-compatible OPL playback, but with hardware digital audio on top.
What happened next? Nothing, that's what
After the OPL3 there weren't many developments in terms of FM synthesis in PC consumer hardware. There was an OPL4 chip (Yamaha YMF278) produced by Yamaha, but it mostly focused on the ability to play samples, and the FM-part of that chip is entirely identical to the OPL3. The world moved to other forms of music playback, most notably to CD-audio and later compressed digital audio files such as MP3 and Ogg Vorbis. With the advent of CD-ROMs and other media, larger harddisks and faster internet connections, preserving disk space became less of a concern when it comes to music in games. By the late 90s, almost no games were coming out with OPL music at all anymore.
Nowadays OPL3 emulation is included with DOSBox, so the glorious PC game music of the 80s and 90s can easily be enjoyed on modern computers, even if they don't have an OPL chip inside them at all.
There are various trackers available to create OPL3 music with, but the one we went with is RAD Tracker v2. It's the same tracker I used to create my entry for Revision 2019, so I was already a bit familiar with it. Trackers can have quite steep learning curves, because each one has their own unique idea of what makes a good user experience and workflow, so knowing how to work with a particular one is a big timesaver.
Originally RAD Tracker was released in 1995 by a demo group called Reality. RAD Tracker stands for Reality ADlib Tracker, as it only supported the OPL2 chip as found on AdLib cards at first. Bizarrely however, Reality released an update of their app in the year of our lord 2018 (!), adding OPL3 support among other improvements.
The download on their website says it runs on Windows & Mac, but the package actually also includes an executable which runs in MS-DOS (and by extension, DOSBox, so you can run it in Linux just fine). That is not the only goody present in the download however, it also comes with code examples of how to implement a RAD file player. This made it relatively easy to include OPL3 playback from RAD files into our game.
Enough with the text already, what does it sound like?
I'm honestly impressed you've made it this far into this post. I didn't have a real plan when I started writing and it's gotten a lot longer than I ever thought possible. So let's take a quick break and do some listening.
These are the seven songs that are included with the shareware release of SlipSpeed, playing inside RAD Tracker v2 in DOSBox:
I started by making the racing songs, which are played in the background during the actual gameplay. Each course has its own song (which means I've got quite a few songs yet to make for the full game, welp). The main idea was to make thumping beats, because I feel that sort of music just works well with racing games. Some are based on a basic four-to-the-floor pattern, while others are venturing more into the realm of drum & bass, but my goal was always to make them fun and danceable. As WipeOut proved in the 90s, there's a surprising overlap between what you want to hear while racing virtual pods and what you want to hear at a rave.
One of the difficulties with the OPL3 synth is to make good drum sounds. I often ended up stacking multiple drum hits on top of each other to make them sound loud enough. The other sounds were much less of a problem to create and I feel the end results for most instruments are not bad at all, even though most of the available waveforms in OPL3 are a bit avant-garde.
With the theme song I tried to include more melodic lines and catchy hooks to make the whole thing more memorable. The end song is basically a reprise of the theme song, preceded by an epic "guitar" solo. All in all I'm pretty happy with how everything turned out, I hope you can agree!
The question left unanswered so far is, of course: did it work? Did we manage to make a whole game's worth of music in less than the 500 KB of disk space we had available? Can we fit this game on a floppy disk now? These RAD files might be small, but how small are they really? Well let's have a look, shall we.
Turns out RAD files are really quite small indeed. This makes sense of course, as they don't actually contain any audio at all. They consist only of instructions for the OPL chip: when to play what note with which parameters.
All of the music I've made for this game so far combined are about 41 KB. Of course I still have some more tracks to make, so we might end up more in the region of 80 or 90 KB, but even so we'll easily stay well within our 0.5 MB budget. And that of course means we'll be able to put the game on a floppy disk, which was our goal from the start.
If you want to check out the results, head over to itch.io where the shareware version of SlipSpeed is available for free. From there you can also buy the full version of the game. And last but not least you can order the whole thing on an actual floppy disk too!
Leave a comment
Log in with itch.io to leave a comment.