I am in the process of making a piece of pitch correction software for the iPhone. I am currently at the fun Audio Queue part and I have a few questions about changing the pitch. My current idea to increase the pitch is to double the sampling rate and delete every other frame. I have it setup to record to a file and play from that file with LPCM format. If I understand correctly lpcm has one frame per packet so deleting every other frame should be a piece of cake. What I am wondering before I try to tackle this part of the code is if I use lpcm, can I have the sampling rate different in different parts of the file? If not is there another format that would support having multiple sampling rates at different parts of the file?
Asked
Active
Viewed 667 times
1
-
1Warning: this will probably sound terrible. Is this for speech, music, or what ? – Paul R Jun 21 '11 at 17:59
-
This is to change the pitch of any sound it should work with either. probably better with singing because if a pitch is being held it can be tuned this way (I'm guessing here.) This code is an experiment. But I'm sure there are ways to change the pitch of music that work better than they would on speech and vice versa. – Daniel Riechers Jun 21 '11 at 18:20
-
See my answer below - also see numerous previous questions and answers on SO related to pitch-shifting, PSOLA, phase vocoders, etc. – Paul R Jun 21 '11 at 18:29
1 Answers
1
You might want to experiment with the pitch shifting algorithm itself in a suitable environment first (e.g. MATLAB/Octave, or even just your preferred language on a desktop system). If it needs to work for music as well as speech then you probably want to look at implementing a phase vocoder.

Paul R
- 208,748
- 37
- 389
- 560
-
I will be looking into that but I need to know the answer to my original question to speed up/slow down the audio file in different parts of it by changing the sampling rates. – Daniel Riechers Jun 21 '11 at 18:46
-
@Daniel: I think that is probably the wrong approach - the phase vocoder can do both pitch shifting and time compression/stretching so you have all you need there in one proven implementation, rather than resorting to dubious hacks such as messing with the sample rate on the fly, which will probably introduce some nasty artefacts. – Paul R Jun 21 '11 at 20:04
-
Certainly I will probably end up doing that. I don't mean to be annoying but does messing with the sample rate on the fly mean that the actual lpcm file not control the sample rate? if so are all audio formats this way? I am newish to audio software. Is lpcm apples name wav or whatever (I just threw out a sound file type)? I can't find an RFC for lpcm. I'm getting lpcm from the iOS Developer library's Audio Data Format Identifiers enumeration. I honestly don't even know if this is a standard filetype. I have heard of pcm though. – Daniel Riechers Jun 22 '11 at 05:24
-
AIUI LPCM is just another name for PCM: http://en.wikipedia.org/wiki/Linear_pulse-code_modulation. – Paul R Jun 22 '11 at 07:05