Real-time Pitch Shifting on the iPhone

24,753

Solution 1

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."

Solution 2

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.

Solution 3

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.

Solution 4

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.

Solution 5

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

Share:
24,753

Related videos on Youtube

Leachy Peachy
Author by

Leachy Peachy

Web & iOS Developer, Musician, Father, Son, Brother and lover of ALL things Purple. I am a Sr. Software Engineer at Victorious.com.

Updated on July 09, 2022

Comments

  • Leachy Peachy
    Leachy Peachy almost 2 years

    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.

  • Leachy Peachy
    Leachy Peachy almost 15 years
    I will give this a shot. Thanks Anil! L.
  • cregox
    cregox over 13 years
    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.
  • cregox
    cregox over 13 years
    @Leachy just wondering... how could openAL not help you and DIRAC did? To me it was the complete opposite, and dirac proved useless! :o
  • Maulik
    Maulik over 12 years
    @Anil : I didn't got API for iOS
  • tahome
    tahome about 12 years
    Works fine for me. You probably forgot to add the accelerate framework to your project (it's in the readme file)
  • Tibidabo
    Tibidabo almost 12 years
    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.
  • AlBeebe
    AlBeebe almost 12 years
    I would love a link on how to do this. Spent all day trying to find out how to add Soundtouch to my iOS project
  • Sneakyness
    Sneakyness over 10 years
    @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/0v2n0R3n3t0o
  • Ushan87
    Ushan87 over 9 years
    @Sneakyness you can't submit apps now without the arm64 support. Since Dirac3 doesn't support arm64, you can't submit the app right?
  • Sneakyness
    Sneakyness about 9 years
    @Ushan87 try it and see :) you seem to be confusing frameworks and apps
  • Hyder
    Hyder over 7 years
    @Anil Please can you provide a link or snippet as to how to make it work what you mentioned in your answer :( Really desperate. Thnks