It's fairly normal for the audio playback mechanism on any platform to produce ticks like this when stopping and restarting the audio. To avoid this problem, instead of abruptly stopping playback by calling stop
, you should first ramp down the volume from 1.0 to 0.0 over a short period of time (a few milliseconds is plenty), and then stop
or pause
. When you resume playback, you would reverse the process by ramping the volume back up from 0.0 to 1.0.
Sorry, I don't know enough iPhonistics to tell you how to do a timer-based operation like this. I am surprised that the AVAudioPlayer library doesn't do this already, but there are other audio APIs out there that I'm sure do.
Update: On second thought, forget it. Ramping the volume down with a timer is a horrible idea and won't work. You'd need a much higher-resolution timer than is possible to avoid a stepping-down effect, which would produce a series of ticks and pops instead of just one.
Use some other API.