ALSA - High CPU usage on the default device

Everything about X, Gnome, KDE, ... and everything running on it

ALSA - High CPU usage on the default device

Postby andoru » 2017-10-29 19:31

As the title says, I'm having a bit of an issue with ALSA, and the high CPU (~15-20%) usage in some cases. So far on the default device, I've only noticed this with VLC and foobar2000 (through Wine), but there are other apps/games that might have the same problem. It's just easy to tell if an app/ALSA uses too much CPU if you just play some audio files and you don't have anything else that might need the extra CPU power, like rendering the video stream or render the graphics. I can fix the high CPU usage in VLC if I switch the audio sub-device from the Default to a specific one (in my case: Analog Front Speakers). There is no change in the audio quality, but the resources used instantly decrease. The only problem with this is that I can no longer play/hear any audio from other apps/games (so basically VLC monopolises the card). Also, this is not possible under Wine, so I can't achieve the same thing for foobar2000, or other Windows apps/games.
I haven't made any custom config files for ALSA, except to disable the HDMI audio output (so that the normal analogue output is used by default in all apps/games), and I've done that in /etc/modprobe.d/intel-disable-hdmi.conf with this as it's content:

Code: Select all
options snd_hda_intel enable=0,1


The soundcard that I'm using is an integrated one, and it's a Realtek ALC887-VD.
Does anyone know what I could do to fix this issue, while still being able to play multiple streams of audio at the same time?
Last edited by andoru on 2017-11-01 20:11, edited 1 time in total.
I support Universal Basic Income, and so should you, here's why. Another reason why.
Commonly asked questions about UBI
Spread the word!
andoru
 
Posts: 236
Joined: 2014-03-14 16:59

Re: ALSA - High CPU usage on the default device

Postby debiman » 2017-10-31 06:29

obvious question:
when did the problem start, and what happened between now and then?
also:
do you know which process takes the cpu? have you checked with top/htop (make sure to see other users also)?
User avatar
debiman
 
Posts: 1539
Joined: 2013-03-12 07:18

Re: ALSA - High CPU usage on the default device

Postby andoru » 2017-10-31 10:53

debiman wrote:obvious question:
when did the problem start, and what happened between now and then?


I don't know, as I haven't looked at this closely until lately. I did so because some other processes and apps seemed slower after starting to play some music in the background.
I haven't done any modifications to the audio part except when I first installed the OS, so I'm assuming this issue was there since the beginning. What I did at the beginning was to remove Pulseaudio and created the file I mentioned above to disable the HDMI audio provided by the integrated audio chip, and so I could make sure that all the running programs on my system use the correct device.
I'm guessing this issue has something to do with dmix and/or resampling, but I don't know how to fix it.

debiman wrote:also:
do you know which process takes the cpu? have you checked with top/htop (make sure to see other users also)?


I mentioned this above, it's VLC and foobar2000. I ran htop, and I ran it again with root. All the processes are started/owned by my user.
I support Universal Basic Income, and so should you, here's why. Another reason why.
Commonly asked questions about UBI
Spread the word!
andoru
 
Posts: 236
Joined: 2014-03-14 16:59

Re: ALSA - High CPU usage on the default device

Postby debiman » 2017-10-31 19:16

dunno.
maybe the common denominator is alsa, maybe it's something else.
if the processes with high cpu cycles are vlc and foobar2000, that's where i'd start the research.
or maybe troubleshooting: can you reproduce this with every media playback? every player, starting with aplay?
User avatar
debiman
 
Posts: 1539
Joined: 2013-03-12 07:18

Re: ALSA - High CPU usage on the default device

Postby andoru » 2017-10-31 19:24

As I mentioned in my first post, I've changed the subdevice in VLC, and the CPU problem went away. It can't be anything but ALSA.
I support Universal Basic Income, and so should you, here's why. Another reason why.
Commonly asked questions about UBI
Spread the word!
andoru
 
Posts: 236
Joined: 2014-03-14 16:59


Return to Desktop & Multimedia

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable