Change in pitch of voice - iphone

I am creating an iPhone application in which when I make a call to anyone I should be able to change the pitch of my call voice in real time.
So for that which framework or any third party library should I use?
Thanks,
Sunil.

For speech your best bet is probably an implementation of PSOLA. This allows pitch shifting and/or time compression/expansion. You can either implement it yourself (it's fairly straightforward if you're familiar with DSP etc) or Google for open source implementations.

If we want to change sound pith it looks most natural to transform small sound segments into the frequency domain using FFT, then shift frequency distribution and return back to the time domain using inverse FFT. Yes, it works, but unfortunately algorithms of this kind is too time consuming for iPhone.
But there are also other group of SOLA-like algoritms, they simplest versions can be implemented on iPhone.
Follow this links for libraries and more info:
http://www.dspdimension.com/admin/time-pitch-overview
http://www.surina.net/soundtouch/index.html#download
http://www.guitarpitchshifter.com/algorithm.html

Related

iPhone: Detecting a replicated sound of particular frequency (amplitude)

I am trying to write an iPhone App that should monitor the any incoming sound. I am not sure how can I get the sound recorded by iPhone's Microphone and detect its frequency. If same frequency sound repeated couple of times then I need to take some action. Could anyone please help me here. I went through the How to detect sound frequency / pitch on an iPhone? but I couldn't understood how to use them.
Any documentation or example would be really useful.
Thanks.
You'll appreciate reading this, on how to get the sound "without having to drop down to C", by using AVAudioRecorder...
Then, begin researching FFT...
Checkout this post about FFT for iPhone, which mentions various options, including the possibility of using Apple's Accelerate framework (in which you will need to drop to C) to apparently get "Apple-written FFT functions".
This is probably what you really want to read.

How to make a simple EQ AudioUnit (bass, mid, treble) with iOS?

does anyone know how to make a simple EQ audio unit (3 bands - low, mid, hi) with iOS ? I know how to add an iPod EQ Audio Unit to my AU Graph. But it only give you access to presets and I need proper control of the EQ.
I've looked around for some tutorials or explanations but no luck.
Thanks.
André
The iPhone doesn't exactly support custom AudioUnits. Or, more precisely, it doesn't allow you to register an AudioUnit's identifier so you could load it in an AUGraph. You can, however, register a render callback, get raw PCM data, and process it accordingly. This is how I've implemented effect processing in the iPhone.
I would highly recommend you to use my NVDSP library, it allows easy audio DSP'ing, including the filters required to make an equalizer in iOS: https://github.com/bartolsthoorn/NVDSP
I've written two Blog-Entries about this issue and how to get equalization on iOS working. It uses the libsox library (cross compiled).
First post explains how you build libsox: http://uberblo.gs/2011/04/iosiphoneos-equalizer-with-libsox-making-it-a-framework
The second explains how to use it: http://uberblo.gs/2011/04/iosiphoneos-equalizer-with-libsox-doing-effects
please up the answer if it helped you! thanks!
you can implement using same classes as used in speak here sample code ,only to generate properties like peak powervalue and average powervalue you need to do calculation in callback function and it works.
This ancient Motorola AN2110 App Note explains how to write your own fully controllable 10-band equalizer (and 10 bands of real-time audio IIR filters will consume well under 10% of an iPod Touch's ARM CPU). Not sure about how to integrate this with an AU Graph, but this type of EQ can easily be integrated into PCM Audio Queue buffer callbacks.

How to change a recorded voice to a man's voice in Core Audio (Audio Unit/ Remote IO) for iPhone

I am new to Core Audio and really lost, I am trying to record an audio and then apply voice modulation to that recording and play it back. I have looked at the example Speak Here which uses Audio Queue for audio recording. I am stuck at the part of how to change the audio samples. I understand that it can be done using Audio Unit in the call back function to change the audio samples, but I have no idea what to apply to those samples to change them (will changing pitch help ?).
If you could direct me to some source code or tutorial or any site that explains voice modulation for objective C will really really help me. Thank you all in advance.
What you are trying to do here is not that simple. Basically, you would have to implement a vocoder ("voice-coder") to change a voice. The Wikipedia links should help you there.
Then, you still have manipulate those samples in CoreAudio. You can do this using Audio Queue Services but that not exactly an easy-to-use API. It might actually be less trouble to use one of the simpler CoreAudio APIs and wrap your vocoder in an Audio Unit.
Do you have some experience with audio processing? Implementing a vocoder without some prior knowledge about audio processing in general is a tough task.
First, to actually answer your question: When you called the AudioQueueNewInput() function, you pass it the name of a routine that will be called every time data is available to you. You probably called it MyInputBufferHandler() or something. It's third argument is an AudioQueueBufferRef which hold the incoming data.
Be aware that this is not as simple as looking at each sample (amplitude) and lowering or raising it. You receive samples in the temporal (time) domain as amplitudes. There is no pitch or frequency information available. What you need to do is move the incoming samples (waveform) into the frequency domain, wherein each "point" in that space is a frequency and it's accompanying power and phase. You can do that with an FFT (fast Fourier transform) but the mathematics are somewhat sophisticated. Apple does provide FFT routines in the Acceleration framework, but be aware that you are wading into very deep water here.

iPhone: CPU power to do DSP/Fourier transform/frequency domain?

I want to analyze MIC audio on an ongoing basis (not just a snipper or prerecorded sample), and display frequency graph and filter out certain aspects of the audio. Is the iPhone powerful enough for that? I suspect the answer is a yes, given the Google and iPhone voice recognition, Shazaam and other music recognition apps, and guitar tuner apps out there. However, I don't know what limitations I'll have to deal with.
Anyone play around with this area?
Apple's sample code aurioTouch has a FFT implementation.
The apps that I've seen do some sort of music/voice recognition need an internet connection, so it's highly likely that these just so some sort of feature calculation on the audio and send these features via http to do the recognition on the server.
In any case, frequency graphs and filtering have been done before on lesser CPUs a dozen years ago. The iPhone should be no problem.
"Fast enough" may be a function of your (or your customer's) expectations on how much frequency resolution you are looking for and your base sample rate.
An N-point FFT is on the order of N*log2(N) computations, so if you don't have enough MIPS, reducing N is a potential area of concession for you.
In many applications, sample rate is a non-negotiable, but if it was, this would be another possibility.
I made an app that calculates the FFT live
http://www.itunes.com/apps/oscope
You can find my code for the FFT on GitHub (although it's a little rough)
http://github.com/alexbw/iPhoneFFT
Apple's new iPhone OS 4.0 SDK allows for built-in computation of the FFT with the "Accelerate" library, so I'd definitely start working with the new OS if it's a central part of your app's functionality.
You cant just port FFT code written in C into your app...there is the thumb compiler option that complicates floating point arithmetic. You need to put it in arm mode

Real-time Pitch Shifting on the iPhone

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