Bug#881715: alsa-utils:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
30 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils:

Andoru Ekkusu
Package: alsa-utils
Version: 1:7.7+16
Severity: normal


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:

_______________________________________________________________________

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?


-- System Information:
Debian Release: buster/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.13.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8),
LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages alsa-utils depends on:
ii kmod 24-1
ii libasound2 1.1.3-5
ii libc6 2.24-17
ii libfftw3-single3 3.3.6p2-2
ii libncursesw5 6.0+20170902-1
ii libsamplerate0 0.1.9-1
ii libtinfo5 6.0+20170902-1
ii lsb-base 9.20170808
ii whiptail 0.52.20-1+b1

alsa-utils recommends no packages.

alsa-utils suggests no packages.

-- no debconf information

Reply | Threaded
Open this post in threaded view
|

Bug#881715:

Andoru Ekkusu
Version: 1.1.3-1

My bad, I pressed "send" too soon, didn't get to fill in the proper info...
Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils: High CPU usage on the default device

Elimar Riesebieter
In reply to this post by Andoru Ekkusu
Control: found -1 1.1.3-1

Hi Andoru,

thanks for your bug report.

* Andoru <[hidden email]> [2017-11-14 16:13 +0200]:

> Package: alsa-utils
> Version: 1:1.1.3-1
> Severity: normal
>
>
> 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.

What makes you think an alsa process eats high cpu usage? Can you
post the tespective line with column headers aou of htop or top
please?

Thanks
Elimar
--
  Obviously the human brain works like a computer.
  Since there are no stupid computers humans can't be stupid.
  There are just a few running with Windows or even CE ;-)

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils: High CPU usage on the default device

Andoru Ekkusu
> What makes you think an alsa process eats high cpu usage?

You skipped a paragraph from my report:

> 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).

///

> Can you post the tespective line with column
> headers aou of htop or top please?

Sorry... could you elaborate what you mean? What parameters should I start htop to get he info you need?
Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils: High CPU usage on the default device

Elimar Riesebieter
* Andoru <[hidden email]> [2017-11-14 22:03 +0200]:

> > What makes you think an alsa process eats high cpu usage?
>
> You skipped a paragraph from my report:
>
> > 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).
>
> ///
>
> > Can you post the tespective line with column
> > headers aou of htop or top please?
>
> Sorry... could you elaborate what you mean? What parameters should I start
> htop to get he info you need?
Just run htop while an alsa-process needs high cpu load. Copy the
line which shows that from (h)top to this bug report. Or just file a
screenshot to a puplic server somewhere.

Elimar
--
    .~.
    /V\   L   I   N   U   X
   /( )\ >Phear the Penguin<
   ^^-^^

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils: High CPU usage on the default device

Andoru Ekkusu
Just run htop while an alsa-process needs high cpu load. Copy the
line which shows that from (h)top to this bug report. Or just file a
screenshot to a puplic server somewhere.

Alright:
VLC playing a FLAC file on the default device: 

>  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND 
> 26183 andoru    20   0 1191000  66424  46296 S  13.6  0.8   0:09.43 vlc 
___________________________________________________________________________________________________

VLC playing the same file with "Analog Front Speakers" subdevice selected under Audio -> Audio Device:

>  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND 
> 26183 andoru    20   0 1195412  69176  48644 S   1.3  0.9   0:11.35 vlc  

___________________________________________________________________________________________________

As you can see, the CPU decreased from 13.6% to 1.3% when switching the device.
___________________________________________________________________________________________________
To confirm that this is not an issue with the decoder in VLC here's VLC playing an OGG Vorbis file on the default device:

>  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND 
> 26183 andoru    20   0 1263372  76228  48368 S  18.3  1.0   0:15.95 vlc 
___________________________________________________________________________________________________

Same test as above, this time with an MP3 file:

>  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND 
> 26183 andoru    20   0 1416816  91532  60188 S  17.0  1.2   0:19.64 vlc

___________________________________________________________________________________________________

And foobar2000 playing FLAC OGG and MP3 files, respectively:


>  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND 
> 2375 andoru    20   0 1153140  62276  13140 S  21.3  0.8  29:36.91 foobar2000+

>  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND 
> 2375 andoru    20   0 1153140  62032  13140 S  24.6  0.8  29:16.33 foobar2000+

