What sound format should I use for sound effects for my MS-DOS game?

Started by
22 comments, last by yaboiryan 2 years, 11 months ago

A few months ago, I started a new game project in MS DOS and C. I wanted to make a 3D Wolfenstein-like FPS game, so I got the graphical aspect of the game engine already made. I am only struggling with one last thing: sound.

What I have so far:

I was wondering whether I could just use .MOD files somehow since I have found several libraries that I can use to implement .MOD files, but I have not found .MOD files to be a very feasible option, as, in many ways, they are like .MIDI files in many ways, so I cant just play the sound alone very efficiently.

What are the sound formats that MS-DOS developers used, and are there any libraries I can use (that are for Watcom C) that will do the loading for me?

-Thanks,

-Ryan

Advertisement

Depends on the hardware you are targetting.

For uncompressed digitized audio, .wav is the de-facto standard. Compressed digitized audio is probably overkill for a DOS game.

If you are targetting sound cards without digitized audio like AdLib, look into FM synthesis. I don't think that there's a standard file format.

If you are targetting the PC speaker, you're on your own.

.mod is a music file format, not suitable for sound effects. It requires a sound card that is capable of digitized audio.

@a light breeze Thank you for responding to my post! I am targetting digitized audio cards because I am using a SoundBlaster on my Windows 95 and a SoundBlaster on DosBOX.

I havent seen any DOS programs that can successfully do .WAV files. The only thing I see anywhere is .MIDI files and .MOD files, and since they are both just music filetypes, I cant really use them for things like gunshots. However, I was maybe thinking perhaps I could use .aiff files, since I used those when I was messing with N64 game development (well,they started off as .aiff files, but then they were converted to a file type that the N64 could read). Everywhere I look just says .WAV files, and I had a feeling that .WAV files wouldn't work with DOS applications. But I have seen games like Doom and Wolfenstein and Duke3D and Nitemare3D and they all have sound effects that play when you do things like shoot a gun or open a door. I am having trouble finding information about how the developers were able to implement such files because most internet sources typically dont show how to do things in MS-DOS, let alone the Watcom compiler (I dont need the code to be for the Watcom compiler because I can just convert the Borland functions to Watcom if need be, though it would be very convenient if they were for the Watcom compiler).

-Ryan

Not sure if the earlier games uses files at all for such things. Might just have been frequency+duration directly in the code for many of the simple effects? Also wouldn't surprise me if they made their own minimal file/embedded format if not directly coded.

With the entire program being less than a floppy disk and little memory on many systems, even something like a 8bit 8kHz mono wav is pretty big

@undefined Really? So Wolfenstein 3D's gunshot sound effect is just a frequency thing? I always thought they loaded in some kind of sound file that played.

I cannot speak for DOS specifically, but it is kind of true that old systems used a quite different way of storing sounds. I've been working deeply with emulating sounds from the SNES, and their sound-files are essentially just telling the sound-chip what “instrument” to play at what time - resulting in very small files, we're talking KBs compared to the same file as an MP3 having at least a few MBs. Check out https://de.wikipedia.org/wiki/SPC700​ - I'm sure you could find similar documentation to what formats were available for DOS back in the days.

ID had their own audio format in that era, which is pretty well documented by video game archivists.

They basically had a tool that took MIDI as an input, and spat out a file containing the AdLib register values directly.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Pretty much any library that handles digitized audio files at all will have .wav loading code. I know SDL does.

@a light breeze I dont think that DOS supports SDL.

I assumed you would write your own loading code instead of relying on a third-party library. Why target DOS if not for the do-it-yourself ethos?

Anyway, there's libwav, or if you're going to use a third-party library anyway, you might as well go for compressed audio and use the Opus codec.

This topic is closed to new replies.

Advertisement