DSS3M


Contents

What is DSS3M ?
The S3M format... in Unreal
DSS3M features
Known issues
Source code
Related pages


What is DSS3M ?

DSS3M stands for "DirectSound S3M". It's a Windows soundtrack player coded in C++ that uses DirectSound to access any audio device on your PC (like Winamp does). A sountrack is a music based on "samples" : a note (for example C4) of each instrument is recorded and stored in the file, which also contains tracks full of notes and effects. Tracks are the score, effects are used to vary the pitch and the speed of notes. This kind of music is composed with programs called "trackers".

Sountracks need a very precise and high frequency timing, and DirectSound doesn't like the volume, frequency or panning to be changed too often. That's why DSS3M mixes the music in software itself, and writes the result to the DirectSound primary buffer (unless the device has very bad drivers and forces DSS3M to use the secondary buffer, introducing more delay in the replay).


The S3M format... in Unreal

Who uses soundtrack music ? This used to be the standard in the demoscene, but it has been used in some shareware games too, and in the famous Unreal by Epic Games. Yes, Unreal musics are mainly S3Ms (23) + some ITs (9), with some additional info written at the beginning and at the end of each file. When I tried it, the editor didn't allow to export the files to their original format, but if you have the .umx files on your hard disk and know the S3M and IT formats then it's really easy to get the soundtracks. I won't provide the files on this website because they're copyrighted, but if you've bought the game the method is the following :

- open a .umx file in a binary editor (you can use Visual Studio), and search for one of the two signatures : SCRM for S3M, and IMPM for IT
- IMPM : in an IT, IMPM is at the beginning of the file : remove the bytes before, and save the file to another name (name.it)
- SCRM : in a S3M, SCRM is NOT at the beginning of the file : you'll have to keep 44 bytes before the signature
That's it ! You can now listen to Unreal musics with your favorite player or tracker.


DSS3M features



There are many soundtrack formats, and I decided to implement S3M some years ago because I was using ScreamTracker a bit myself (ScreamTracker is a tracker created by the coder of the demogroup Future Crew, who defined the S3M format). But DSS3M can play MOD files too (because S3M is a superset of MOD), and some IT (an extended version of S3M). I have not implemented every feature of IT, but only the ones needed to play the musics of Unreal :) (16 bits samples, ping-pong loop, ...)

What is interesting with DSS3M is that you can enable or disable some channels, and use the slider to go back and forth in the music. This is interesting because sometimes there are several songs (using the same samples) in a single file, and players like Winamp only allow you to play the first one. This is the case in Unreal, many files contain 2 or even 3 songs ! The first song begins at order 1 (see the number above the slider), the second at order 2, and the 3rd (if any) at order 3.

DSS3M is an MDI (multiple documents) application, so you can open several files at the same time, the active soundtrack is the one that is played. If you have other applications running that are CPU consuming (like a compiler) or make big disk accesses, you will get some breaks in the music, because the DirectSound Buffer isn't fed fast enough; this is unavoidable (this happens less frequently with Winamp because it uses a bigger buffer and mixes farther ahead).

I have not worked a lot on the interface, it only exists to test files without having to recompile. How can you find soundtrack music ? There is a lot on the Internet so it won't be very difficult, you can start your search on a demoscene dedicated site, like the ones listed here. To try DSS3M, you can simply download the two files available on the Download page; play them with Winamp too (if your version supports it), and you will notice it is in big trouble with some effects.


Known issues

- I have not implemented some very rarely used effects (ex: pattern loop)
- I have not implemented every IT features (ex: volume envelops)
- the tips and texts in the status bar are in French, but they're not very useful, so...


Source code

I have decided to release the sources of DSS3M, for people who want to code a soundtrack player and need something not too complicated to start with. I don't have the time to write any documentation so I've included the one (very brief, from Future Crew) I used, and I hope there are enough comments in the code for you to understand it. DSS3M is an MDI application so it will be easier if you have some knowledge about the document/view framework.

The sources are as usual provided without any warranty. They have been tested with Visual C++ 6.0 service pack 5 on both w98 & w2k. When opening the workspace, Visual may ask you for a path for the 'playerlib' library : it is located in the LibProjects\PlayerLib subfolder. In order to compile DSS3M, the DirectX SDK must be installed on your computer and its path has to be known by the compiler. The .exe files are placed in the \runtime folder (the debug version has a 'd' appended to its name).

That's all folks ! Feel free to modify the code and improve the player, here are some suggestions :
- remove the 'clicks' that can be heard when a note starts or stops (this is because the output of the corresponding channel suddenly changes from zero to a big value or the contrary, a ramp should be added for example by making the volume go from zero to its final value very quickly)
- add volume envelops; this is the biggest thing missing to support .IT and .XM files
- support many samples by instrument; this is the 2nd biggest thing, and not the hardest (you'll see in the code that I have already separated the sample and instrument notions, each one has its own class)
- and of course, replace my very basic interface !


Related pages

DSS3M screenshots


back to top