Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
No sound in web browser (ALSA only)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
mschilli
n00b
n00b


Joined: 17 Jul 2020
Posts: 18

PostPosted: Sun Feb 21, 2021 3:39 pm    Post subject: No sound in web browser (ALSA only) Reply with quote

Hello,

I arrived at a point where I do not know what else to do than ask for help.
I've setup a Gentoo system and ended up with everyhing working but sound.

I double-check my kernel config and globally enabled USE=alsa in make.conf,
followed by
Code:
emerge --newuse --deep
.
Also I installed media-sound/alsa-utils and added alsasound to the boot
runlevel.

After a reboot,

Code:
aplay -L


listed the following devices:

Code:
 null
    Discard all samples (playback) or generate zero samples (capture)
hdmi:CARD=HDMI,DEV=0
    HDA ATI HDMI, HDMI 0
    HDMI Audio Output
hdmi:CARD=HDMI,DEV=1
    HDA ATI HDMI, HDMI 1
    HDMI Audio Output
hdmi:CARD=HDMI,DEV=2
    HDA ATI HDMI, HDMI 2
    HDMI Audio Output
hdmi:CARD=HDMI,DEV=3
    HDA ATI HDMI, HDMI 3
    HDMI Audio Output
hdmi:CARD=HDMI,DEV=4
    HDA ATI HDMI, HDMI 4
    HDMI Audio Output
hdmi:CARD=HDMI,DEV=5
    HDA ATI HDMI, HDMI 5
    HDMI Audio Output
default:CARD=Generic
    HD-Audio Generic, ALCS1200A Analog
    Default Audio Device
sysdefault:CARD=Generic
    HD-Audio Generic, ALCS1200A Analog
    Default Audio Device
front:CARD=Generic,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    Front output / input
surround21:CARD=Generic,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Generic,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Generic,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Generic,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Generic,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Generic,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers


I am primarily interested in analogue stereo output to my desktop speakers or
headphones connected to the center out of my motherboard.
However, having the HDMI out work as well in case I need it in the future would
be a plus.

I tried running
Code:
speaker-test
but got an error:

Code:
 
speaker-test 1.2.3

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
ALSA lib /var/tmp/portage/media-libs/alsa-lib-1.2.3.2-r1/work/alsa-lib-1.2.3.2/src/pcm/pcm_dmix.c:1090:(snd_pcm_dmix_open) unable to open slave
Playback open error: -2,No such file or directory


Following https://wiki.gentoo.org/wiki/ALSA#Files, I created /etc/asound.conf to set the ddefault device to 'Generic'.
Then,

Code:
 speaker-test -t wav -c 2


was working just as expected.


Next, I tried playing audio via the web browser (www-client/qutebrowser)
using the following test website: https://midimusic.github.io/browsertest/#self

I could see the player moving through the song but there was no audio.
Of course I checked alsamixer and my plackback devices were no muted or
anything like that.

As a next test, I downloaded the an Ogg file from that very same test site,
installed mpv and tried to play it: No issues here.
So I have audio, but not in the browser, using the exact same file for testing.

Originally I had skipped over
https://wiki.gentoo.org/wiki/ALSA#Laptops_with_HDMI_audio_output, since it
specifically mentions Laptops and Firefox but on second look I understood that
I might need to remap my 'Generic' sound card as 'card0' and the 'HDMI' one as
'card1' to switch the default device for my browser.
Unfortunately, I do not have any test equipment to connect via HDMI to confirm
I get output there. Also, on my Laptop, where I have the same setup (ALSA only,
qutebrowser, analogue audio + HDMI audio), the order happened to be correct
without me ever having to change anything:

Code:
 cat /proc/asound/cards


Code:
 0 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xf5220000 irq 32
 1 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xf3000000 irq 17


Since I had compiled HD Audio support into my kernel, not as a module, the
modprobe-based solution suggested in
https://wiki.gentoo.org/wiki/ALSA#Laptops_with_HDMI_audio_output was of no use.