>  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND 
> 2375 andoru    20   0 1153140  72756  11808 S  22.6  0.9  29:03.99 foobar2000+


Let me know if you need any additional info.

Also, in the initial report, I forgot to mention that when I select "Analog Front Speakers" subdevice in VLC, with some decoders (particularly APE) and when the sample rate is below 44100Hz, I can hear some distortion (crackling on high pitched sounds), so I'm guessing the high CPU usage is maybe due to an inefficient resampler?
Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils: High CPU usage on the default device

Elimar Riesebieter
* Andoru <[hidden email]> [2017-11-14 23:45 +0200]:

> >
> > Just run htop while an alsa-process needs high cpu load. Copy the
> > line which shows that from (h)top to this bug report. Or just file a
> > screenshot to a puplic server somewhere.
> >
>
> Alright:
> VLC playing a FLAC file on the default device:
>
> >  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+
> COMMAND
> > 26183 andoru    20   0 1191000  66424  46296 S  13.6  0.8   0:09.43 vlc
Did you started vlc within wine?

Elimar
--
  Learned men are the cisterns of knowledge,
  not the fountainheads ;-)

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils: High CPU usage on the default device

Andoru Ekkusu
No...? Why would I do something silly like that?
Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils: High CPU usage on the default device

Elimar Riesebieter
In reply to this post by Andoru Ekkusu

Control: tags -1 unreproducible


* Andoru <[hidden email]> [2017-11-14 23:45 +0200]:

> >
> > Just run htop while an alsa-process needs high cpu load. Copy the
> > line which shows that from (h)top to this bug report. Or just file a
> > screenshot to a puplic server somewhere.
> >
>
> Alright:
> VLC playing a FLAC file on the default device:
>
> >  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+
> COMMAND
> > 26183 andoru    20   0 1191000  66424  46296 S  13.6  0.8   0:09.43 vlc
> ___________________________________________________________________________________________________
>
> VLC playing the same file with "Analog Front Speakers" subdevice selected
> under Audio -> Audio Device:
>
> >  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+
> COMMAND
> > 26183 andoru    20   0 1195412  69176  48644 S   1.3  0.9   0:11.35 vlc
>
> ___________________________________________________________________________________________________
>
> As you can see, the CPU decreased from 13.6% to 1.3% when switching the
> device.
I tried that on 3 different soundcards. I don't get vlc as a htop
COMMAND. It is always /usr/bin/vlc. Please tell me how you fired up
vlc. The %CPU usage isn't reproducible on none of the soundcards
handy for me.

> ___________________________________________________________________________________________________
> To confirm that this is not an issue with the decoder in VLC here's VLC
> playing an OGG Vorbis file on the default device:
>
> >  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+
> COMMAND
> > 26183 andoru    20   0 1263372  76228  48368 S  18.3  1.0   0:15.95 vlc
> ___________________________________________________________________________________________________
>
> Same test as above, this time with an MP3 file:
>
> >  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+
> COMMAND
> > 26183 andoru    20   0 1416816  91532  60188 S  17.0  1.2   0:19.64 vlc
>
> ___________________________________________________________________________________________________
>
> And foobar2000 playing FLAC OGG and MP3 files, respectively:
I don't know how you got foobar2000 into Debian but this isn't¬
maintained in the repos, so not relevant to this bug.

> Also, in the initial report, I forgot to mention that when I select "Analog
> Front Speakers" subdevice in VLC, with some decoders (particularly APE) and
> when the sample rate is below 44100Hz, I can hear some distortion
> (crackling on high pitched sounds), so I'm guessing the high CPU usage is
> maybe due to an inefficient resampler?

Try to cancel all pulseaudio stuff and test again. Let me know....

Elimar
--
  Never make anything simple and efficient when a way
  can be found to make it complex and wonderful ;-)

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils: High CPU usage on the default device

Andoru Ekkusu
In reply to this post by Andoru Ekkusu


> I tried that on 3 different soundcards. I don't get vlc as a htop COMMAND. It is always /usr/bin/vlc.

I swear I'm using the native VLC from the Debian repos.

> Please tell me how you fired up vlc.

I started VLC through OpenBox's menus, and on that menu the command to start VLC is simply 'vlc', which probably translates to 'bash -c vlc'. If I open a media file from the file manager, and there's no running instance of VLC, I get "/usr/bin/vlc --started-from-file" as the command name under htop.

