Realtime Audio Switching for iPhone

I am trying to find the best way to play a seamless loop of audio that a user can turn off for another as soon as possible, with an available number (30-150) of very short loops. Will OpenAL suffice for this, or do I need to delve into audio devices? Apple Documentation says that for real-time feedback, such as a tool, Audio Units is the right choice.

I just want to get a community opinion about this, and any links and sample projects would be welcome.

+5
source share
4 answers

You can use AVAudioPlayer to seamlessly loop the compressed audio file (numberOfLoops = -1). I suggest using IMA4 encoded CAF files, as they are rumored to use hardware decompression (saving CPU cycles for other things).

To reduce the file size, you can reduce the data transfer rate (try 96 kbps) and / or use mono.

Please note that AVAudioPlayer does not allow you to change the tempo or frequency of playback.

+3
source

this probably doesn't really answer your question, but have you ever looked at Finch ? Just looking at the source, you can indicate some pointers.

  • Johannes
+2
source

, OpenAL. AVAudioPlayer .

, prepareToPlay, . , 30-150 , , , .

OpenAL AVAudioPlayer: http://kstenerud.github.com/ObjectAL-for-iPhone/documentation/index.html#choosing_sec

+1

I ended up using the Cocos2D audio library for this, and it was much more productive than I expected. AVAudioPlayer turned out to be good to a level lower than I need.

0
source

All Articles