Re: Audio Device minimum buffer size
Re: Audio Device minimum buffer size
- Subject: Re: Audio Device minimum buffer size
- From: David Duncan <email@hidden>
- Date: Thu, 24 Jul 2003 10:39:54 -0400
On Thursday, July 24, 2003, at 4:58 AM, Malcolm Haylock wrote:
I thought it was about time I changed from using
CarbonSndPlayDoubleBuffer to using Core Audio. Things work fine when I
use an Audio Device output buffer size of at least 128 (for 44.1kHz)
but when I go lower the sound starts breaking up. With
CarbonSndPlayDoubleBuffer I use a buffer size of 32 without problem.
i want a buffer size as low as possible as this affects the latency of
my software from when a player hits a MIDI key to when they hear a
sound played.
I suspect that the Carbon Sound manager was insulating you from this by
simply calling your callback until it had enough data to fill it's
buffer to pass to CoreAudio. Are you doing your audio production in the
core audio i/o cycle or in another thread? At 32 samples you are
getting called back a LOT (every .7 ms) and if you take too long you
will get audio drops. It may just be that your overhead is enough that
you can't get the work done at 32 samples but can at 128 samples, and
thus will need to look into doing the audio production in a separate
thread. You can take a look at the Million Monkeys sample code to see
and play with some threading methods.
Even so, at 128 samples your talking about a 2.9ms latency at 44.1Khz -
making the instrument 'sound' about 3.3 ft (1m) away. If you've
actually been talking about *bytes* then you won't be able to do 32
bytes, at least not on the built in hardware, as it's minimum is 14
samples (56 bytes) per i/o cycle. Again, play with Million Monkeys and
some of the other sample code to get a good feel for these issues.
--
Reality is what, when you stop believing in it, doesn't go away.
Failure is not an option. It is a privilege reserved for those who try.
David Duncan
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.