Instead, I modiefied my kernel command line as suggested in
https://wiki.gentoo.org/wiki/ALSA#HTML5_does_not_play_in_the_Firefox_browser.

With the 'snd-hda-intel.index=1,0' boot parameter, the order of cards was
fixed:

Code:
 0 [Generic        ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0xfcc00000 irq 74
 1 [HDMI           ]: HDA-Intel - HDA ATI HDMI
                      HDA ATI HDMI at 0xfc960000 irq 72


I confirmed that both speaker-test and mpv work just fine now, even without any /ect/asound.conf (or ~/.asoundrc for that matter).
However, there still is no audio in qutebrowser.

Since more or less the same setup is working fine on my other machine, I do not
know how to further troubleshoot this.

Both systems run without systemd but use elogind.
Also, I use the same USE flags for dev-qt/qtwebengine (alsa -bindist
-pulseaudio system-ffmpeg) on both systems.

However, the old system (with audio in the browser) is using X, and the new one
(without audio in the browser) Wayland.
So if you can suggest other browsers to test that don't require me to switch to
systemd + pulseaudio + X + Gtk when I want OpenRC + ALSA + Wayland + Qt, I'd
give those a try though my gut feeling tells me it's not the browser that is to
blame but something in my (ALSA?) configuration.
Also worth mentioning might be that while both systems run a non-desktop
profile, the old one is using plain default/linux/amd64/17.1 while the new
one is using the hardened version of the same profile.

I really don't know much about sound configuration but ever since OSS stopped
being a thing I never ran into any issues using just ALSA 'out of the box'
until now.

I tried various asound.conf examples I found all over the net, maybe
understanding half of them a quarter each, but whatever I tried, I usually
ended up with working audio in both speaker-test and mpv but never once got
any sound out of qutebrowser.

So I would be very happy about some pointers on how to figure out what I am
doing wrong (other than not 'simply running Unbuntu'). ;-)

Thank you in advance for your help.


Last edited by mschilli on Sun Feb 21, 2021 11:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
kajzer
l33t
l33t


Joined: 27 Nov 2014
Posts: 911

PostPosted: Sun Feb 21, 2021 11:11 pm    Post subject: Reply with quote

You didn't post .asoundrc configuration but just maybe if you specified rate in there and it's over 48000 then that might be the reason.
For example I don't have sound in firefox if rate is not 48000, that's the max that browser can support, if it's higher then it will not produce sound.
Don't know about qutebrowser though, but you might want to try in your config
Code:
rate 48000
Back to top
View user's profile Send private message
mschilli
n00b
n00b


Joined: 17 Jul 2020
Posts: 18

PostPosted: Sun Feb 21, 2021 11:22 pm    Post subject: Reply with quote

kajzer wrote:
You didn't post .asoundrc configuration but just maybe if you specified rate in there and it's over 48000 then that might be the reason.
For example I don't have sound in firefox if rate is not 48000, that's the max that browser can support, if it's higher then it will not produce sound.
Don't know about qutebrowser though, but you might want to try in your config
Code:
rate 48000


Thank you for the quick response.

I might not have made it clear, but I am not using any ~/.asoundrc (nor /etc/asound.conf).
I did try various version I found online, some including lines referring to rates, but no of them helped.
Also, on my other system, I am using ALSA only without any extra configuration (no ~/.asoundrc, no /etc/asound.conf) with the same browser (though different hardware) and it works.

I'd like to give you suggestion a try though but I want to make sure I understand how to do that exactly.
Starting with no ~/.asoundrc at all, would simply dropping that single line be all I need to do?
And if so, how do I make sure it is 'enabled'? Do I need to restart the browser? Restart the alsasound rc-service? Re-login with my user? Reboot the entire system?
Sorry if those are stupid questions but I wouldn't want to waste your time by 'trying' your suggestion but doing so wrong.

If there is any good (concise) documentation on this, I was not able to find it. So feel free to point me in the right direction if you know where I should find the information I seek.

edit: I did try adding that single line to ~/.asoundrc and restarting my browser: Nothing changed.
Also note that even without any ~/.asoundrc, mpv reports
Code:
AO: [alsa] 48000Hz mono 1ch float
when successfully playing back the test Ogg file.

Also, I am not sure to what extent one can extrapolate from Firefox since (according to https://wiki.gentoo.org/wiki/ALSA#Firefox.2C_Chromium.2C_and_YouTube_have_no_audio_with_custom_.asoundrc_but_other_apps_do) it requires PulseAudio and I am running an ALSA-only setup.
Back to top
View user's profile Send private message
kajzer
l33t
l33t


Joined: 27 Nov 2014
Posts: 911

PostPosted: Sun Feb 21, 2021 11:56 pm    Post subject: Reply with quote

You don't need to restart anything when you change something in .asoundrc, except if the sound is already used, then just stop it and start it again, to be safe.
Now, like I said, that's what got Firefox working for me with sound, without it there was no sound
It was worth a try for qutebrowser but it might not work, simply because it's possible that there's no alsa support at all for that browser, but I really can't tell that.
You might want to check this thread, it's for firefox but you might find something useful in there for your case.
https://forums.gentoo.org/viewtopic-t-1112504-postdays-0-postorder-asc-highlight-firefox-start-25.html

you can copy/paste that config file (.asoundrc) , just make sure you have the card number correct for your setup
Back to top
View user's profile Send private message
figueroa
Veteran
Veteran


Joined: 14 Aug 2005
Posts: 1204
Location: Edge of the Marsh USA

PostPosted: Mon Feb 22, 2021 3:04 am    Post subject: Reply with quote

Firefox sounds works fine with alsa only, but may need asound.
_________________
Andy Figueroa
andy@andyfigueroa.net Working with Unix since 1983.
Automate and Test Your Backups
Back to top
View user's profile Send private message
mschilli
n00b
n00b


Joined: 17 Jul 2020
Posts: 18

PostPosted: Mon Feb 22, 2021 7:14 am    Post subject: Reply with quote

kajzer wrote:
You don't need to restart anything when you change something in .asoundrc, except if the sound is already used, then just stop it and start it again, to be safe.
Now, like I said, that's what got Firefox working for me with sound, without it there was no sound


OK. Then the conclusion is that I tried that and it did not work.


kajzer wrote:
It was worth a try for qutebrowser but it might not work, simply because it's possible that there's no alsa support at all for that browser, but I really can't tell that.


Like I tried to point out several times before: I am using that exact same browser on another ALSA-only Gentoo system (also with both analogue system audio and digital HDMI audio) for years without any issues.
The browser is based on qtwebengine which I emerged with `USE=alsa`.
So there definitively is ALSA support for that browser.

edit: Also, if that already slipped through, let me reiterate as well that there never was the need for any manual alsa configuration on that system. I have sound in qutebrowser without PA, without ~/.asoundrc, and wiithout /etc/asound.conf using the same test site right now. Just not on my new system.

kajzer wrote:
You might want to check this thread, it's for firefox but you might find something useful in there for your case.
https://forums.gentoo.org/viewtopic-t-1112504-postdays-0-postorder-asc-highlight-firefox-start-25.html

you can copy/paste that config file (.asoundrc) , just make sure you have the card number correct for your setup


Thank you. I'll have a look.

edit: I tried the following ~/.asoundrc:

Code:
pcm.onboard_card {
   type hw
   card 0

   format S32_LE
   rate 48000
}

pcm.dmixplug {
   type plug
   slave.pcm "dmixer"
}

pcm.dmixer {
   type dmix # multi-stream mixing
   ipc_key 4897
   
   slave {
      pcm "onboard_card"
      channels 2 # adjust as necessary (e.g. 8 for 7.1 audio)
      format S32_LE
      rate 48000
   
      period_time 0
      period_size 1024 # double if you notice increased CPU load or crackling
      buffer_time 0
      buffer_size 8192 # some applications do not like smaller buffers
   }
}

pcm.!default pcm.dmixplug


This is exactly what you referenced, with the card changed from '2' to '0' in the third line since my 'Generic' device is 'card0'.
I restarted the browser and there was silence. :(


figueroa wrote:
Firefox sounds works fine with alsa only, but may need asound.


Good to know. Maybe then the Wiki should be updated to reflect that.

edit: Reading the thread linked above, I noticed that this restriction refers to the binary package only and going back to the Wiki it points that out as well. I just misread that part. Sorry for the noise.

But for my problem this information does not really give me anything new to try, does it?
Back to top
View user's profile Send private message
kajzer
l33t
l33t


Joined: 27 Nov 2014
Posts: 911

PostPosted: Mon Feb 22, 2021 9:35 am    Post subject: Reply with quote

Well, if the sound is not working only in qutebrowser then the problem is obviously in the qtwebengine or there's some bug in qutebrowser.
Are the versions of both packages the same or are they different, when you compare new vs old system (where the sound works) ?
If they are not, try matching those versions in the new system to be the same as in old one.
Back to top
View user's profile Send private message
mschilli
n00b
n00b


Joined: 17 Jul 2020
Posts: 18

PostPosted: Mon Feb 22, 2021 11:03 am    Post subject: Reply with quote

kajzer wrote:
Well, if the sound is not working only in qutebrowser then the problem is obviously in the qtwebengine or there's some bug in qutebrowser.


Is that the case? How do I know it is only qutebrowser? Does the browser directly talk to the kernel or are there layers in-between that could be different for mpv?


kajzer wrote:
Are the versions of both packages the same or are they different, when you compare new vs old system (where the sound works) ?
If they are not, try matching those versions in the new system to be the same as in old one.


They actually are no but chances are low the very latest update broke sound after a decade of never having such issues.
`qtwebengine` takes many hours to compile, so I can't check quickly. Also, I can't match the USE flags since I use X on one but Wayland on the other sytstem.
I can try to downgrade on the new system overnight though.

edit: Actually, the qtwebengine versions match and that part of qt does not have X or wayland USE flags. So all I need to do is match the qutebrowser version and I am confidenent enough that this won't be the issue, that I decided to update the old system right away to match the new one. So let's see if that breaks browser audio on my old machine. ;-)
Back to top
View user's profile Send private message
kajzer
l33t
l33t


Joined: 27 Nov 2014
Posts: 911

PostPosted: Mon Feb 22, 2021 11:26 am    Post subject: Reply with quote

Well, you said that mpv played ogg file with sound working, so I guess it's just qutebrowser.
If possible try to find other apps not producing sound as well.

I understand it takes a very long time to compile qtwebengine, system profile and X or no X (wayland) shouldn't matter in this case.
Not saying that would fix the problem anyway, but it's interesting that it's working on one and not on the other system, with same specs more or less.
So, the logical thing to me is to match what's possible from the working system.

It could be the hardened profile, I mean I run on hardened profile but I can't remember having sound issues, I had some graphical problems.
In any case here's my USE settings from make.conf, after -elogind is what I added to make hardened profile works for me with no issues, again I can't remember if the sound wasn't working, I think it worked though.
Code:
USE="-consolekit speex alsa -pulseaudio ffmpeg -libav -gnome -kde -systemd -bluetooth -ipv6 -cups zsh-completion -qt4 offensive vdpau vulkan -avahi -zeroconf -geolocation -gnome-online-accounts cryptsetup crypt
 zsh-completion -pam -elogind a52 aac acpi alsa branding cairo -cdda cdr dbus dri dts dvd dvdr emboss encode exif flac gif gpm gtk gui icu jpeg lcms libnotify mad mng mp3 mp4 mpeg ogg opengl pango pdf png policykit qt5 sdl spell startup-notification svg tiff truetype vorbis udev udisks unicode upower usb wxwidgets X xcb x264 xml xv xvid"
Back to top
View user's profile Send private message
mschilli
n00b
n00b


Joined: 17 Jul 2020
Posts: 18

PostPosted: Mon Feb 22, 2021 12:54 pm    Post subject: Reply with quote

So the update finished and also with the matching qutebrowser version, sound is still just fine on the old system

kajzer wrote:
Well, you said that mpv played ogg file with sound working, so I guess it's just qutebrowser.


I see the logic but I was hoping to find someone you knows what I did wrong.
But good guesses are better than nothing. ;-)


