开发者

How to reverse an audio samples?

How can i reverse an audio samples with iphone sdk? I'll try to make a "dj scratch" effect. I'm ta开发者_高级运维lking about speeding up and slowing down and reversing the audio samples in real time.


This will not be as easy as you probably think. To get a real scratch effect you'll have to model the changes in playback speed - pitch shift down to 0 Hz and then reverse the audio stream and pitch shift back up again to the normal playback speed. This is not a trivial algorithm.


In general, when you want to do heavy processing with audio, you'll have to implement it yourself or with third party libraries. Audio queues and audio units are good starting points, but you can't make your own audio units for iOS. The best thing to do is perform all your processing in the callback for your audio queue or audio unit processing graph, in which you'll be handed a buffer of AudioUnitSampleType that you can manipulate to your heart's content before passing it off. (Take a look at the callback in MixerHostAudio.m in the Mixer Host sample application.) To get this effect you'll have to write decently complicated DSP code but in terms of interaction with Apple code, working from the callback is a safe bet.


You can use FMOD but there is no "reverse" function. You can make a sound play backwards by making the channel frequency negative. (According to the documentation)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