views:

833

answers:

2

I need audio playback with these features: good performance (for game), pitch control, and ability to layer the same sample multiple times at the same time (polyphony). What would be a quick way to get this on the iphone sdk?


Here's what I found out so far:

There's no available libraries or sample code that does this, please show me wrong.

SoundEngine.cpp (from CrashLanding and TouchFighter code samples) uses OpenAL and allows to control pitch, but everytime a buffer is started, if that same buffer is playing, its playhead goes back to the start.

One dirty solution to get polyphony with SoundEngine.cpp, without diving into its implementation (which is incomprehensible to me), is to load multiple buffers for the same sound file. Let's say I want a polyphony of maximum 4 voices per sound, then I load 4 buffers for the same file. I would just have to wrap it all up in a manager class. Is it safe to go down this path? And/or is there a way to hack the SoundEngine.cpp to be polyphonic?

+1  A: 

FMOD (www.fmod.org) provides all these features. Check out their virtualvoices sample for polyphony and the pitch shift DSP effect in the docs.

I'm just a customer, not otherwise affiliated with them.

kirkus
Thanks, I haven't had the time to try it out but the features are impressive.. Are you satisfied with the iphone implementation?
Steph Thirion
A: 

The SoundEngine from CrashLanding is a mess, I’d stay away from it. Writing what you want around OpenAL is not hard, it’s a few hours of work. You can peek at Finch or at the Cocos 2D sound egine.

zoul