How to create custom music

The Basics
Setting up in-game music

This will give you a little more detail on adding custom music than what the SDK documentation explains.  See MusicDocumentation.doc for the basic info, but I found that document to be a bit confusing and lacking in detail.

1. Create your music

As you might guess, this is the hard part. :)  In order to create music for Deus Ex, you have to use a special piece of software called a "tracker".  If you're familiar with Cubase, Cakewalk, etc and/or MIDI files, you understand the concept of a sequencer.  A sequencer just stores basic information about a song, such as the pitch, start times, and duration of all the notes in the song (for each instrument).  This makes a very compact file.  Trackers use a similiar approach, but they also store all of the instrument samples with the file.  That means that the song will sound the same on any hardware, but the file size is a lot bigger.  It's still generally a lot smaller than recorded audio, such as MP3, WAV, etc.

An advantage to this approach is that you can have differerent sections of a tune that you can branch to dynamically within the game.  So you can have ambient music that plays while you're just walking around, and more intense music that plays during combat.

If you don't already use a tracker, you'll have to pick one first.  There are a number of shareware and freeware ones available.  The link mentioned in the SDK docs is a good place to start:  You can also purchase collections of samples there.  If you want to just dive in without reading all of that, a good freeware tracker is called ModPlug - you can find it here:

Trackers such as ModPlug let you import and export to MIDI format, so you may find it easier to use your favorite sequencer to create and edit sections of music.

The trickiest part (aside from actually writing compelling music, of course!) is setting up the pieces of your tune for dynamic play.  Basically, the first six "patterns" in your song define how your dynamic content will work.  Within each of these six patterns you can place a "B" command (branch) to continue playing other patterns in your song.  In ModPlug, that would look something like this:

Notice the B06 at tick 63?  That is a "Position Jump" that you can add with the Bxx effect.  It will cause the music to jump to the seventh pattern in the song.  Why the seventh if it's "06"?  That's because the first pattern is "00".

If all of this sounds terribly confusing (which it is at first), you might try checking out the Trackers Handbook.  As of this writing, you can get it here:

It can also help to export the songs from Deus Ex, open them up in your tracker, and look at them.

So what are the six types of dynamic music?  Here they are:

Pattern 0 - Ambient 1
Pattern 1 - Dying
Pattern 2 - Ambient 2 (optional)
Pattern 3 - Combat
Pattern 4 - Conversation
Pattern 5 - Outro

After you branch from one of these patterns into somewhere in your song, you can set up loops using the "Bxx" command.  You can even get fancy and have intros that are not part of the loop and so on.

You don't have to write specific music for all six of these.  For instance, if you don't want to write any Ambient 2 music, you can put a Bxx branch at tick 0 to just jump back to the first Ambient 1 pattern or whatever.


2. Import it into Deus Ex

The tracker software you use will save your song in one of several tracker formats, such as .IT / .MOD / .XM and so on.  UnrealEd is able to import just about any tracker format, so when you're done with your song, you shouldn't have any problems importing it.

In UnrealEd, select Music from the Browse menu on the upper-right.  Hit Import and select your song.  Now hit Save to save it in Unreal format as a .UMX file.  Your music can now be used in a map.


3. Set up a map to use the music

You should have already read Setting Up In-game Music, but if you didn't, here's how you set up a map to use your music.  In UnreadEd, just go to the Options menu and select Level Properties (or hit F6).  Expand the Audio properties and click in the Song value area.  The easiest way to select a song is to click on one in the Music browser, then hit the Use button in the Song value.  You could also define a starting point (a pattern number) into the song by setting the SongSection value, but you shouldn't need to do that.

In most cases, you're done at this point.


4. Add MusicEvents and triggers to a map (optional)

This is not very typical, but if you have an extra special event or if you want some location-specific music within a map that is different that what's in the Level Properties, you can use a MusicEvent actor (available under Triggers).  Set the Song property the same way you did in the Level Properties.  The SongSection value may be a little more helpful here, depending on what you're doing.  There is also a Transition property that you can change.  The values are pretty self-explanatory, so I'll let you experiment with those.

