Re: How to avoid overhead of 30% CPU usage
Re: How to avoid overhead of 30% CPU usage
- Subject: Re: How to avoid overhead of 30% CPU usage
- From: Jack Schmidt <email@hidden>
- Date: Mon, 6 Apr 2009 18:53:36 -0400
On 2009-04-06, at 18:11, Jens Alfke wrote:
On Apr 6, 2009, at 2:49 PM, Jack Schmidt wrote:
I am writing a small program that needs to do some fairly trivially
tasks with data from the microphone and send some easily generated
data to the speakers. ...
I ran into the problem however that once I call AudioDeviceStart or
AudioOutputUnitStart, CPU usage goes to 30% on a 2.4GHz MacBook,
which is about 300 times higher than I would expect based on
similar programs on other architectures.
This came up last month. The explanation is that CoreAudio is by
default doing some fancy audio post-processing on the internal-
microphone input, to clean it up and lower the noise level. (30% CPU
still seems high, but I don't know the details of what it's doing.)
You should be able to get around this by using an external
microphone (or a non-laptop.) There might also be a way to tell
CoreAudio to turn off the processing; you could search the list
archives for that thread.
Thanks. I had scanned the archives and read a few of the messages in
that thread, but it did not seem to be quite as dramatic as my
experience. Taking the time to read all of the messages, things look
a bit more reasonable:
Using "yes > /dev/null & yes > /dev/null & ./coreaudio_overhead" to
eliminate the effect of CPU throttling reduces the usage to only 5-6%.
Switching to headphones and built-in microphone (the intended use
case), the usage dropped to 4-5%.
Turning off ambient noise reduction, the usage dropped to 0.5-1%.
Switching to line-in and headphones kept the usage at 0.5-1%.
This seems reasonable overall; the noise reduction actually makes
quite an improvement in voice chat apps, so 5% CPU seems reasonable.
Without noise reduction the usage is below 1%, which seems reasonable.
Thanks also for pointing out "samples". For the most part it was not
actively useful since all time was spent in code I don't have control
over, but it at least gave an overview of what the various threads
were doing.
_______________________________________________
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