views:

2090

answers:

3

What is the best way to accomplish this?

From what I have read so far, it seems you have to setup IO Remote (which is a pain itself). Do you need to do a FFT? Are there any examples out there?

Can I just speed up / slow down playback?

Thanks

A: 

I've never developed for an iPhone, but if you have sufficient control over the buffer sent to the audiodevice, then you could do the following:

say you have a buffer read from an audiofile, if you send only every even sample to the audiodevice (probably put in some other buffer which is passed to some function), then it will double the frequency and half the time to play the file.

If you want something in between you need to compute in between samples or resample the audiofile = interpolate values between successive samples.

Emile Vrijdags
+1  A: 

OpenAL lets you pitch-shift with the AL_PITCH source property. Maybe you could run your audio through OpenAL and use that.

invalidname
+1  A: 

For archive spelunkers, see also this stackoverflow question, which appears to ask the same question, offer some tutorials, and has more voting than this one (which is why I'm doing the redirect in this direction.)

NOTE: I've not tried the proposed solution yet but, after a bit of searching, this seems a good answer. I'll try AL_PITCH, too, and vote that one up, if it works.

Olie