Make Loops that can be Randomised
In game audio it is essential to create variations of one-shot sounds like footsteps so that the player doesn’t find them repetitive or distracting. Whilst not the most common approach, we can do the same with looped sounds by creating a set of loops that all seamlessly connect to one another. This allows us to randomise the playback order and therefore create more possible variation. This approach often works better than simply creating a single really long loop.
The typical way to create a loop for use in a game is to take our audio file and make an edit in the middle. Then, we can swap the two sections over, so that the start now becomes the end. This ensures that the audio file will loop perfectly as the end point will perfectly lead into the beginning. Then, we add a crossfade so that there is no clear edit in the middle.
Above: A basic loop created by swapping the first half and second half and adding a fade.
The key aspect of this that allows it to loop seamlessly is that the end of the file perfectly leads into the beginning. This is the trick we can exploit to create more loops that will still connect seamlessly to this basic loop we have already made. As long as we retain the very beginning and ends of our loop, it will loop seamlessly. So, we can edit out the entire middle section of our basic loop and replace it with different audio to create a new variation.
Above: A variation loop created by replacing the middle of the basic loop while fading into the same beginning and end.
You may think the start and end points will be noticeable as they are the same every time. However, by selecting the right moment and by having the fades go right up to the start and end points, we can make it very hard to notice this reoccuring material. It can also be beneficial to vary the length of each loop so that the loop point does not recur at a fixed rate.
If we have a looping sound that the player hears for an extended period of time, it can be worth it to implement loops that shuffle in this way so that there is more variation than an implementation that uses a single loop.
These assets can easily be implemented using FMOD Multi-Instruments or Wwise Random Containers.
If you would like to watch a video explaining this principle, here it is: