开发者

is it possible to change the playback pitch of an audioqueue

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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