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开发者_如何学Python when looped? Which ones?
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.
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.
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.
精彩评论