1

This is supposed to be possible on Mac OS X by overwriting the sample rate in the AudioStreamBasicDescription then create a new output queue.

I've been able to retrieve the default sample rate and write a new one (ie. replace 44100 with 48000) but this is not resulting in any pitch change in the output signal.

err = AudioFileGetProperty(mAudioFile, kAudioFilePropertyDataFormat, &size, &mDataFormat);
        if (err != noErr)
            NSLog(@"Couldn't determine the audio file format");
        Float64 mySampleRate = mDataFormat.mSampleRate; //the initial rate
        if (inRate != 1) {
//write a new value
            mDataFormat.mSampleRate = inRate;
            //then 
err = AudioQueueNewOutput etc.

Any suggestions would be greatly appreciated.

YetAnotherUser
  • 9,156
  • 3
  • 39
  • 53

1 Answers1

0

Changing the sample rate doesn't change the pitch of the audio. You may perceive that something playing back faster has a higher pitch. However that's perception rather than reality.

To change pitch, you'll need to process the audio data through a Digital Signal Processing (DSP) library. Alternatively, take a look at running it through an AudioUnit:

Audio Unit Programming Guide

Max MacLeod
  • 26,115
  • 13
  • 104
  • 132
  • Changing the sampling rate *does* change the pitch of the audio. It changes the pitch and the tempo together. It's not merely perception. You are of course correct that it is possible to change the pitch alone, however, without changing the tempo. – Todd Lehman May 18 '14 at 20:54