RemoteIO playback clicking at end of PCM
RemoteIO playback clicking at end of PCM
- Subject: RemoteIO playback clicking at end of PCM
- From: Marc Vaillant <email@hidden>
- Date: Tue, 9 Dec 2008 11:40:23 -0500
Hi,
I'm trying to use the RemoteIO audiounit on the iphone to stream pcm
data. I'm testing with a simple 800hz tone at 44100 sample rate with
5ms rise and fall times to avoid clicking at beginning and end of the
tone. However, I'm getting a click at the end (no click at the
beginning) of the tone. Other than the click, everything about the tone
seems correct (correct duration and pitch). When I play the exact same
pcm using openal or oss, there is no clicking.
It seems likely that I've goofed somewhere in my callback but also I'm
trying to use a 16bit stereo unsigned int format (equivalents in oss and
OpenAL would be 2 channel AFMT_S16_NE and AL_FORMAT_STEREO16
respectively) and I'm not sure that I have it setup quite right or if
this format is really supported. The full source of the example is:
http://stuff.vaillant.fastmail.fm/AudioUnitTestAppDelegate.mm
Also, below is a snip of my format settings.
Finally, I find that the audiounit is requesting 1k samples from the
callback which is about 23ms at 44100. Is there any way to set the
buffer to be smaller than 1k to improve latency? Or is there a format
choice that will give better latency?
Any help or suggestions are greatly appreciated.
Thanks,
Marc
UInt32 flag = 1;
// Enable IO for playback
status = AudioUnitSetProperty(audioUnit,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Output,
kOutputBus,
&flag,
sizeof(flag));
// Describe format
AudioStreamBasicDescription audioFormat;
audioFormat.mSampleRate = SAMPLE_RATE;
audioFormat.mFormatID = kAudioFormatLinearPCM;
audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
audioFormat.mFramesPerPacket = 1;
audioFormat.mChannelsPerFrame = 2;
audioFormat.mBitsPerChannel = 16;
audioFormat.mBytesPerPacket = 4;
audioFormat.mBytesPerFrame = 4;
// Apply format
status = AudioUnitSetProperty(audioUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
kOutputBus,
&audioFormat,
sizeof(audioFormat));
// checkStatus(status);
_______________________________________________
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