.mod in Unity

June 29, 2010 in Technology

MilkyTrackerAs of Unity 3.0, we are proud to give our users the possibility to use Module files for music and sound in their productions just as any other audio asset.

When I started testing Unity’s new audio features I had very little idea about what Module files are and what they could do. I asked our audio programmer, Søren, what it was and what I should look for, he replied that it is this tiny file format that allows for cool sound quality – “Just try it out”. And I must say, comparing the file size to the audio quality, I was amazed, thinking that this will impact online and mobile gaming experiences in a good way.

Tracker Modules are best known from the demo scene’s composers and the good old Amiga games’ sound tracks and I must admit that it brought memories from late nights playing my brother’s Amiga. The format can be described as being somewhere in between the well known, but declining, MIDI format and the concurrent PCM formats (including .aiff, .wav, .ogg, and .mp3).

The power of the Module files lies in the fact that they consist of high quality PCM samples that ensure a similar experience on all hardware. The files then contain additional info about when to play the sound, at what pitch, volume, effect, etc. This is where MIDI’s shortcomings are evident: MIDI sounds are normally dependent on the sound bank that are in the hardware that outputs the sound. Unity supports four major Module file formats: Impulse Tracker (.it), Scream Tracker (.s3m), Extended Module File Format (.xm), and the original Module File Format (.mod).

Why not use compressed PCM audio, you say. You can always do that if size and bandwidth are plenty, but if you want a fair sound quality you will still end up using around 1 mb of disk space per minute. Using a mod file you can use and reuse the same samples embedded in the file over and over again. A skilled tracker artist can create hours of high quality audio for 1 mb worth of samples, provided using the right tricks.

There is a substantial amount of artists creating music using Trackers. As mentioned, the majority have been making soundtracks on the demo scene for the past 20+ years. Many of these artists publish their music through net labels such as Monotonic, SLSK Records, and Bump Foot. It is also worth mentioning that these labels and artists often release under Creative Commons licenses, which mostly means that it can be used, remixed, and redistributed as long as the artist gets credits. A great way to get assets for indie developers – just remember to pay them if you earn money on their work ;-). Kudos to the artists for democratising their expressions this way.

Module files can be created using tracker software. Conceptually trackers work slightly different from conventional software sequencers such as Prologic, GarageBand, Cubase, etc. I encourage you to take a look at some trackers if you are making music. There are many free and open source trackers. Among these I can recommend the cross-platform MilkyTracker or OpenMPT if you sit on Windows.

Happy tracking! I am looking forward to see how you’ll use this feature.

Comments (30)

