Composing in-game music – retro style

(Screenshot of Sound Tracker from http://hardcoregaming101.net)
Submit to StumbleUpon

Hello, and welcome back to my blog!

Its time for another guest post – I commissioned this one after a very long search to find an artist talented enough and with the right skill-set for composing in game music in a highly compressed form: Chip tunes. These are steeped in home-computer history and have their origins back in the days of the C64 in the 1980s where musically talented software engineers would digitally craft instruments by directly programming the sound chips, and then sequence these into extremely complex arrangements.

If you know your home computer history, names such as Rob Hubbard, David Whittaker and Martin Galway will be familiar to you as the legends of this era.

Sadly this is a skill that has all but died out these days, with the proliferation of MP3 and CD audio in big budget games. There is however, still a place for Chip Tunes in cases where memory footprints must be low, such as mobile games, in 4096 byte demos or if you really want that authentic retro sound for your in-game music.

Without further ado, I’d like to introduce René Wiersma from the Netherlands:

Who am I?

My name is René Wiersma. I am from Groningen, the Netherlands. I am 33 years old and a software engineer by trade. My passion is creating music.

I started creating music on the computer in 1994 when I was 15 years old. I used so called tracking software like Scream Tracker and later the more advanced Impulse Tracker. Having had no musical training whatsoever I learned by listening at other people’s tunes and looking at how they had done things. I stopped creating computer based music around 1998, when I took up playing guitar and used that to write songs instead.

(Screenshot of Schism Tracker from Wikipedia.org)

A year or two ago I discovered Schism Tracker, a remake of Impulse Tracker that runs on modern operating systems. At first I used it just to lay down basic drum tracks to record my guitar and vocal parts on top of, but when I discovered a musical competition called HastyCompo on the Schism Tracker forum, I could not resist the temptation to make some full fledged tracks again.

Why game music?

You are play testing your platform game. You’ve spent ages coding complex algorithms, fixing bugs and designing challenging levels. You’ve hired someone to do some great graphics for your game.

The game is fun; it has well balanced goals and smooth game play. You feel like it’s almost done. Yet, you can’t shake that feeling that something is missing; something that breathes life into your game, but what? Well, it’s the music, baby!

Almost every classic game has memorable music. Even years after playing a game, people may still remember its music. Well composed music can create a certain atmosphere for a game, or a particular mood for a level. Music enhances the overall gaming experience.

In this article I’m going to give an overview of different types of game music and how it’s made. For the purpose of this article I made a short piece of music that could be used in a game, and I’m going to explain how I made it. After reading this article you should have an idea of to go about making your own game music.

Here is René’s finished piece, Wildbunnies.

Music file formats

There are various types of digital music formats. What type of file format you want to use in your game depends on the platform your game will run on and what software libraries are available to you.

Wave/MP3

Simply put, a wave file is a digital capture of an analog sound wave. You could record a band playing live music with digital equipment and save it as a .wav file. Or you could create music with some kind of audio software and export it as a .wav file. Here’s an example of a sound wave:

A problem with .wav files is that they are quite large. A .wav with a length of one minute will be approximately ten megabytes in size. In these days of hard disks with terabytes of storage space this does not present a huge problem while editing the audio. However, it does present an obstacle when sharing the files. You don’t want your Flash game, or your mobile app to come with hundreds of megabytes of .wav files. It would take too long to load and eat up too much bandwidth.

A solution to this problem is to use compressed audio, of which MP3 is probably the best known format. At a compression rate of 128kb/s one minute of audio will take up approximately one megabyte. That’s acceptable in a whole lot of cases. However, it may still be too big for your Flash games or your mobile apps, especially when you want use multiple songs in your game.

Calculating .wav and MP3 sizes

MIDI

Another well know music file format is MIDI. This is a format for sequenced music. MIDI serves as a protocol between musical devices. For example, it can be used to let a keyboard communicate with a synthesizer. MIDI commands can be saved as a MIDI file, with the extension .mid. Examples of software applications to create MIDI files are Logic and Cubase.

MIDI files do not contain digitized samples. Instead they contain information about which instrument to play, at which pitch, with what kind of effect(s) and at which specific moment. Think of it as a digital music sheet. How the song will actually sound depends on the device on which the file is played.

An advantage of MIDI files is that they are quite small. An average size for a MIDI file is around 30kb. This makes the files easy to transport. A downside of the format is that the quality of the playback can vary between devices. It may sound great on a high quality synthesizer, yet sound crappy on a cheap laptop. Also, the composer is limited by the standard set of instruments MIDI offers. It is not possible to use, for example, any recorded vocals or acoustic guitars in a MIDI file.

Wikipedia page for MIDI

Modules

Music modules are a hybrid between the sequenced type of music files like MIDI and wave files. Like MIDI files, modules contain specifications about what instrument to play, at which pitch, using which effects, and so on. However, they also include the actual samples to play, to ensure that the composer has control over the final sound. The samples are usually short, one shot sounds (like bass drums, snares) or samples that are looped to emulate a sustaining note (like strings, leads). This way, modules can be a lot smaller than .wav files and MP3s.

(Screenshot of Sound Tracker from http://hardcoregaming101.net)

Software applications to create modules with are called ”trackers”. Some famous trackers for PC are Scream Tracker, Fast Tracker and Impulse Tracker. Amiga users may recognize the names of Noise Tracker or Sound Tracker (pictured above). Music modules created with trackers are often referred to as “tracks”.

Modules give the composer a lot of creative freedom as any sampled sound can be used in a composition. However, creating a module is a time intensive process as most of the effects and other options have to be put in manually.

Wikipedia page for Module files

Selecting format and software

Before you create any music you should think about which format your music is going to be in and what software (and perhaps hardware) you’re going to use to create the music. Obviously, if you’re going to make an MP3 you have different options than when you’re creating a 4-channel .mod file.

FLOD and XM

I am going create a piece of music that is playable with FLOD. This is a set of JavaScript and Flash/AS3 libraries written by Christian Corti. This way the music can be played in a Flash game. FLOD can play various types of tracked music; the most advanced being a type called XM, which stands for eXtended Module.

(Picture taken from http://www.photonstorm.com/flod)

The XM format was introduced by a program called Fast Tracker, which was first created in 1993 and developed up until 1997. Unlike the .mod format which supports up to 8 channels, XM supports up to 32 channels. This gives us a lot more room for musical creativity.

Unfortunately, Fast Tracker doesn’t run well on modern hardware. However, there’s a program called Milky Tracker which is an open source remake of Fast Tracker, emulating its behavior and interface as close as possible. With Milky Tracker it’s possible to create XMs on modern hardware. It runs on various operating systems.

Chip tunes

It is possible to create a huge XM by using a lot of high quality samples. However, the idea of using the XM format is to save space, so we will try to make a small file. Modules files that are very small are called “chip tunes”. There is no clear definition of how small exactly a module has to be for it to be called a chip tune, but we will aim for a size of 128kb or less. To achieve this we will use very small 8-bit samples, sometimes no larger than a few bytes, which will be looped to create synthesizer-like sounds.

Creating music

And now to the fun part: making some music!

Inspiration

We start up our tracker of choice, in our case Milky Tracker, and then what? Where do we start? What’s our inspiration?

Inspiration can come from many things. If we are making music for an existing game, our inspiration will come from that game. Suppose we write music for a level of a platform game that plays in a dark, under water cave. It will probably end up sounding different from music for a level that plays in the sun-scorched desert. Visualize the scene for which you are writing music, and try to capture the feeling it gives you. Come up with musical techniques that match the mood you want to create.

Title

We will be creating game music, but the game in question does not really exist (yet). So we have to find another way to visualize a scene. What I like to do is coming up with an inspiring title. In this case, the title of our track will be “Wild Bunnies”. When I think of “Wild Bunnies” and convert these emotions into words, what I come up with is: up-tempo, groovy, funky, sweet and happy.

Musical ideas

Up-tempo means the track should be reasonably fast, but not super-fast. I’m imagining the wild bunnies happily hopping around, but not running for their lives. Groovy and funky imply the track should have some sort of “swing” feel, with plenty of syncopation or off beat emphasis and a recognizable, melodic bass line. Sweet and happy mean upbeat melodies, a major key and avoiding harsh sounds.

We don’t have to force all ideas into the tune. Some concepts might not even go together very well. However, these things are just used for inspiration, to have something to start off with. During the actual creation of the tune we might decide to go in a different direction and perhaps use just a few of these ideas, or maybe even none at all.

Selecting a sample set

Once we have an idea what kind of tune we will create, we should start selecting a set of samples. Instruments can be divided into four categories: rhythm, bass, chords and leads.

Rhythm

Instruments that fall into the rhythm category are bass drums, snares, hi-hats, toms, cymbals, congas, tambourines, shakers, etc. Any percussive instrument can be used to form part of the rhythm section.

Bass

This is usually a bass guitar or some kind of synthesizer bass. The bass line is often forgotten by inexperienced composers, but it plays an important role in a musical piece. Together with the rhythm section the bass line forms the groove of a song. It’s the glue between the rhythm section and the melodic layer of a song.

Chords

Chords can be formed by any instrument that has the ability to play multiple notes at the same time, such as a guitar or a keyboard. Chords can also be formed by several instruments playing simultaneously, like strings or a horn section.

Lead

The lead is the instrument that plays the main melody, on top of the chords. There are many instruments that can play a lead section, like a guitar, a piano, a saxophone or a flute. The list is almost endless. There is a lot of overlap with instruments that play chords. Often in one piece an instrument serves both roles. The lead melody is often played at a higher pitch than the chords.

Copyright

If you are making a tune purely for your own enjoyment, you can take your samples from anywhere. However, if you are creating a piece of music for commercial purposes you cannot use any samples without permission by the author. If you are using samples from internet sites or from sample CDs make sure the license gives you the right to use those samples in commercial works. You may take samples from existing modules only if the author gives you permission to do so.

Recording

You can create your own samples by playing an instrument like a guitar or a piano and recording it. You need some good equipment to record with, an instrument and the ability to play it! You could also sample sounds from a keyboard or a synthesizer.

Generating samples

Another way to get samples is to generate them using a tool. This is actually done a lot for chip tunes because you can make some very small samples this way. Milky Tracker has some great options to facilitate this.

Basic wave forms are: saw tooth, triangle, square and sine. Each of them has a different sound. Experiment with them by playing them at various octaves. You’ll be surprised at how different a wave form can sound at different octaves. Some of them are great for bass sounds, other sound better as a lead instrument.

Drawing samples

You can use basic shapes wave shapes as samples, or alter them by using the Draw function of Milky Tracker. It’s also possible to draw a sample from scratch of which you can see an example below.

You can get some surprising sounding samples this way. Make sure the length of the instrument is set at a power of 2 (2, 4, 8, 16, 32, 64, 128, etc). This way the sample is tuned to a C and will sound in tune with other samples you may import, as long as those are tuned to C as well, of course!

Wild Bunnies’ samples

Over the years I have accumulated various license free sample libraries. Out of these I picked some drum samples that were sampled from a Linn drum synthesizer. These samples are short and snappy, which fit with the sound that I have in mind for this tune. I used the sample editor of Milky Tracker to remove some end tail of the “crash” sample, which was quite long, to save some disk space.

I used my own MicroKorg XL synthesizer to record a bell sound. I removed some end tail of this sample as well. The remaining samples are all created by using either the Generate function or the Draw function of Milky Tracker. None of them are larger than 128 bytes.

Tracking

Now, finally it’s time to put in some notes! Note that this article is not intended as a tutorial for Milky Tracker. If you want details about how Milky Tracker works please consult its manual. That said, some basic information about how to track in Milky Tracker is in order, especially since most trackers work in a similar way.

MilkyTracker docs

The basics

A track consists of a number of patterns. A pattern holds data about when to play which instruments, at which pitch, the volume of the notes and any effects. A pattern consists of 64 rows by default. The speed of the song can be set by global beats-per-minute parameters, or altered during the song through effect commands. The track has an order list which tells in which order to play the patterns.

Milky Tracker uses the hexadecimal system for most of its numbers, such as volume commands. In the hexadecimal system numbers go from 0 to F. This may confuse people who aren’t well versed in math (like many musicians), but it’s not very complicated once you’re used to it.

This is the top part of the screen you will see after starting Milky Tracker. The arrow at A points at the pattern order list. As you see, the patterns don’t have to be in numerical order. This song starts with pattern “00″, then pattern “02″, then “03″, then “01″, etcetera. Patterns may be repeated throughout a song.

The B arrow points at the song title. Below it are the global BPM and speed parameters. These determine the tempo of the song, unless the tempo is altered through effect commands during the song.

The C arrow points at the list of instruments. An instrument may consist of multiple samples. Which sample will be played depends on the note. This can be set in the Instrument Editing screen. Most instruments will consist of just one sample, though. The sample list for the selected instrument can be found under arrow D.

Main editing screen

Here’s a part of the main editing screen. This is where you put in actual notes. Up to 32 channels can be used, meaning 32 sounds can play simultaneously. The first six channels of pattern “03″ at order “02″ are shown here. The arrow at A points at the row number. The B arrow points at the note to play, in this case a C4. The column pointed at by the C arrow tells us which instrument is associated with that note, in this case instrument #1 “Kick”.

The column at D is used (mainly) for volume commands. In this case it is left empty which means the instrument should play at its default volume. You can see the volume column being used in channel #6.

The E column tells us which effect to use and any parameters for that effect. In this case it holds the “F” effect, which is a tempo command. The “04″ means it should play at tempo 4 (a smaller number means faster). A comprehensive list of effects can be found in the Milky Tracker manual.

Base pattern

When I create a new track I start with what I call the base pattern. It is worthwhile to spend some time polishing it as a lot of the ideas in the base pattern will be copied and used in other patterns. At least, that’s how I work. Every musician will have his own way of working. In “Wild Bunnies” the base pattern is pattern “03″ at order “02″.

In the section about selecting samples I talked about the four different categories of instruments: drums, bass, chords and leads. That’s also how I usually go about making the base pattern. I start by making a drum pattern, then add a bass line, place some chords and top it off with a lead. This forms the base pattern from which the rest of the song will grow.

Drums

Here’s a screenshot of the first four rows of the base pattern. I usually reserve the first four channels or so for the drum instruments. Right away there are a couple of tricks shown here. In the first channel the kick, or bass drum, plays some notes. Note the alternating F04 and F02 commands. The “F” command alters the tempo of the song and by quickly alternating the tempo; the song will get some kind of “swing” feel.

In the second channel the closed hi-hat plays a fairly simple pattern. Further down in the channel, not shown here, some open hi-hat notes are added for a bit of variation.

In the third and fourth channel the snare sample plays. The “8″ command is for panning. One note is panned hard to the left and the other hard to the right. One sample is played a semitone lower than the other. This results in a cool flanging effect. It makes the snare stand out a little more in the mix.

Bass line

Here’s a look at the first part of the bass line.

There are two different instruments used for the bass line. Instrument #6 is a pretty standard synthesized bass sound. Instrument #A sounds a bit like a slap bass when used with a quick fade out. By using two different instruments the bass line sounds a bit more ”human”. The volume command is used to cut off the notes. However, it is never set to zero. Setting the volume to a very small value will result in a reverb-like effect. This makes the song sound more “live”.

The bass line hints at the chords that will be played and the key the song will be in. In this case the key of the song is D-major, a positive and happy key. I feel it is an appropriate key for “Wild Bunnies”.

Chords

The D major chords that are being played here are chords stabs; short sounds with a quick decay (fade out). Two different instruments (#8 and #9) are used to form the chords. These instruments are quite similar, but have a slightly different sound, panning and volume decay. Again, the reason for this is to make the sound more human. The volume command is used on some chords to simulate a delay, to achieve more of a live feel. The chords are placed off-beat making for a funky rhythm.

Lead

Finally the lead melody is added. The other instruments are invaluable in holding the track together, but the lead melody is usually what catches people’s attention.

A lot of notes and commands are used here, but it looks more complex than it is. A stepwise ascending melody plays in channel 13. Channel 14 and 15 copy this melody, but play it a few rows later at a lower volume. This creates an echo effect. A bit of panning is used on the notes to create some stereo depth. Like with the bass line, instead of cutting off notes the volume is set to low values for a reverb effect. The “461″ effect adds a little vibrato to the note, which sounds nice on sustained notes.

Those paying close attention may notice the instrument used here for the lead melody is the same as the one used for the bass line (#6 “Square”), except played two or three octaves higher. This instrument is a looped square wave sample. Each type of wave has its own quirks, but the square wave (shown below) is a really versatile wave form.

Song structure

Good, catchy songs are often carefully structured into sections, some of which are repeated throughout the song with small variations.

A typical pop-song structure is: Intro – Verse – Chorus – Verse – Chorus – Bridge – Chorus. This is the structure that is also used in “Wild Bunnies”.

The chorus usually has more energy than the verse and often has a memorable melody line. As the chorus is repeated the most often during the song, it will be the part that people will remember.

The bridge often marks a change of direction in the song. It is not uncommon to change keys in the bridge, or at least to use a different chord sequence. The bridge is used to build up tension towards the big finale, the last repetition of chorus.

Of course, this particular song structure is not mandatory. Game music is often more free-form. Feel free to deviate from this song structure as you please, but do think about what parts you are going to repeat and what you are going to change in the arrangement when a certain section is repeated. Clever use of repetition keeps the listener interested in the song.

Dissecting Wild Bunnies (not as gross as it sounds)

Listen to the piece above

Now, let’s take a more in-depth look at the song.

Intro

The first two patterns – order “00″ and “01″ – introduce the foundation of the song. This is the base pattern without the lead melody. The chords used here are D major and A major. A “stop” halfway the second pattern warns the listener of a change to come. At the end of the pattern the toms, as well as the ascending bass line take the listener into the next part of the song, the first verse.

Verse

From order “02″ to “05″ we find the verse of the song, playing a simple, but effective melody on top of the D major and A major chords. Notice how the chord progression in the last pattern subtly changes to let the progression “end” halfway the pattern. This is called a closed chord progression. The lead melody of the next section already starts to play at the end of order “05″, easing us into the chorus section of the song.

Chorus

The chorus starts at order “06″ and lasts until order “09″. It uses different chords than the verse. The chorus modulates to G major, with the chord sequence being G/D/Em/C. Notice how both the bass line and the chords stabs change melodically and rhythmically. Some sustained chord pads are added. The lead melody is played with a different instrument and is more complex than the melody of the verse.

In the picture above a part of the main melody is shown. Note the “3” command at the end of the melody line. This is a portamento, or bend, effect. It’s an effect commonly used on lead instruments to make the instrument sound more human.

The pattern in order “09″ ends with some toms to signify the end of the section. The last chord of this pattern is changed to an A major which sets up a modulation back into the key of D major for the following section.

Repeating verse and chorus

Order “0A” to “0D” are a repeat of the first verse (order “02″ to “05″), but the melody is now played with a second melody line on top of it playing a fifth higher making the song more varied.

The patterns in order “0E” to “11” repeat the chorus. I felt the melody of the chorus was strong enough to reuse this section without any variation. Only the last pattern is altered slightly to allow for the lead melody of the bridge to start off.

Bridge

The bridge runs from order “12″ to “19″. At the start of the bridge the energy level of the track is toned down a little by making the drum track a little simpler, removing some of the hi-hats and the snares, and having a simpler bass line. The main melody is fairly simple and ends on faded note, adding to the more relaxed feel of this section. The chords used here are a little more complex, the chord sequence being Bm/Bm/Asus7/A7/Em7/Asus7/A7/Asus7. The energy picks up when the snares return in order “14″, as well as the bass line getting busier. From order “16″ the bells take up a more prominent role and the synthesizer lead melody disappears.

Final chorus

From order “1A” to “1D” we are in the last chorus section, where the bell section from the bridge continues to play. The final pattern of this chorus is altered to create a closed chord sequence.

As this song is intended to be played during a level of a game, it should loop. Note the “B02” command at the end of channel #1. This command loops the song back to order “02″, the start of the first verse.

Closing words

Hopefully this article has given you an idea how music modules are made and how you can start making your own music if you want to. Be forewarned that creating music in a tracker may take a lot of time, especially when you are not yet familiar with the software. The nice thing about tracked music is that you can open other’s people modules and see how they did it. If you are interested in listening to more music modules visit the ModArchive, the largest store of music modules on the internet.

René Wiersma

Thank you René

Thanks for an excellent and informative article!

Buy the track

If you would like to purchase this module for use in your own games you can do so. The licence allows you to use it any number of times in commercial products. Its in .XM format which should be playable by all the major libraries such as FLOD.

It comes in at impressively small 107KB, which is some 7 times smaller than the MP3 version on this web-page. Add to that the fact that the .XM version actually loops perfectly and it becomes an even greater saving.

USD 49.99

If you’ve ever tried to find a tracker mod that you can actually legally use in your own games, you’ll know that this represents excellent value – finding a good composer with the technical skill required to pull this off is really hard :)

I absolutely adore tracker mods because they not only sound great, but they represent a dying art form – a digital triumph in human driven musical compression.

Until next time, have fun!

Cheers, Paul.

Submit to StumbleUpon

About Paul Firth

A games industry veteran of ten years, seven of which spent at Sony Computer Entertainment Europe, he has had key technical roles on triple-A titles like the Bafta Award Winning Little Big Planet (PSP), 24: The Game (PS2), special effects work on Heavenly Sword (PS3), some in-show graphics on the BBC’s version of Robot Wars, the TV show, as well as a few more obscure projects.   Now joint CEO of Wildbunny, he is able to give himself hiccups simply by coughing.   1NobNQ88UoYePFi5QbibuRJP3TtLhh65Jp
This entry was posted in Chip tunes, Music, Platform game, Technical and tagged , , , . Bookmark the permalink.

7 Responses to Composing in-game music – retro style

  1. Thanks René, that was an interesting article. For our last game (Voxeliens) I did almost all of the programming and art myself, but music was the one area where I simply wouldn’t have known where to start. In the end I just found some royalty-free chiptune music and used that. I’m still not sure I’d actually attempt the process myself but it’s useful to know what goes into it.

    Do you have any other samples of your work? We’ve not actually got a project at the moment, but we expect to work on another 3D retro-style game in the future and it’s always worth knowing people with relevant skills. Especially local people as I also live in Groningen :-) Sorry I don’t speak Dutch though…

  2. Rene Wiersma says:

    Hi there David. I’m glad you liked the article. So, you’re in Groningen too. What a small world it is sometimes!

    You can find some samples of my work here . The samples are wave files of approximately 40 seconds. The tunes were all originally created with Schism Tracker.

    I’d be happy to create music for any project you might work on. I’m sure Paul could exchange our email addresses :)

  3. GD says:

    Download link for all game musics http://gamemusics.co.cc/

  4. Hey guys!

    A blatant pitch since I’d like to think I’m part of the fore-mentioned dying breed :-) If you need more music in old-school format I’m absolutely available!

    My portfolio is under heavy reconstruction, unfortunately… but here’s my latest C64-chiptune: http://www.youtube.com/watch?v=k7qEOAgvBX0

    I can do practically anything from modules of different flavour (.mod, .s3m, .xm, .it etc) to even native chip format of various 8-bit machines. Can practically emulate any machine with distinctive sound: NES, SNES, C64, Amiga, Adlib, Megadrive/Genesis etc.

    I decided to go on my own way after working for others for too long in game biz and hopefully someone needs my services :-)

    Cheers!

    • Paul Firth says:

      Hi Markku,

      I don’t usually allow self promotion comments on the blog (I get a lot of spam), but in this case I’m going to allow it because its relevant to the article and because I love to help out anyone who is associated with the chip-tune scene :)

      Cheers, Paul.

  5. Hi Paul,

    Love Rene’s chiptunes: Wildbunnies.

    I’m an indie mobile game developer from Indonesia.

    Glad that I found your post here when I’m looking for chiptune composer.

    Would you like to share my email address with Rene?

    Thank you so much!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

WP-SpamFree by Pole Position Marketing