kajzer wrote:
If possible try to find other apps not producing sound as well.


Any specific suggestions what to try?


kajzer wrote:
II understand it takes a very long time to compile qtwebengine, system profile and X or no X (wayland) shouldn't matter in this case.
Not saying that would fix the problem anyway, but it's interesting that it's working on one and not on the other system, with same specs more or less.


I agree but my time to experiment is limited so I'd enjoy moving forward. ;-)


kajzer wrote:
So, the logical thing to me is to match what's possible from the working system.

It could be the hardened profile, I mean I run on hardened profile but I can't remember having sound issues, I had some graphical problems.
In any case here's my USE settings from make.conf, after -elogind is what I added to make hardened profile works for me with no issues, again I can't remember if the sound wasn't working, I think it worked though.
Code:
USE="-consolekit speex alsa -pulseaudio ffmpeg -libav -gnome -kde -systemd -bluetooth -ipv6 -cups zsh-completion -qt4 offensive vdpau vulkan -avahi -zeroconf -geolocation -gnome-online-accounts cryptsetup crypt
 zsh-completion -pam -elogind a52 aac acpi alsa branding cairo -cdda cdr dbus dri dts dvd dvdr emboss encode exif flac gif gpm gtk gui icu jpeg lcms libnotify mad mng mp3 mp4 mpeg ogg opengl pango pdf png policykit qt5 sdl spell startup-notification svg tiff truetype vorbis udev udisks unicode upower usb wxwidgets X xcb x264 xml xv xvid"