Subscribe to comments
  1. Søren

    April 30, 2011 at 8:53 am / 

    +1 on programmatic access to individual mod mod channels

  2. Michael L. Croswell

    April 4, 2011 at 9:25 pm / 

    I would also be interested in knowing when programmatic exposure to tracks will exist. Thanks!

  3. Thomas Grové

    March 14, 2011 at 4:06 pm / 

    Nicolaj: any idea if or when the ability to mute/unmute discrete mod tracks will be exposed?

  4. learn piano dvd

    August 8, 2010 at 10:39 pm / 

    Very interesting blog on Unity Technologies Blog » Blog Archive » .mod in Unity, not like the others!

  5. Jon Frisby

    July 12, 2010 at 9:19 am / 

    Just a minor and somewhat pedantic point:

    MIDI was not ever intended to be a format by which music was distribution to users for playback. That is considerably beyond its scope.

    What it is, is essentially a bus format for communication between audio production components. It defines channels that have actions that map roughly to the component elements of what happens when you play a note on an instrument. It is up the audio technician to to utilize those channels in a meaningful way. For example, you might map one channel from a keyboard’s main output to a chain of software synthesizers / modulators that actually produce sounds based on the notes. You might map a slider on a control surface to some arbitrary input on one of the modulators to deform and adjust the piano sound.

    By its very nature, it behooved the creators of the MIDI spec to NOT be overly specific because the point was to be a general purpose bus protocol that supported any number of wacky variations — the goal was interoperability within the realm of audio production by creating a command language that could be used and abused for more or less any such need.

    Yes, there are some weak conventions about what channels are used for what instrument and yes there are god-awful software synths that will ‘play’ a MIDI stream, but since it was designed to be application neutral it can’t meaningfully encode all the information needed for high-fidelity audio reproduction.

    It’s not MIDI’s fault that it’s an orange in an apple world. :)

    -JF

  6. Nicolaj Schweitz

    July 11, 2010 at 11:26 pm / 

    @Matt, MIDI has its uses and I am sure that interesting applications would appear if implemented in Unity. I’d recommend you take a look at this feature request: http://unity.uservoice.com/forums/15792-unity/suggestions/725952

  7. Matt

    July 10, 2010 at 8:47 pm / 

    I’m quite surprised by this. At the end of the day, midi (the format) is effectively a file format that describes music.
    Certainly not waning (it’s a description as opposed to lame PC synthesizers that attempted to generate sounds when directed by software that knows how to read midi).
    So, midi (the description) is compact, as the file format mentioned above is.
    Here’s the thing. What you’ve integrated is a sampling player that reads an obscure format. How to create the file? (and therefore the music) with equally obscure and not really practical tools.
    These days, there are plenty of audio engines that read midi files and play sampled instruments rather than using pure synthesizers. So nothing new there.
    The advantage of integrating an engine that reads midi and plays sampled instruments is that there are a great number of tools out there where you can hook up real midi keyboards and controllers (um, garage band comes with Macs for example) and create midi performances then choose what actually plays that file (your fancy studio sampled instruments, or lower bit rate sampler embedded in a game engine).
    I guess maybe this engine was easy to integrate for the sake adding a feature, but anyone wanting to add quality music to their game isn’t going to compose with the interface appearing above. They’ll do exactly then same thing as they always do to create music and if thismmodule doesn’t read midi files (or they can’t convert to it’s format) they just generate digital audio from their project.
    This feels like a negative post, but Im just surprised at the way this is pitched- it feels like midi is misunderstood.

  8. rfdowden

    July 6, 2010 at 12:44 am / 

    I just want to chime in about Renoise versus the older formats (.XM, .IT, etc.)

    While I love Renoise, I agree with what has already been said. Renoise is really a DAW. Its internal format isn’t for final output. Final output in Renoise is really meant to be some sort of PCM format with a final target of CD audio, WAV or MP3.

    The true MOD formats are great because small embedded players are possible whereas you would basically need Renoise itself to reproduce the sounds it tracks especially when you consider it uses VSTs.

    While renoise is a great DAW for people who love tracker interfaces, the older MOD formats are a real win for something like Unity because it lets us use a very small file with incredible portablity to create amazing music.

    MilkyTracker is awesome… it’s like a more modern FastTracker and produces excellent .XM files. It also works on practically every platform known to man.

  9. rfdowden

    July 5, 2010 at 11:19 pm / 

    This makes me more happy than you can possibly understand! Chiptunes FTW!

  10. polytropoi

    July 2, 2010 at 9:05 pm / 

    this looks awesome – how much of the mod format will be exposed and scriptable in Unity? Will it be possible to basically script all or most of the functions of a tracker?

  11. Azert2k

    July 2, 2010 at 3:07 pm / 

    Great News

    Mod Bank : http://modarchive.org/index.php

  12. mark

    July 2, 2010 at 1:42 am / 

    Will this mod playback functionality be present in the Unity3 iphone package?

  13. ImaginaryHuman

    July 1, 2010 at 6:25 pm / 

    Also, how long until Unity can compile to Windows/OSX screensavers, and iTunes visualizers? :-P

  14. ImaginaryHuman

    July 1, 2010 at 6:24 pm / 

    One thing you used to be able to do in the good old days was play a tracker module and also get access to the note data being played so that you could a) do things like music visualizers, and also b) get timing events so that you can synchronize graphics to audio events.. .. that would be neat…. maybe it’s already in place, but if not, that would be great :-D

  15. mzerod

    July 1, 2010 at 4:15 pm / 

    “@Andreas Rønning. I agree with your point about Renoise.
    Unfortunately FMOD does not support Renoise’s .xrns nor OpenMPT’s .mptm, which seems to be the next gen of tracker formats”

    I’d love to see the look on their faces when they see VSTs referenced. ;-)

    IMO Renoise is a DAW with a tracker interface and isn’t really compatible with the MOD-format ethos.

    Renoise has moved away from the module timing model, and as such automation is probably going to be difficult to convert back into MOD commands (think volume slides, a conversion would be chunky depending on the speed of the song, compared to the proper equivalent MOD command for a slide).

    Heck, you’d need a whole replayer to include all of Renoise’s built-in plugins i.e flanger, signal follower etc. the same goes for Madtracker.

    As an editor it’s great, it would be perhaps more realistic asking Renoise development to introduce a “classic” mode perhaps. For example, once you start a piece in classic mode, you are then limited to only MOD-compatible commands, and prevented from loading VSTis and 16 bit stereo samples :)

    You’ll probably still get a clunky conversion though :)

    Time to book up WinUAE with protracker or go newskool with the nice port of Milkytracker :D (or if you’re a Windows GUI person, OpenMPT is great).

  16. mzerod

    July 1, 2010 at 3:54 pm / 

    @Stefano Cecere: Editor? the main article links to Milkytracker, there is a port for your OS afaik.

  17. coda

    June 30, 2010 at 6:51 pm / 

    let me first say that i totally support using module music for games. probably even better for quality:size ratio than midi+DLS.

    so FMOD is the library you use to playback mod files? i remember trying to play back some songs in FMOD and, in addition to the fact that it is nearly impossible to find a standalone player which uses FMOD for testing purposes, all of my songs were broken due to poor .IT feature support.

    it’s actually hard to find any info about FMOD’s module playback compatibility because so few people use it for that nowadays (ironic given the name). libmodplug, DUMB, and BASS are the popular ones here, and more accurate than FMOD by far.

  18. Nicolo

    June 30, 2010 at 10:45 am / 

    Is there any place with a comparison of cpu and any other stat for different codecs used in Unity, using the same track (mp3, mod, ogg, wav, aiff)?

  19. Nicolo

    June 30, 2010 at 10:41 am / 

    Great news, now the next step for Unity3d 3.5 is to get the license I suppose and implement AAC HE V2, and high quality audio will be served at very low bitrate, a totally different level from Mp3, and relevant enough from OGG, especially at 48/64 kbps, at this rate, music files are a lot closer to tracker-based modules, just a bit more cpu, these days is not a big deal in most cases :).

  20. Nicolaj Schweitz

    June 30, 2010 at 10:37 am / 

    @Andreas Rønning. I agree with your point about Renoise.
    Unfortunately FMOD does not support Renoise’s .xrns nor OpenMPT’s .mptm, which seems to be the next gen of tracker formats – However, if you guys really want this, please join the feature request at http://bit.ly/90EZh0 and we can push the request to the FMOD guys. The more substantial the demand … etc.
    Until then, we have to rely on file conversion to the supported formats.
    I am really interested in how this turns out: how many will use mod files with Unity.

  21. Martin Schultz

    June 30, 2010 at 10:01 am / 

    Well written blog, thanks. I’m looking forward to include some nice mod files in my next webplayer game and shrink the size heavily. Good stuff!

  22. TornadoTwins

    June 30, 2010 at 7:09 am / 

    Wow, great article!! Really cool info!
    I was afraid .mod files were midi files, but fortunately the samples are embedded… awesome!
    So what software can export to .mod? Will Ableton Live let me?
    Cheers!
    -TornadoTwins

  23. Shiraz

    June 30, 2010 at 6:20 am / 

    I need to dig out all my old .mod files from my Apple IIGS programming days .. this is great!

  24. Stefano Cecere

    June 30, 2010 at 1:48 am / 

    @Andreas: with these MOD format we can have 32 tracks!
    i think the problem was about having some multiplatform licensed player code!

    i agree that MOD formats could be old.. maybe http://www.beatnik.com/ could have been a batter choice (but i don’t know if it’s still a “live” technology!

  25. charles

    June 30, 2010 at 1:17 am / 

    @Andreas Rønning: Unity supports four major Module file formats: Impulse Tracker (.it), Scream Tracker (.s3m), Extended Module File Format (.xm), and the original Module File Format (.mod). (as referenced in the blog post)

  26. Andreas Rønning

    June 30, 2010 at 1:13 am / 

    I have to admit guys, I’m very disappointed you’d implement MOD and not a more recent and flexible standard, such as XM (which still is incredibly old). 4 mono channels is brutally limiting for any musician, and in harsh relief to the perceived “next-gen-ness” of Unity 3.

    As someone who has been tracking music since the mid 90s, and having followed the evolution of that scene (currently using Renoise, a truly next-gen tracker), the prospect of returning to MOD makes me sad inside.

  27. Frederic RP

    June 30, 2010 at 1:13 am / 

    Well done !
    I’m so surprised that a -so old- file format can be the future somewhere, I’m looking for my old files right now ;)

  28. Lars Steenhoff

    June 30, 2010 at 12:32 am / 

    The nice thing about mod files you can change the volume on individual tracks and use this in game events.
    An example of this would be in the game Mario world. When mario jumps on Yoshi the sound gets added drums without skipping a beat. http://www.youtube.com/watch?v=1jIy608xw80&feature=related

  29. Stefano Cecere

    June 30, 2010 at 12:12 am / 

    wel.. shame on me.. a few days ago the link to MilkyTracker was broken and i could not check it.. just found that it launches well on SnowLeopard.. i’ll let you know how well it works!

    good work Unity.. looking forward for my 3.0beta ^^_^^

  30. Stefano Cecere

    June 30, 2010 at 12:10 am / 

    i was in the MOD music >20 years ago (on Amiga)
    now on OSX i can’t find a MOD creator (just players.. where VLC is quite the best)

    any idea?

    stefano

Comments are closed.