MBS AV Foundation Plugin

Wonder if anyone can shed light on this for me?

I’m looking to use the MBS AV Foundation plugin to export audio files, but I want to alter the tempo and the pitch independently on the exported file. So the export could be 60% speed and +1 semi-tone pitch etc.

Looking at the AVAssetExportSessionMBS class it has a property audioTimePitchAlgorithm, which allows you to set the audio pitch algorithm used when handling scaled time edits. Looking at the Apple documentation it appears that a setting of AVAudioTimePitchAlgorithmSpectral allows for high quality, independent time and pitch, however I have no idea how to use it.

I’ve read through the MBS documentation and also the Apple AV Foundation stuff and can’t work it out. To be honest I can’t even work out where to start!

Is it me being dumb or am I barking up the wrong tree here?

you may need to use AVMutableCompositionMBS and scale some part of the audio. Than selecting the time pitch algorithm could be possible, I think.

Looks like I’d be able to change the track duration, so changing the tempo using AVMutableCompositionMBS and scaleTimeRange. I guess setting the correct pitch algorithm would keep the pitch constant while changing the tempo. It doesn’t however look like I can independently set the pitch though, only the tempo.

I found SoundTouch, which is an LGPL library for sound and pitch shifting. It has a pre-built command line utility (http://www.surina.net/soundtouch/soundstretch.html) which I guess I could shell out to and do the conversion externally. That’s going to be tricky with an App Store app though.