I'm writing an app in which I'm trying to change the pitch of the audio when I'm recording a movie (.m4v). Or by modifying the audio pitch of the movie afterwards. I want the end result to be a movie (.m4v) that has the original length (i.e. same visual as original) but with modified sound pitch, e.g. a "chipmunk voice". A realtime conversion is to prefer if possible.
I've read alot about changing audio pitch in iOS but most examples focus on playback, i.e. playing the sound with a different pitch.
In my app I'm recording a movie (.m4v / AVFileTypeQuickTimeMovie) and saving it using standard AVAssetWriter. When saving the movie I have access to the following elements where I've tried to manipulate the audio (e.g. modify the pitch):
audio buffer (CMSampleBufferRef)
audio input writer (AVAssetWriterAudioInput)
audio input writer options (e.g. AVNumberOfChannelsKey, AVSampleRateKey, AVChannelLayoutKey)
asset writer (AVAssetWriter)
I've tried to hook into the above objects to modify the audio pitch, but without success.
I've also tried with Dirac as described here: Real Time Pitch Change In iPhone Using Dirac
And OpenAL with AL_PITCH as described here: Piping output from OpenAL into a buffer
And the "BASS" library from un4seen: Change Pitch/Tempo In Realtime
I haven't found success with any of the above libs, most likely because I don't really know how to use them, and where to hook them into the audio saving code.
There seems to be alot of librarys that have similar effects but focuses on playback or custom recording code. I want to manipulate the audio stream I've already got (AVAssetWriterAudioInput) or modify the saved movie clip (.m4v). I want the video to be unmodifed visually, i.e. played at the same speed. But I want the audio to go faster (like a chipmunk) or slower (like a ... monster? :)).
Do you have any suggestions how I can modify the pitch in either real time (when recording the movie) or afterwards by converting the entire movie (.m4v file)? Should I look further into Dirac, OpenAL, SoundTouch, BASS or some other library?
I want to be able to share the movie to others with modified audio, that's the reason I can't rely on modifying the pitch for playback only.
Any help is appreciated, thanks!