2015-12-13

Renaissance CDFM music

Back in 1992, a group called Renaissance released a little demo called Amnesia. This demo would ultimately become one of the classics, known by all in the demoscene for its mesmerising visuals and stunning soundtrack.

The group would go on to release more demos, and eventually have a game published through Epic Megagames called Zone 66. Many of these demos, and indeed Zone 66, would use the same music system as originally demonstrated in Amnesia.

This music system was unique, in that it combined both digital sound (like the .mod format) with FM synthesis (like .mid/.cmf/.imf). The idea was that this would allow many more notes to be played at the same time, with a minimal impact on game speed thanks to the FM channels being mixed in hardware.

Zone 66 intro

Zone 66 was one of the first "next-generation" games I had the privilege of discovering, once I ventured beyond an 80286 and into the world of protected-mode games. The music captivated me, and I found Zone 66's intro sequence haunting. For years I dreamed of learning more about what format the music was and how it was played.

Eventually I found my way online, and to my dismay there was precious little about the Zone 66 music online. I discovered Amnesia, and that there had been such demand for its music that Renaissance had released a music player solely for Amnesia, but alas nothing for my beloved Zone 66 music. For a number of years, this was all there was.

In late 2009 I started working on Camoto - a suite of programs to extract, examine and modify DOS games. As I was always fond of music from DOS games, naturally one of the Camoto parts was dedicated to game music. Having implemented a number of completely different music file formats, I found I was beginning to get a feel for how people were storing music in their games. I decided to take another look at the Zone 66 music files, but I discovered that like the rest of the Zone 66 data files, they were compressed, so not knowing the compression algorithm (or much about how compression worked), my attempts at deciphering this enigma were met with very limited success.

I had been posting about the Zone 66 data files on the Xentax forums, sharing my progress and asking whether anyone had any insight into the compression algorithm that was being used. An individual by the name of John_Doe had a look at my notes and was able to take the next step, and completely understand the compression algorithm. This was the breakthrough I had been looking for! We were now able to decompress Zone 66's data files. While John_Doe was interested in the game levels, I headed straight for the music files.

These turned out to be far less complex than I expected. Certainly compared to the nightmare that was The Bone Shaker Architect, CDFM was a breath of fresh air. I could identify what looked like pattern data and what was very obviously instrument data, both FM and PCM. However I could not compress the Zone 66 data files, so I had no way of getting the game to play modified music. This is crucial for reverse-engineering, because the quickest way to work out a music file format is to change something at random, play the song, then listen for what has changed. After doing this a few dozen times you can start to work out which bytes control the pitch, which ones control the instruments, and so on.

At this point I remembered the Amnesia Music Player. Looking through the Amnesia data files, I found the uncompressed CDFM songs. I tried overwriting the first song's data with one of the decompressed Zone 66 music files, and much to my delight, the Amnesia Music Player started playing Zone 66 music instead. This meant I had a way to play modified songs, allowing reverse-engineering to proceed.

After many hours of tweaking data in a hex editor and listening to the opening bars of the Zone 66 intro tune so many times I was beginning to change my opinion of the music, I had finally deciphered the file format. There were four digital tracks and nine FM tracks. Instrument 1 was the first digital or FM instrument, depending on which track the event was played in. There weren't any effects, just note on/off and channel volume adjustment.

After documenting the format on the ModdingWiki, I set to work adding playback support to Camoto. The first time I heard the Zone 66 music being played through my own program was indescribable. After all these years pondering about this mysterious file format, I had finally discovered its secrets and had the only music player in the world outside of Renaissance themselves. Since Camoto could write S3M files with both FM and PCM instruments, I converted the songs to S3M format and posted them online to show the world the CDFM format was a mystery no more.

In my early searches for more information about CDFM, I stumbled across a page from 1994 by Trixter talking about this "CDFM" format that Renaissance were using. I sent Trixter an e-mail to let him know I had figured out the file format, and much to my surprise, he forwarded it to Daredevil, from Renaissance. I nearly fell off my chair when he replied with a copy of the original CDFM tracker, complete with source code!

I hastily ran it and had another surreal experience when I became one of a very select few who were seeing the original unreleased program used to compose the Amnesia and Zone 66 music. It might not seem like much to those outside the "scene", but for me it was mind-blowing to finally see this program after wondering about it for so long. I had assumed it was lost forever, like so much from this era.

Daredevil said that although it is quite rough and unfinished, he is happy for it to be made public, so I present here the Renaissance CDFM Tracker. Personally I find this work-in-progress view much more interesting, as it provides more of a behind-the-scenes look into how the program was used during game/demo development.

Download: cdfm.zip (3MB)

The download includes all CDFM tracks including some unreleased songs, as well as a couple of utilities. The tracker is designed for use with a Sound Blaster Pro 2 only, with fixed I/O, IRQ and DMA lines, so you will likely need to modify your DOSBox configuration file to get any sound out of the tracker. It works for me with the default SB16 settings, however these are the dosbox.conf settings recommended by Daredevil:

[sblaster]
sbtype=sbpro2
sbbase=220
irq=5
dma=1
hdma=5
sbmixer=true
oplmode=auto

The other options can be left as-is.

To launch the tracker, use the D.BAT helper, like this:

DIR MUSIC /W       ; List available music files
D ZONE0D           ; Choose a name from the list - no path, no extension

Once the player has loaded, press F5 to start playback. You may wish to press Tab once first, to switch from mono (default) to stereo mode. If you are missing FM instruments, try quitting the player (Alt + X) and rerunning it. You can press ? for help.

Here are some comments from Daredevil:

Some files worth noting:
  • 1.C - a small C program to recalculate the frequency table for 44100hz sample rate. You can probably ignore this but I thought it was cool :)
  • MPS.BAT - if you want to recompile CDFMSB, use this.
  • 670TOC67 - this will convert 670 files into C67 files that can be loaded into the composer. At the bottom of 670TOC67.C you will find some comments that document the file format of both of these.
  • MUSIC - these are all of the CDFM music files that I have. I wonder if Kenny or Ray have others? Not sure, but some were native C67 files and others I converted from 670. I'm pretty sure a few of them were not used in public releases but may have found their way out there in one form or another.
  • PLAY670.EXE - standalone 670 music player. I'm not sure where the source code is but it does seem to work in DOSBOX.

Kenny Chow later responded to say he doesn't have any of the original files any longer.

I still can't get over the fact that the CDFM tracker is now at long last public - and with source code too, no less. I hope those of you who are likewise fans of the Zone 66, Amnesia and other CDFM music are able to share in this amazing event!

Big thanks to Trixter for putting me in touch with Daredevil, and of course to Daredevil himself for having kept all this for so long, and being so willing to share it!

No comments:

Post a Comment

Please keep comments relevant to the article. If you need help, please visit a forum like http://www.classicdosgames.com/forum/ instead of asking for help here.