Loading...

The blog is being migrated and merged with multiple Imphenzia blogs so the format and content will be inconsistent for a while.

Create seamless loops for game music

Making seamless loops is an essential part in creating music suitable for games. Loops will keep the distribution size of games to a minimum and it also makes the audio cheaper to license which is crucial for smaller indie game developers.

Although I've been making music as the trance artist "Imphenzia" for 14 years, which is starting to sound like a very long time also making me sound old, I've only been releasing music for games during the past 3-4 years as "Imphenzia Soundtrack." I mention this for no apparent reason at all, so lets move on.

I've created a video tutorial of how I go about when creating a seamless loop. In this case it's an orchestral movie-style piece of music that will be added to my library of non-exclusive music. I use Steinberg Cubase 5.5 and Sony Sound Forge 10 to create the loop but you will probably be able to replicate the steps in your sequencer and audio editor of choice.

Time for the tutorial - have a look at it and don't forget to watch it in 720p so you can read the options better.



I hope the tutorial helps you to create perfect seamless loops of your music. Some of the important things to stress are:

  • Repeat the music you want to loop three times in your sequencer, exactly 3 times down to the measure. Why? It's because you want to ensure a good loop including any trailing audio at the end of the music piece, it could be decay, reverb trails, and echo.

  • Export the audio to a Wav file (or a format of choice) and load it into a good sound editor.

  • Crop out the center third of the music, use sample precision to do this.

  • Remove any clicks by ensuring that the audio file starts and stops on 0 dB exactly (or infinitely low as Sound Forge describes it.) This is performed by fading in the start and fading out the end by only a few samples, 20-100 samples is usually suitable.


In the video tutorial I also mention a Javascript that I've created for Sound Forge that will perform the selection of the center third, cropping, and fading the ends to ensure a good loop point. This particular Javascript will be the topic of my next blog post so do come back soon.


Promoting my sound effects page

In order to boost the probability of people finding my new sound effects page I have created a script that automatically generats static HTML-files for every sound effect in the library. The script also creates a simple main index page for containing links to all the individual HTML-files so that the engine crawlers can find the individual pages correctly. It will be interesintg to see if this generates any additional traffic.

Here is what the index page looks like: http://www.imphenzia.com/soundtrack/soundeffects.html (click on a sound effect to see the generated indivudual pages too).

Protecting the site & AJAX

It's been  a long time since I've spent so many hours on something producing such a small visible result. First of all I had to learn all about protecting PHP code and form fields that are inserted into the database when logging in with mysql_real_escape_string and the joys of some servers having magic_quotes_gpc enabled and when stripslashes should and shouldn't be used. I've finally protected the code enough from malicious visitors - I don't want to end up like the old imphenzia forums once were if you remember those days. Since I already developed the login / logout / remember me features of the new sites yesterday, the 4 hours I spent on just protecting the code was just plain boring - but not wasted as the result is good and I learned something very useful.

Originally I used a javascript called "Live Validation" to verify the contents of form fields as you type in them and the result was quite cool - what it didn't support, however, was verifying on the fly that a username already existed or if invalid characters were entered. A friend of mine advised me about AJAX (Asynchronous JavaScript and XML) and this is something I find very exciting (sadly enough!). What AJAX enabled me to do (amongst a million other things) is to verify if a username exists in the database as a user is typing into the form field. If the user enters a username while registering that already exists, the web page will warn you that the name is taken - this all without submitting the form or using the tedious back button etc. Now then you might think - why waste so much time on learning this stuff as I may never have a huge amount of registered users on imphenzia.com - but my reply is that learning this stuff is extremely useful as fast and intelligent websites is the future.

I found out that when troubleshooting javascripts, FireFox with the extension 'firebug' is very useful for debugging when things go wrong. Firebug will display error messages and scripts neatly and in my case the AJAX feed that is returned. At the same time, I must admit that I very much prefer IE as a browser - mainly because it renders web pages much nicer and - and also because so many sites look incorrect in FireFox... and if you are a true FireFox fan you will probably explode now and say that all these sites look horrible because they were incorrectly developed, the fact is that they still look horrible regardless of who's fault it is hence me prefering IE :)

Well, I still have some work left to do with the validation method tomorrow and the easter weekend is nearly over. Once validation is finally taken care of I can move on to more fun stuff on the site such as the music section.