QBXL Technical Articles

Music and You
By AetherFox

Music and you

One thing that is a very important aspect of all programs, not just games, is stimulating the ear. People often forget that in even a GUI application, simple sounds such as beeps or dings can have such a major positive effect on the overall presentation of the program. Unfortunately, most people forget about this in games. Quite silly really. Imagine playing Unreal Tournament with no voice-over screaming "MONSTER KILL!!!" during your network plays, or playing Crono Trigger without its excellent soundtrack.

Under DOS, this becomes a whole new ballgame, especially in this day. An analogy for Microsoft's line of operating systems would be a line of cars, each with a different ass-size, so you have to mould your rear to fit into it. Similarly, with each new release of Windows, DOS programmers are finding their asses being squeezed into smaller and smaller seats, with less and less room to maneuver.

This article was written to address some issues regarding the options BASIC programmers have with music under DOS. You will gain information on what methods you can use to play sounds and music, and the pros and cons of each method.

QMIDI is a very popular library for QB, that makes it very easy to play MIDI files. It has excellent features such as ease of use and play, and it plays files in the background without much notable slowdown. The fact that it plays MIDI very well is a very good feature, as MIDI files are some of the easiest to create and edit.

However, as the seat shrinks, so does the functionality of QMIDI. It is less and less supported now, but for people who aren't aiming for widespread support, this is a good bet.

- DirectSound 4 QB
When it was released, DS4QB was a revelation. A simple interface of a DOS box with bass.dll added almost unlimited functionality to DOS programs. Games now had the power to play MP3 files easily.

The problem? DS4QB is probably the most unstable and incompatible library featured here. In terms of our wonderful analogy, it basically results in the users ass being squeezed so tightly, you just pop out of the seat.

If you don't mind having absolutely minimal compatibility, and are dying to get that übern00b techno track thumping to the beat of your...get this...QB game, then by all means, commit compatibility suicide.

- Bells, Whistles & Sound Boards (BWSB)
Ah, the highlight of the lot. Definitely my favorite from the bunch, BWSB is almost everything you can look for. If you are an experienced tracker, then this is definitely the way to go. It plays modules at a surprisingly high quality, and it has excellent documentation and examples.

The downside is that it is very difficult to implement. While QMIDI could be set up by even a novice, BWSB definitely requires some lateral thinking. It also has some technical limitations, but those are out of the scope of this article.

Despite the excellence of the library, DOS has just been fizzled away by the clever monkeys at Microsoft, and so this library provides less than optimum satisfaction on newer operating systems. Still, go for this. It's the best. Even if you have absolutely no experience in tracking, Google can lead you to as many free modules as you want, they are readily available.

- Other
Well, what's left is DMA Play and the PLAY statement. I'm not even going to bother with PLAY. If you were considering using that apart from an EXTREMELY forgiving circumstance, you should be hiding under a dirty shoe.

DMA Play, in my opinion, is not worth it's trouble. While it can produce satisfactory results, it is very tricky to set up and can crash easily. I would personally recommend the feature of BWSB that lets you play samples from the module.

In conclusion...
...just stick with BWSB.

There is one superbly magical option that I have not mentioned up till now. It allows you to use practically any of the above systems perfectly. It also has features to speed up your game, properly allocate memory, and even give support for strange DOS features, like VESA. What is this?


See, while the remote-controlled chickens at Microsoft are determined, clever people are hard at work going against the diabolical schemes of the company over 90% of computer users call home. VDMSound is the result of a bunch of people who got fed up of having crap support. The program gives magical results, properly emulating almost all of the old SoundBlaster! features. I have improved VESA functionality on my computer. With a host of options, and the fact that it is completely free, you would be stupid as a DOS developer not to get it.


http://sourceforge.net/projects/vdmsound/ (SF Project Page, yes, it's Open Source).

While I may seem like I'm doing shameless propaganda, I'm not in any way linked with those dudes. They are worth all the praise they get.

I can't be bothered to write anymore, so until next time, adios.


--aetherFox knows about FreeBASIC. He was just testing you. What?