> The %CPU usage isn't reproducible on none of the soundcards handy for me.

Have you actually tried it on a ALC887-VD or a similar integrated chip by Realtek?

> I don't know how you got foobar2000 into Debian but this isn't¬
> maintained in the repos, so not relevant to this bug.

I did not get it through Debian, I simply installed it in the default Wine prefix.

> Try to cancel all pulseaudio stuff and test again. Let me know....

I apologise, I think I did not mention this in the initial bug report, but I'm not using PA, nor do I have it installed. That's why I submitted this bug against ALSA.

Reply | Threaded
Open this post in threaded view
|

Bug#881715: [Pkg-alsa-devel] Bug#881715: alsa-utils: High CPU usage on the default device

Elimar Riesebieter
* Andoru <[hidden email]> [2017-11-16 02:22 +0200]:

> > I tried that on 3 different soundcards. I don't get vlc as a htop
> COMMAND. It is always /usr/bin/vlc.
>
> I swear I'm using the native VLC from the Debian repos.
>
> > Please tell me how you fired up vlc.
>
> I started VLC through OpenBox's menus, and on that menu the command to
> start VLC is simply 'vlc', which probably translates to 'bash -c vlc'. If I
> open a media file from the file manager, and there's no running instance of
> VLC, I get "/usr/bin/vlc --started-from-file" as the command name under
> htop.
>
> > The %CPU usage isn't reproducible on none of the soundcards handy for me.
>
> Have you actually tried it on a ALC887-VD or a similar integrated chip by
> Realtek?
Tested on ALC892, CX20561, emu10k1 and ES1371/1. None of them showed
high cpu usage.

Elimar
--
  "Talking much about oneself can also
   be a means to conceal oneself."
         -Friedrich Nietzsche

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#881715: [Pkg-alsa-devel] Bug#881715: alsa-utils: High CPU usage on the default device

Andoru Ekkusu

> Tested on ALC892, CX20561, emu10k1 and ES1371/1. None of them showed high cpu usage.

Could you let me know how you configured ALSA? It could be that I might have misconfigured something, but I wouldn't know what...
Is there some advanced testing/diagnonsis that I could try to do to figure out what's causing this?
Reply | Threaded
Open this post in threaded view
|

Bug#881715: [Pkg-alsa-devel] Bug#881715: alsa-utils: High CPU usage on the default device

Elimar Riesebieter
* Andoru <[hidden email]> [2017-11-16 23:47 +0200]:

> > Tested on ALC892, CX20561, emu10k1 and ES1371/1. None of them showed high
> cpu usage.
>
> Could you let me know how you configured ALSA? It could be that I might
> have misconfigured something, but I wouldn't know what...
> Is there some advanced testing/diagnonsis that I could try to do to figure
> out what's causing this?

Nothing special. Just install alsa-utils. No asoundrc. Thats it.

Elimar
--
  On the keyboard of life you have always
  to keep a finger at the escape key;-)

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#881715: [Pkg-alsa-devel] Bug#881715: alsa-utils: High CPU usage on the default device

Andoru Ekkusu
Okay... then what is there to do next?
Call me technologically illiterate, or say that I don't know of the inner workings of ALSA, but I don't think this can be a given that a simple task such as outputting audio could take 13-20% of a quad core CPU!
Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils: High CPU usage on the default device

Elimar Riesebieter
* Andoru <[hidden email]> [2017-11-17 15:12 +0200]:

> Okay... then what is there to do next?
> Call me technologically illiterate, or say that I don't know of the inner
> workings of ALSA, but I don't think this can be a given that a simple task
> such as outputting audio could take 13-20% of a quad core CPU!

Maybe your speakersystem needs some rectification?

Or you can ask here:
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Elimar
--
  Excellent day for drinking heavily.
  Spike the office water cooler;-)

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#881715: [Pkg-alsa-devel] Bug#881715: alsa-utils: High CPU usage on the default device

Elimar Riesebieter
In reply to this post by Andoru Ekkusu
* Andoru <[hidden email]> [2017-11-17 15:12 +0200]:

> Okay... then what is there to do next?
> Call me technologically illiterate, or say that I don't know of the inner
> workings of ALSA, but I don't think this can be a given that a simple task
> such as outputting audio could take 13-20% of a quad core CPU!

Do you have a $HOME/.asoundrc?

Did you tried mpg321, moc or any other console player?

