I have heard, and tried myself, and it seems that .mp3's have a gap whenever you made to loop in iOS. Are there any audio types that don't have a gap when looped? Which ones?
If you're using AVAudioPlayers, I would recommend using uncompressed .aiff or .wav files if you can get away with the file size. If file size is an issue, an m4a wrapped as a .caf file would be your best bet. But you're right, MP3s just don't loop seamlessly with AVAudioPlayers.
-
Thanks, Mark! I just converted it to a .wav instead of .mp3. It works! – xcode newbie Sep 16 '11 at 2:48
-
1Glad it worked for you! @coneybeare - You're right that I overstated things by saying "MP3s just don't loop seamlessly". What I should have said is that MP3s don't loop seamlessly without additional processing. – Mark Armstrong Sep 16 '11 at 3:56
I loop mp3's seamlessly in my app Ambiance. You just have to process them before hand to alter the header info with the right amount. You can find out more about the process, and the easy encoding here
Other than mp3, you can loop any uncompressed audio such as wav, caf etc… Just ensure that the source is indeed a seamless loop.
-
I guess I could alter header info and all that (more complicated and time consuming), or I could just use a .wav. That's what I did and it works. – xcode newbie Sep 16 '11 at 2:49
-
mp3loop is a simple exe you run that takes about 5 seconds. If you are ok with the gigantic filesize of a wav then no need to bother – coneybeare Sep 16 '11 at 3:08
-
-
That is quite large. In fact, it makes up 5% of the 20mb that your app has to be under to be downloaded over the air. – coneybeare Sep 16 '11 at 3:28
-
Actually, it is the only sound in the whole app and there are only a few images. The whole app totals up to 6.4 Megs which is not very large. How long does it take to download 6.4 Megabytes? One minute, maybe? – xcode newbie Sep 16 '11 at 3:43
I struggled with this for a long time, tried converting to wav, tried using mp3 looper, nothing was working until I found that AAC can loop without gaps using AVAudioPlayer.
You could use a wav, caf, aiff, or whatever, or you could process it first to make it work.