Reputation: 71
I have the music looped and everything is working as it should, but for some reason the looping background music has a clicking noise and a stutter at the end of the loop. Has anyone else had this issue and if so how did you rectify the situation?
I used Logic Studio 8 for the sound file with no open mics, So I know it's not the sound file.
NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/theeye3.caf", [[NSBundle mainBundle] resourcePath]]];
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:NULL];
audioPlayer.numberOfLoops = -1;
[audioPlayer play]
Thanks.
Upvotes: 3
Views: 1556
Reputation: 11
Yes, this is usually because your sound file is compressed, and thereby not having the ending point amplitudes at the exact same level. I have the same problem in a game, my solution was to add a sound effect (which is parts of the looping menu music anyway) to play 0.3 secs before the looping. It actually covers the problem.
Upvotes: 1
Reputation: 3706
Have you tried looping it in an audio editor to make sure that the problem is not with the sample itself? If the sample doesn't start and end on a zero point you may get clicks.
Upvotes: 1