In my last post, I described getting my 8-bit game Cab Hustle compiled for Windows systems. One of the missing parts was sound. Sound’s now also addressed, and Cab Hustle plays like a regular Windows game, more or less. You can see in the video at the bottom of this post how it looks (and sounds).

Getting sound to work was surprisingly easy using the SDL_mixer library. Instead of doing a light emulation layer for the C64’s sound chip (the SID) as I did for video output, I am just using pre-recorded sounds. First, there’s the title music. For the C64 version of the game, that’s a SID file (essentially a program that continuously writes to the SID’s registers—you can read about that in a prior post). For the PC version, it’s a compressed sound file. Instead of just recording the C64 version, I’m using a slightly fancier version I made using Renoise. (I used this version of the theme song in a YouTube video about the game before.) Having more than three channels and one filter makes making music quite a bit easier.

Renoise. A nice tracker with more than three channels.

I took a similar approach to the sound effects. Instead of recording the ones from the C64, the PC version uses sounds I created with SuperCollider. SuperCollider consists of tooling and a programming language that allow for the creation of sounds, and it was something I meant to try out for a while. It’s complex, so the sounds I managed to make for the game are still very simple. The incantation for the new fueling sound looks like this:

{HPF.ar(Blip.ar(7, 90), 100)}.play;

That’s still a simple sound, but it has more texture than the plain hum that the C64 version uses. There are 8 sound effects total in the game, and they all get triggered by calling their respective function in the code. In some cases, sounds need to be stopped as well, such as for thrust and fueling. The PC version simply replaces the changes to the SID registers of the C64 version with calls to SDL_mixer playing these sounds (or stopping them).

The last change is that the game now runs in fullscreen by default. You can see the current state in the video below. There are still a few rough edges to polish, but otherwise it works nicely. And that’s all for today…