Elimar
--
  The path to source is always uphill!
                                -unknown-

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils: High CPU usage on the default device

Andoru Ekkusu
In reply to this post by Andoru Ekkusu

> Maybe your speakersystem needs some rectification?

You mean the external speakers? I use headphones. I don't know what those have to do with ALSA or this issue I'm having.

I tried writing to alsa-devel, but I didn't get any reply: http://mailman.alsa-project.org/pipermail/alsa-devel/2017-November/126934.html

> Do you have a $HOME/.asoundrc?

___________________________________________________________________________________
$ locate asoundrc
~/.steam/ubuntu12_32/steam-runtime/amd64/usr/share/doc/libasound2/examples/asoundrc.txt.gz
~/.steam/ubuntu12_32/steam-runtime/i386/usr/share/doc/libasound2/examples/asoundrc.txt.gz
/usr/share/doc/libasound2/examples/asoundrc.txt.gz
___________________________________________________________________________________

> Did you tried mpg321, moc or any other console player?

What should I try specifically?
What parameters should I use?

Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils: High CPU usage on the default device

Elimar Riesebieter
* Andoru <[hidden email]> [2017-11-18 01:47 +0200]:

> > Maybe your speakersystem needs some rectification?
>
> You mean the external speakers? I use headphones. I don't know what those
> have to do with ALSA or this issue I'm having.
>
> > Or you can ask here:
> <http://mailman.alsa-project.org/mailman/listinfo/alsa-devel>
> > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
> I tried writing to alsa-devel, but I didn't get any reply:
> http://mailman.alsa-project.org/pipermail/alsa-devel/2017-November/126934.html
>
> > Do you have a $HOME/.asoundrc?
>
> ____________________________________________________________
> _______________________
> $ locate asoundrc
I meant .asoundrc. Please notice the dot.

$ find $HOME -name '.asoundrc*'

will do the trick

[...]
> > Did you tried mpg321, moc or any other console player?
>
> What should I try specifically?
> What parameters should I use

$ sudo apt install vorbis-tools
$ ogg123 -d alsa -o surround71 $YOUR_FAVORITE_OGG.ogg
$ man ogg123

With alsamixer you can control the output device.

Elimar
--
  "Talking much about oneself can also
   be a means to conceal oneself."
         -Friedrich Nietzsche

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils: High CPU usage on the default device

Elimar Riesebieter
In reply to this post by Andoru Ekkusu
* Andoru <[hidden email]> [2017-11-19 15:11 +0200]:

> > I meant .asoundrc. Please notice the dot.
> >
> > $ find $HOME -name '.asoundrc*'
> >
> > will do the trick
>
> Of course, that file search was meant for demonstration. I've already
> looked at the home folder with the file manager, but there was no
> .asoundrc. Thank you for the example command.
>
> > $ sudo apt install vorbis-tools
> > $ ogg123 -d alsa -o surround71 $YOUR_FAVORITE_OGG.ogg
> > $ man ogg123
> >
> > With alsamixer you can control the output device
>
> I did that now, and even with the default device, ogg123 was using 3.5-5%
> CPU, which is way better than with VLC.
> Command used:
>
> _____________________________________________________________________
> ogg123 -d alsa -o default -v ~/Desktop/sample2.ogg
> _____________________________________________________________________
>
> I've also tried to use the "front" subdevice, but it keeps reporting it as
> busy who-knows-why:
>
> _____________________________________________________________________
> ogg123 -d alsa -o dev:front -v ~/sample2.ogg
> _____________________________________________________________________
>
> I've also tried mpg123, and got similar results (~3% on the default device)
>
> I'm guessing then this isn't an ALSA issue... Though I'm not sure what's
> causing it in VLC and Wine.
So I am closing this bug hereby.

Thanks for cooperation
Elimar
--
  Never make anything simple and efficient when a way
  can be found to make it complex and wonderful ;-)

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#881715: alsa-utils: High CPU usage on the default device

Andoru Ekkusu
In reply to this post by Elimar Riesebieter
Forgot to check previously, but whenever I use those CLI players you suggested, they also monopolise the soundcard, making me unable to play other stuff in parallel, just like how it would happen when setting the specific subdevice in VLC. So, since I'm not able to use those CLI players to play with the default device to see if they use the same amount of CPU as VLC and other players/apps, this issue is still not solved.
That's why I asked you for specific commands that I can use with those CLI players.
12