Intermittent microphone recording pitch problem, with remoteIO AU
Intermittent microphone recording pitch problem, with remoteIO AU
- Subject: Intermittent microphone recording pitch problem, with remoteIO AU
- From: KappA <email@hidden>
- Date: Mon, 25 Jan 2010 21:11:10 -0500
Hi All,
I am having a mysterious yet intermittent recording problem, where the MIC recording *sometimes* comes out in a higher pitch (sounds like faster sample rate) than it should be. Yet, if I simply restart the application running on my iPhone 3G device, and retry, it seems to record just fine. I am unable to reproduce this problem at will. I suspect that the below code, where I am creating the recording file and setting the client format, is where the problem is coming in. I am using the RemoteIO Audio Unit for playback (chained to the 3DMixer). I am using PlayAndRecord for the audio session category, and when recording from the microphone, I have to divide the sample rate by 2 in order for the playback to sound normal. I don't think this is exactly the right way to do this; however, this works to produce a normal sounding microphone recording that plays back on both channels just fine. In fact, after twiddling with these ASBD structs for a few days, the below is the best I could get things in order for everything to work. Note - recording without MIC works just fine all the time. Any help towards fixing this is greatly appreciated.
AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareSampleRate, &uSampleRateSize, &hwSampleRate);
AudioStreamBasicDescription clientFormat;
memset(&clientFormat, 0, sizeof(AudioStreamBasicDescription));
clientFormat.mSampleRate = hwSampleRate;
clientFormat.mFormatID = kAudioFormatAppleIMA4;
clientFormat.mChannelsPerFrame = 2;
osRet = ExtAudioFileCreateWithURL(recURL, kAudioFileCAFType, &clientFormat, &acl, 0, &m_active_rec_file);
if(osRet) {
CFRelease(recURL);
return false;
}
memset(&clientFormat, 0, sizeof(AudioStreamBasicDescription));
clientFormat.mSampleRate = bEnableMic ? (hwSampleRate/2) : hwSampleRate;
clientFormat.mFormatID = kAudioFormatLinearPCM;
clientFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger|kAudioFormatFlagIsPacked;
clientFormat.mFramesPerPacket = 1;
clientFormat.mChannelsPerFrame = 2;
clientFormat.mBitsPerChannel = 16;
clientFormat.mBytesPerPacket = 4;
clientFormat.mBytesPerFrame = 4;
osRet = ExtAudioFileSetProperty(m_active_rec_file, kExtAudioFileProperty_ClientDataFormat, sizeof(AudioStreamBasicDescription), &clientFormat);
if( osRet != noErr )
{
CFRelease(recURL);
return false;
}
Thanks for the help,
Kappa
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden