Real-time Pitch Shifting on the iPhone
Asked Answered
M

5

25

I have a children's iPhone application that I am writing and I need to be able to shift the pitch of a sound sample using Core Audio. Does anyone have any example code I could look at where this is done. There are many music and game apps in the app store that do this so I know I am not the first one. However, I cannot find any examples of it being done.

Mona answered 8/7, 2009 at 20:57 Comment(0)
I
15

you can use dirac-2 from dsp dimension for pitch shifting on the iphone. quote: -

"DIRAC2 is available as both a commercial object library offering unlimited sample rates and phase locked multichannel support and as a free single channel, 44.1/48kHz LE version."

Impart answered 15/12, 2009 at 0:30 Comment(6)
I had a bad experience trying dirac3 because of its libDIRAC_iOS4-fat.a which is probably not much different on dirac2. I just couldn't use it - had too many errors on the link part of the build process. Rather, I've used openAL with huge success.Literally
Works fine for me. You probably forgot to add the accelerate framework to your project (it's in the readme file)Laudianism
DIRAC is perfect, but OpenAL with AL_PITCH also changes the length of the sound, which is less than ideal. DIRAC is now version 3. Its library includes iPhone Demo project.Lye
@Cawas I found that I had to remove arm64 and armv7s as valid architectures and turn off build active arch only to use this in my project. jednorog.sneakyness.com/image/2K213w1y2P2u Make sure you're also including every required framework jednorog.sneakyness.com/image/0v2n0R3n3t0oWildeyed
@Wildeyed you can't submit apps now without the arm64 support. Since Dirac3 doesn't support arm64, you can't submit the app right?Wish
@Wish try it and see :) you seem to be confusing frameworks and appsWildeyed
D
10

use the soundtouch open source project to change pitch

Here is the link : http://www.surina.net/soundtouch/

Once you add soundtouch to your project, you have to give the input sound file path, output sound file path and pitch change as the input.

Since it takes more time to process your sound its better to modify soundtouch so that when you record the voice, directly give the data for processing. It will make your application better.

Demb answered 16/7, 2009 at 10:30 Comment(3)
@Anil : I didn't got API for iOSCistaceous
I would love a link on how to do this. Spent all day trying to find out how to add Soundtouch to my iOS projectJamaaljamaica
@Anil Please can you provide a link or snippet as to how to make it work what you mentioned in your answer :( Really desperate. ThnksTombouctou
L
4

I know it's too late for the person who asked but it is really a valuable link (As I found) for any one else who is looking for the solution of the same problem.

So Here we have latest DIRAC3 with it's own audio player classes which will take care of run time pitch and speed(explore for god knows what more) shifting. Run the sample and have huge round of applause for that.

Literalism answered 21/2, 2013 at 13:9 Comment(0)
L
3

Try Dirac - it's the best technology out there and it's available on Win, Linux, MacOS X and iOS. We're using it in all our products (and a couple of others do as well, search for "Capo" on the App Store). They're at version 3 now which has seen a huge increase in performance since previous versions. Hope this helps.

Laudianism answered 12/1, 2011 at 14:45 Comment(0)
L
2

See: Related question

How much control over pitch do you need... could you precalculate all the different sounds? If the answer is yes, then you can just pick the right sounds and play them.

You could also use Audio Converter Services in conjunction with AVAudioPlayer, which will allow you to resample the audio (which will effectively repitch them, though they'll change duration).

Alternatively, as the related question points out, you could use OpenAL and AL_PITCH

Lagas answered 8/7, 2009 at 22:33 Comment(1)
@Leachy just wondering... how could openAL not help you and DIRAC did? To me it was the complete opposite, and dirac proved useless! :oLiterally

© 2022 - 2024 — McMap. All rights reserved.