after you start the remote I/O can you check:
What is the sample rate of bus 0, output scope and bus 1, input scope. Also, what is the sample rate according to audio session - current h.w sr = these should all be 16k
I'm also not so sure about non-power 2 I/O sizes - try requesting 512 samples to see how that works
On Apr 12, 2010, at 5:28 PM, Doug McCoy wrote: I am using the RemoteIO AudioUnit on iphone for live IO.
I have been setting this up with various sample rates and buffer sizes to tune my algorithm. For 44.1K and 22K, I get expected results for the number of frames in the callback IO buffer.
For 16K, I get strangeness.
My setup goes like this:
set kAudioSessionProperty_PreferredHardwareSampleRate = 16K set kAudioSessionProperty_PreferredHardwareIOBufferDuration = 0.032 seconds (512 frames)
AudioSessionSetActive(true) get kAudioSessionProperty_CurrentHardwareSampleRate = 16K
get kAudioSessionProperty_CurrentHardwareIOBufferDuration = 0.02322
seconds (371.52 frames, i round up to 372)
I then setup the remoteIO with:
AudioStreamBasicDescription audioFormat;
memset(&audioFormat, 0, sizeof(audioFormat)); audioFormat.mSampleRate = 16000; // FS
audioFormat.mFormatID = kAudioFormatLinearPCM; audioFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
audioFormat.mChannelsPerFrame = 1; audioFormat.mFramesPerPacket = 1;
audioFormat.mBitsPerChannel = sizeof(short) * 8; // 16-bit audioFormat.mBytesPerFrame = audioFormat.mBitsPerChannel / 8 * audioFormat.mChannelsPerFrame;
audioFormat.mBytesPerPacket = audioFormat.mBytesPerFrame * audioFormat.mFramesPerPacket;
I enable input and the input output formats are identical.
My callback is declared as such:
static OSStatus PerformThru(
void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber,
UInt32 inNumberFrames, AudioBufferList *ioData)
For the first callback,
inNumberFrames == 372 and ioData->mBuffers[0].mDataByteSize == 372 * 2 (16bit samples, mono)
This is to be expected.
But subsequent callbacks have
inNumberFrames == 1 or 2
and
ioData->mBuffers[0].mDataByteSize == 2 or 4 respectively
This discrepancy is causing havoc in my processing.
I notice the first case above will occur if the audio session changes and the remoteIO AU is re-created and started anew, but it quickly reverts to the latter bad case.
For 44.1k and 22K the callback buffers are all at the expected size. For 16K the buffer length is not consistent.
Is there a know issue with this?
--- Check out my new iPhone app, FlipTalk. Once featured on the iTunes App Store "What's Hot" list! http://fliptalkapp.com http://itunes.com/apps/FlipTalk/
http://tinyurl.com/FlipTalkYoutube
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
|