Hi guys, quick query here, Need to make some sounds for a client loop seamlessly in his game. Edited them fine as wav files in Pro Tools so they loop ok, but when saved as mp3 at clients request a tiny silence gap is added. Most annoying! Anyone know a way of removing this gap or is it inherent to mp3? Shall I tell the client to use ogg or wav instead? Cheers! Andy
The gap in mp3 files in inherent of the way they are encoded. I have seen that its possible using some 'hacks' and other software to remove this gap, but tb honest it seems like more hassle than its worth!
If the game is for iOS, your best bet is to probably use AAC, as its a well supported by apple and capable of looping seamlessly. I've found the easiest way to deliver AAC files is to use itunes to convert WAV to AAC, its also possible to check looping in itunes easily and have some reassurance that they will loop well on an iOS device.
I think it is because mp3 files contains data blocks of predetermined sizes, so if the length of your loop isnt an exact multiple of the block size then the mp3 encoding will add silence.
The only tool i have successfully used for looping mp3 files is part of the Miles SDK, which is a game audio engine made by RAD Game Tools.
Looping MP3s is possible, just very hard. This is the info you're looking for:
Basically you have to pad (stretch) your audio to a specific length where the number of encoded samples will give you N whole frames. It's achievable, just plenty of hacking.
Looping WAVs is very easy. On some platforms, you can save 4:1 compressed WAVs with little sacrifice in quality. Those files loop just as easy.
Not all players/platforms support gapless playback so may testing be on your side.
Whenever you do any conversion that might resample audio it can change where your zero crossings occur which could affect how well the audio loops. If you are able to work with the mp3 in an editor as opposed to working with a wav and exporting it as an mp3 I think you should be able to make it loop properly.
The way I understand it to be is that the mp3 format is frame based, rather than sample based like wavs. Much like how video editing can't make cuts smaller than a frame, an mp3 outside of the DAW is, as Haydn pointed out, organized in blocks. For seamless loops, I would definitely go with another format.