How To Create Seamless Audio Loop For Your Game

Creating games involves a lot of problems, and creating a seamless audio loop clip is one of these. For example, you need some ambient background sound clips to bring your scene to life, or you need a nice car engine "Vroom~" sound.  When I started trying to figure out how to do this, I feel really awkward. Luckily, I found a simple solution. Now, I am trying to explain in plain, in simple form. (The software I used is Ocenaudio, it is cross-platform and free, you can download at here: http://www.ocenaudio.com.br)

I'll use a 10 seconds rocket thrusters sound clip in example.

Step 1: Trim

10 seconds is a bit long and we don't need. So at first, we should trim this clip to a shorter one, about 4 or 5 seconds is enough:Screen Shot 2016-01-14 at 9.42.21 PM

after trim:

Screen Shot 2016-01-14 at 9.42.44 PM

Now this clip is clamped to about 5 seconds. But if you play this clip, you will hear a obvious  "glitch",or "gap" or "pzzz" at the end and begin of the clip. So we can't use it for now, and we must fix it.

Step 2: Break the clip in the middle.

To fix the problem above, we should break the clip in the middle. At first, we select the first 1 second of the audio clip, then cut and paste at the end of the clip:

Screen Shot 2016-01-14 at 9.43.55 PM

Screen Shot 2016-01-14 at 9.44.37 PM

The purpose of this step is to ensure the audio loop is continuous at the very end and begin of the clip. Now, if you play the audio clip, you will notice there is no glitch when the progress bar reach the end of the clip and back to the beginning. However, you will also notice you create a new glitch in the middle: where the very location you just cut and paste. Because you just broke the clip into two segments, joined the end of a segment with the beginning of another segment, it created discontinuity at this point.

You may also find there is a strong peak at the join point in the Spectral View. The reason of the peak exist is there is a abrupt change of the audio wave, create a high frequency part in this location.

glitch

How to eliminate this peak? Maybe using low pass filter (the "Gaussian Blur filter " for audio wave)? Sorry, you can't use low pass filter to fix this problem because you will create glitch at the very end and beginning of the clip. Ahhh!

Step 3: Prepare to blend two segment.

Unluckily, you can not remove the high frequency part directly in this software (But you can use Adobe Audition to remove it instantly). So, we have to blend two part of the clip seamless. Now, select the part after join point for 0.5s long:

Screen Shot 2016-01-14 at 9.47.41 PM

and apply Fade In effect. The volume of audio in this part will change zero to normal gradually. (Sorry, I just find forgot taking a screenshot)

And select 0.5s of clip before the join point:

Screen Shot 2016-01-14 at 9.49.15 PM

Apply Fade Out effect, let the volume change from normal to zero.

Step 4: Cross fade two part of the clip

Now, it's time to blend two segment. Select all of the part after the join point:

Screen Shot 2016-01-14 at 9.50.53 PM

Cut it to pasteboard. And locating the pointer to 0.5s before the join point (now the join point is the end of this segment):

Screen Shot 2016-01-14 at 9.51.35 PM

then, overlap the part in your clip at this point (use Paste Special function of Ocenaudio). Since this audio clip is just about a kind of noise (sound of rocket thrusters), we can overlap safely without worrying other things:

Screen Shot 2016-01-14 at 9.51.59 PM

Done!

Now it should have no obvious glitch or gap or other "strange feeling". And you can use it in your game project directly.