You can also set the bSilence if you want to stop the music, which is another way to alter the mood.

The MusicEvent actor alone is not enough to trigger the music.  You'll have to also add a Trigger to actually, well, "trigger" the music.  Give the MusicEvent object a Tag value and set the trigger's Event to the same thing and you'l be good to go.  If you did it right, you should see a red line connecting the MusicEvent and the Trigger.

That's it!


Additional tips

Courtesy of Steve Foxon, who has done some breathtaking music for Deus Ex using ModPlug, here are some additional tips:

Not all features in a lot of the tracker programs are useable in UnrealEd.  A lot of the more recent trackers have unique features to that piece of software, that are designed only to be used when recording everything down to a .wav file, such as the VST effects and instruments in ModPlug.  Also, in ModPlug, and possibly other trackers, the EQ and reverb stuff doesn't get recognised, but the initial pan, initial volume and surround stuff in the general tab do work.  Although I've recently found that it can be a problem using these if there is more than one section to your track (e.g. combat) and another section then uses different panning and volume settings (see Important Note below).  I know for sure that the New Note Action doesn't work and neither does the Volume envelope.  However, the panning envelope and ping pong looping does work.

Basically I would avoid using instruments in MODPlug, and stick to samples, otherwise you will get problems.  I find it useful to put 2 or 3 single note samples of one particular instrument such as a high and a low note, so that the samples doesn't start to sound odd when playing different octaves.  Also, get hold of a good wav editor if you can, and maximise the level of the samples as much as possible, as the tracks can tend to sound quiet in game.

Don't use more than 32 channels if you want FX sounds in the game playing at the same time.

Although a track can sound fine when played in your tracker software, when you play it in the SDK (UnrealEd) or in DX, you can get a lot of "glitches" in the music (i.e. "clicking and popping").  This is caused by the sudden cutting off of samples when another of the same sound starts, such as if you are hitting the same note constantly, and the length of your note is shorter than the length of your sample.  I found the best way around this is to have a very small quiet bit at the start of the offending samples, short enough that it doesn't put the timing out, and where possible do a quick fade (in the pattern, not the sample) at the end of a released note, such as strings, rather than just stopping it with a "note off" or "note cut" command.  The basic idea is to get the samples starting and stopping on a zero value. Sometimes, the only solution is to record a particular sequence of notes as a single sample, but this can make the tracks rather large if not careful.

Most of the standard tracker commands will work (Sxx, Oxx, Pxx, Txx, Axx etc..).  Just experiment to see what they all do, or open up a piece of Deus Ex Music and see what commands are used, and what affect they have.  You can get some really cool effects if you play, and the most useful command I've just discovered is Oxx, which is sample offset.  Basically it will start the sample playing at another place other than the start if required, which can cut down on the number of samples you use as you get different sounds depending on which part of the note you trigger from.  You can get a really nice stereo effect using it, by having the same note and instrument twice, panned to the left and right extremes, and then offset one of the samples slightly.

As for keeping sample and file size down, I've found that all samples sound fine at 22k as opposed to 44k, which will halve sample sizes.  A tip for using long synth sounds such as pads and sweeps, is to utilise the loop feature for the sample, so basically when you play the note it will keep going until you tell it to stop.

Due to possible differences between your tracker and DX, it's a good idea to regularly check your track in the SDK so that you can eliminate glitches as as you go along, rather than having to sort a bunch out at the end.

If you use the full 256 lines in a pattern, UnrealEd will freeze on you! 255 is fine; it just doesn't like that extra one line!

IMPORTANT NOTE: When used in game, the main ambient section set in your map will revert to playing from the pattern it finished on before it switches to another section such as Combat or Conversation.  If the tempo, panning, volumes, etc. are different for these sections from the ambient part, they will not automatically be reset back to previous values when switching back.  Therefore, if these values do vary, it is very important that you have tempo, speed and global volume (if used) requirements at the start of every pattern.  This also goes for panning, sound control, etc. but these don't necessarily need to be at the beginning of a pattern, as long as they appear before the sample it refers to is played.

Back to main page