3

Is there an easy way to control the playback speed/tempo of a sound file loop played using Audio Queue Services? For example, if a game is playing background music, I want to make the BGM speed up as time runs out, but without changing the pitch of the music. Thx!

Rei
  • 1,148
  • 2
  • 12
  • 16
  • Nope, I did not find a suitably "easy" answer yet :-( and no time to try out the more complex hints. – Rei May 04 '10 at 20:36
  • With iOS 7 you can now do this with audio queues. See [this stackoverflow thread][1] [1]: http://stackoverflow.com/questions/6215061/audioqueue-kaudioqueueparam-pitch/18411436#18411436 – Wil Macaulay Sep 23 '13 at 12:58

1 Answers1

1

There's no trivial way to do this that I know of. On the Mac, you'd presumably use Audio Units to do this, but I think the support for those is limited on the iPhone SDK.

You can do some processing during your AudioQueue playback callback, between AudioFileReadPackets() and AudioQueueEnqueueBuffer() but I think speed-shifting without changing the tone will require rather a lot of CPU time.

It'd probably be easier to have more than one recording of the music, and switch files during a silent passage of the music.

Mark Bessey
  • 19,598
  • 4
  • 47
  • 69