Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looping AVAudioPlayer w/o Gap

I'm recording a sound using AVAudioRecorder and then attempting to play back the sound using AVAudioPlayer. I'm trying to get the sound to loop indefinitely, but the sound has a short gap in between loops. I've tried recording the AVAudioRecorder recording to all possible file types, yet I can't find something that will allow seamless looping. Thanks.

like image 624
Daniel Norman Avatar asked Dec 15 '12 06:12

Daniel Norman


1 Answers

This is a great post that helped me eliminate loops in my AVAudioPlayer implementation: http://forums.macrumors.com/showthread.php?t=640862

the gist of the post is that compressed audio adds blank sound to pad out the length of the sample to an even multiple of 1024. Using uncompressed audio, or audio that is specifically output for the purpose of looping will eliminate the glitch.

like image 79
Ian Hoar Avatar answered Sep 30 '22 15:09

Ian Hoar