Reputation: 1658
I am making a rhythm game. I need to play a sound with different tempo. In other words e.g. if I have [AVAudioPlayer play] 8 times in 2 seconds.
Upvotes: 0
Views: 1138
Reputation: 409
Check out the
enableRate
and
rate
property on the AVAudioPlayer Class. After you create the audioplayer, but before you play, set
audioPlayer.enableRate=YES;
then after you play, set rate to a number above or below 1.0 to speed up or slow down the track. For music, less than 0.8 or more than 1.2 starts to sound bad, but for a few BMP up or down, it will easily do the trick.
Note that play sets the rate to 1 and stop sets the rate to 0, so be sure to set the desired rate after playing.
Upvotes: 3
Reputation: 1658
I've used Pitch Shifting using the Fourier Transform – Source Code
http://www.dspdimension.com/download/
Upvotes: 0