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
8 Answers
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.
-
That's great! Cheers for the tip :) Another reason to hate mp3 lol Commented Jul 1, 2011 at 14:47
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:
http://www.compuphase.com/mp3/mp3loops.htm
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.
-
Thanks for the reponses guys! In the end I just sent wav, ogg and aac formats. MP3 was too much of a PITA!lol Commented Jul 4, 2011 at 12:21
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.
-
I tried editing the mp3 in an editor too but to no avail. Will try downloading mp3 trim and give that a go Commented Jul 1, 2011 at 15:24
If it's for a flash game (which would explain the mp3 format), there are ways to make it loop seamlessly using AS3 code... IMO it's your client's problem, not yours. :)
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.
If your client insists on using MP3s and the game engine can handle it, you can always do a hack with two mp3s (with fade-ins and -outs) and switch them back and forth so no gap is heard in the game.
Hello Andy, it depends by the format (mp3). All seamless loops I did for games were ogg-vorbis encoded