need help with AUHAL audio glitching at high cpu utilisation
need help with AUHAL audio glitching at high cpu utilisation
- Subject: need help with AUHAL audio glitching at high cpu utilisation
- From: "Ross Bencina" <email@hidden>
- Date: Wed, 24 Jun 2009 19:50:56 +1000
Hi Peoples
(on intel 10.5.6, dual core macbook, AUHAL)
I'm having serious problems getting stable audio from AUHAL (using
PortAudio) at high CPU loads (above 70% utilsation of one core for doing
DSP).
The symptom I have is that if my audio processing callback uses more than
about 70 - 80% of one core, the audio glitches. I can make this happen
predictably with a callback that just generates a bunch of sine waves with
the sin() function. The situation is improved with larger i/o buffers but my
minimum buffer size is already 256 samples at 44.1k.
My impression so far (just based on how it behaves under different loads) is
that the system is limiting CoreAudio's CPU usage or not giving it
real-time priority.
I would like to diagnose the problem. I suspect it's a combination of issues
with my audio processing code (possibly cpu spikes) and misconfiguration of
CoreAudio/kernel deadlines or priorities. Or perhaps PortAudio's AUHAL usage
is the problem. Perhaps even AUHAL is the wrong API to be using to get the
most solid real-time performance?
At the moment I'm a bit in the dark as to were to start -- but to give you
some idea, I'm prepared to re-write PortAudio/OSX if need be to get better
performance because at the moment I'm seeing worse performance than with
ASIO drivers on Windows!
My expectations are that I should be able to use at least 85% of one core
for audio processing with rock-solid audio at 44.1k with a 256 sample i/o
buffer. Is this a realistic expectation for CoreAudio? should I expected
better or worse than this?
I havn't found a tool which gives detailed per-thread and per-core CPU load
information, so I havn't been able to inspect things in as much detail as
I'd like. I'd like to be able to see the kernel's view of timing information
for each timslice allocated to CoreAudio and to see the split between
CoreAudio CPU usage and my code's usage. Any suggestions? Also is there a
way (outside my app) to monitor thread switching times and kernel scheduling
events (like missed deadlines)?
I assume that the kernel scheduler throttles the core audio callback if it
uses more than a certain amount of CPU. Is there a way to increase the CPU
allocation? Ideally I would like to assign close to 100% of one core to
servicing the CoreAudio threads.
FYI I'm using PortAudio which is layered on top of AUHAL. My settings are
44.1k with a buffer size of 256 frames (set with
kAudioDevicePropertyBufferSize) -- if I set it to 512 I can go a bit higher
with the CPU load but 256 is already much higher than I would like.
Thanks!
Ross.
_______________________________________________
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