/ computer
Lowering CPU Usage while playing Audio on Windows 7

2nd October 2011,

The problem begins when I started to play MP3 on my computer.  The CPU utilisation is between 12-20% which I feel strange.  Therefore I manages to caught a file called audiodg.exe, Windows Audio Device Graph Isolation which I simply called it the mixer, which was using my CPU resources.

A look on audiodg.exe

I remember the good old days where audio playing is an easy task.  Just install the sound driver, and play the audio.  No jittering, no quality issues, and no CPU hogs, and the music is just playing really well, at least to my ears.
My Computer back in 2002 is Pentium 4 with 512 MB of ram and Sound Blaster Live soundcard running Windows 2000.  I use Creative Media Player or whatever it is I forgot the name.

Those are the days where playing MP3 utilises only 2-3% CPU usage for the whole system, which means CPU usage for player and sound driver is only taxing 2-3% of my processor, very light weight.

Today my computer is a laptop, HP dv2, with 1.6GHz dual core Athlon Neo with an IDT Sound Card running Windows 7 which requires 10-20% CPU usage for playing MP3 only.  This is really strange, taking into account the dual core Athlon Neo is obviously 8 years younger an way more powerful than my Northwood P4.  The only identical variable to this comparison is the MP3 audio file and every other variable is different. 

Threfore I decided to read and learn the processes which was involved with audio playing and I found up that audiodg.exe is taxing my processor up to 8%; and the Windows Media Player uses around 7% of CPU usage, consistent with my earlier findings.

While playing with fiddling with Windows Sound settings I found that audiodg.exe, the Windows Audio Service, is interesting.  The file taxes variably in different sampling rate quality setting. 

These are the CPU usage from different sample rate quality of
16 bit @ 44100Hz or CD Quality the audio dg uses 1.37 and 1.45%
16 bit @ 48000Hz or DVD Quality (Default)  the audio dg uses 0.09-0.14%
24 bit @ 48000Hz or Studio Quality the audio dg uses 0.00 (yes this is correct and no typo: all zero)
24 bit @ 192000Hz or Studio Quality the audio dg uses 8.8-13.92%

Testing methodology : I set my computer at High Performace power setting to force my CPU to run at 100%.  I set the audio setting to CD Quality play the song and record the average CPU usage, then I set my computer to DVD Quality, play the song and record the average, then finally I set the audio quality to maximum setting and record the quality usage too.  The software for recording the average usage is Windows's own Resource Monitor to record the average CPU usage.

My sound card defaults at 24 bit and 48 KHz and that explains why audiodg uses 0.00 at that quality setting because there is simply no resampling involved.  At CD quality the CPU will upsample the rate from 16 bit 44.1 KHz to 24 48 KHz to feed the soundcard, and at DVD Quality, my CPU will resample the rate from 16 bit 48 KHz to 24 bit 48 KHz, which explains why a little CPU resources were used for the bit conversion, and it appears bit conversion is way lighter for CPU to process; However downsampling from 24 bit 192 KHz to 24 bit 48 KHz is a real task which hogs the CPU.

Almost every other website recommends to disable all audio effects, however from that simple test which I conduct, I also recommend to reduce the sample rate quality matching to the sample rate native to your sound card.  Which means no resampling and frees up the CPU from unnecessary tasks.

Reducing sample rate quality is perfectly fine, as long as you did not do studio works.  For casual listener, DVD quality or CD quality is all that you will ever need, as most customer grade speakers is not designed to receive input at that level of quality.  Moreover most CD are mastered at 16 bit and 44100Hz while DVDs are mastered at 16 bit 48000Hz. 

Therefore, higher sample rate will not benefit you and only tax your processor.  Selecting wrong sample size, you will waste your processor by 13% which is a lot and means more power saved and faster way of doing task by 13%.

Now I got that 24bit at 48000Hz is the best quailty I can get without taxing my processor.  Your sound card is different, so please choose wisely according to your sound card documentation.

Moreover when I tried to enable the enhancements (just by unchecking Disable All Enhancements) and all I got is 5% CPU usage by audiodg when starting playing the music and that drops to 0.05% on average.  Enabling loudness and equalizer increases to 0.18% in CPU usage.  Not a real CPU hog, therefore I guess that should be no problem when enabled.  However the number of threads produced by audiodg increases from 7 without any enhancements to 11 with enhancements.

For an additional information: I tried to mute mic with mic enhancement disabled when doing 24 bit at 192 KHz, and the CPU usage magically reduced down to 5.90% from 13.8%.  However with enhancement enabled the CPU usage stays at 13.+ %.  I guess the mic enhancement stays active regardless the mute status.

3rd October 2011,

At first I was thinking that lack of audio hardware acceleration is the cause of high CPU utilisation on playing mp3 in Windows 7.  Therefore I decided not to do anything as I rarely play audio in my computer.  However as things reveals clearer and I manages to get the same CPU level for playing audio compared to my 9 years old Pentium 4 system.  I decided to take a look at the Windows Media Player to find out whether changing sample size affects CPU utilisation on the software.

A look on wmplayer.exe

wmplayer.exe is the Windows Media Player, a generic media player built in Windows which are banned by the European. 

Fiddling with the audio sampling setting, I found that the wmplayer.exe behaves strangely too.  It follows the trend of the audiodg. 

I found The wmplayer.exe uses only 1.48-1.54% when the audio setting is set to the native sample resolution of the sound card, which is good, plus the audiodg CPU usage totaling CPU usage to 1.5% when playing MP3.

However setting when setting the sample size to 16 bit 44.1KHz, the wmplayer.exe only uses 0.18-0.25%, totaling CPU usage 1.55-1.62% when playing MP3.

The wmplayer.exe uses most CPU resources when playing 24bit at 192KHz, which put the total ultilisation around 12-20%.

I believe the reason why at 16 bit and 44.1KHz the wmplayer.exe behaves most efficient is due to the MP3 format which I played is 44.1KHz therefore freeing the media player from resampling its output to match the mixer's sample size.  The reason why it took so much CPU processing power to process 24bit at 192 KHz audio is wmplayer upsamples the format to match the mixer (audiodg) setting and then audiodg downsamples tries to match the soundcard native sample size.  Well that is my believe, which can be wrong, however...  I guess every other application will behave the same way: upsampling or downsampling to match the mixer sample size.

Now it is clear that I should choose the soundcard native setting for listening to audio files.  It is the most lightweight processing.  Even lighter by 0.07% in processing power needs compared to processing power required for CD quality.

Oh yes, audio enhancements does no effect to wmplayer, and minor effect to audiodg.exe, well, final word: feel free to experiment and report any mistake on my experiment in the cbox on the right.

PS: some people, including me when writing this sentence, believes that setting the sample rate at 24bit at 192 KHz produces better audio.  As I experimented, at least on my laptop which did not support that sound resolution, 24 bit at 192 KHz actually reduces the audio quality.  Logically, the source file itself is only 16 bit at 44.1 KHz and and my audio device is 24 bit at 48KHz therefore 24 bit at 192KHz just did not make any sense.  To make matter worse, pops and clicks happens at 24 bit at 192KHz setting, possibly due to conversion or rounding error.  I guess the believe is just placebo effect or psychological.