I'm trying to play a very small audio file - it's roughly 0.05s in length, and it's an uncompressed .wav file.
Rgiht now, I'm using AVAudioPlayer
to play the sound.
I intend to play the sound with high rapidity alongside a spinner, a la The Price Is Right or Wheel of Fortune. If I instantiate the AVAudioPlayer
with a loop count of 100, it does indeed play the sound very rapidly as I'd expect.
If I execute [audioPlayer play]
on each 'tick' of the spinner, however, the audio falls terribly behind. My guess is that, unlike setting a high loop count, [audioPlayer play]
requires complete setup and teardown of the audio clip's memory for each playback.
Is there any way to force the clip to remain set up in memory for a longer duration? It's a very frequent sound, and as such would also be okay with keeping it up during the entire app run.
If you depend on more precise timing, you might want to try using one of the other sound APIs. Audio Unit RemoteIO is complicated, but allows the most precise timing of playing uncompressed sounds. OpenAL and Audio Queues are two other options.