Good thoughts: Here are the global USE flags on the old system:

Code:
USE="a52 aac aalibs acl acpi alsa amd64 apm atm bcmath berkdb bidi bzip2 cdda cddb cdr cli crypt cscope css cups dri dts dvd dvdr emboss encode enscript fbcon fftw flac fortran ftp gdbm geoip ggi gif gimp ginal git gnuplot gphoto2 gpm graphviz gsl hscolour iconv icq id3tag ieee1394 imap ipv6 lame latex libcaca libglvnd libtirpc lm_sensors lua maildir mp3 mp4 mpeg mplayer msn multilib musicbrainz mx ncurses nls nocd nptl oog openmp pam pcmcia pcre pdf pie plotutils png posix python readline seccomp smp sound spell split-usr sse sse2 ssl svg symlink tcpd thinkpad threads tiff truetype unicode usb vcd vim-syntax vorbis vpx wifi win32codecs xattr zlib zsh-completion"


and here on the new one:

Code:
USE="acl alsa amd64 bzip2 crypt elogind hardened iconv ipv6 libglvnd libtirpc multilib ncurses nls nptl openmp pam pcre pie readline seccomp split-usr ssl ssp unicode xattr xtpax zlib"


Any insights which ones to experiment with first?
Back to top
View user's profile Send private message
kajzer
l33t
l33t


Joined: 27 Nov 2014
Posts: 911

PostPosted: Mon Feb 22, 2021 11:54 pm    Post subject: Reply with quote

You can try to play some video files with mpv on your drive
Or you can play youtube videos directly with mpv, like this one from the test browser page you posted
Code:
mpv https://youtu.be/8Pu3XSCH2L8


or maybe you can try to emerge firefox-bin and then play youtube video and see if there's sound
yes, firefox-bin use apulse but at least you would know that everything else on your system is right and that there's a problem with qtwebengine or qutebrowser itself , for some reason

can't really help you more than that, would have to install qutebrowser and qtwebengine in order to know more about this issue you're having
and I don't feel like doing that, it's been a very long time since I've installed anything that would require any *webkit, sorry :oops:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum