There have been occasional references to manipulating pitch in audioqueue playback by overwriting the sample rate.
I am trying to play two pitches in sequence with a calculated detuning (in cents) between them. From the examples I found this is supposed to work as long as a new audioqueue is created to handle the altered sample rate playback.
UInt32 size = sizeof(mDataFormat);
err = AudioFileGetProperty(mAudioFile, kAudioFilePropertyDataFormat, &size, &mDataFormat);
if (err != noErr)
NSLog(@"Couldn't determine the audio file format");
//mDataFormat is AudioStreamBasicDescription structure
Float64 mySampleRate = mDataFormat.mSampleRate;
NSLog(@"The sample rate is: %f", mySampleRate);
if (inRate != 1) {
NSLog(@"The sample rate should change.");
//mDataFormat.mSampleRate *= inRate;
mDataFormat.mSampleRate = inRate;
mySampleRate = mDataFormat.mSampleRate;
NSLog(@"The new sample rate is: %f", mySampleRate);
}
So far my version does not succeed in detuning the second audio sample.
Any suggestions would be greatly appreciated.