You are not logged in.

#1 2020-01-24 10:57:06

Delgan
Member
Registered: 2020-01-24
Posts: 9

Firefox doesn't detect microphone without PulseAudio (sound is OK)

Hi.

I know that Firefox depends on PulseAudio since version 52 and that it won't work very well with an ALSA-only system (see bug 1345661).

I don't have "pulseaudio" installed, yet audio on Firefox is working well. However, there is no microphone detected by Firefox on this test page: https://mozilla.github.io/webrtc-landing/gum_test.html

The output of "arecord -lL" is:

null
    Discard all samples (playback) or generate zero samples (capture)
jack
    JACK Audio Connection Kit
default:CARD=PCH
    HDA Intel PCH, ALC256 Analog
    Default Audio Device
sysdefault:CARD=PCH
    HDA Intel PCH, ALC256 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC256 Analog
    Front speakers
usbstream:CARD=PCH
    HDA Intel PCH
    USB Stream Output
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC256 Analog [ALC256 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Installed packages:

~ λ pacman -Q firefox libpulse alsa-lib pulseaudio
firefox 72.0.2-1
libpulse 13.0-3
alsa-lib 1.2.1.2-3
error: package 'pulseaudio' was not found

The microphone is working well when I test it with "arecord --duration 3 --format=dat test-mic.wav". If I install "pulseaudio" and reboot my system, the microphone is properly detected and usable by Firefox.

I have a few questions:
* Why is audio working well although I don't have "pulseaudio" installed? Is it thanks to "libpulse", which is required while installing firefox from repo?
* Why is microphone not detected while audio is working well? Is microphone support not implemented by libpulse?
* Is there any known solution to solve this problem without the need to install pulseaudio? I have found a lot of problems related to audio on Firefox, but few about the microphone.

Thanks in advance for your help.

Last edited by Delgan (2020-01-24 11:09:04)

Offline

#2 2020-01-24 12:01:26

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,660

Re: Firefox doesn't detect microphone without PulseAudio (sound is OK)

The Arch Firefox package has alsa enabled still, contrary to upstream suggestions/support. No libpulse doesn't matter,   at all, that's for implementing (surprise) pulse support. It doesn't factor into play when you are using just ALSA. When just using ALSA alsa-lib is what's likely being used.

Firefox always had a weird logic to detecting the sound card using ALSA FWIW you might want to check in a terminal whether you get any information and maybe post your

about:support

from firefox. Do you have any custom asound.conf /ALSA config? Post them as well.

Last edited by V1del (2020-01-24 12:06:59)

Offline

#3 2020-01-24 13:04:05

Delgan
Member
Registered: 2020-01-24
Posts: 9

Re: Firefox doesn't detect microphone without PulseAudio (sound is OK)

Thanks for the answers!

My ALSA configuration is the default one, I have not changed any settings afaik.

When PulseAudio is not installed, I see that:

PulseAudio OFF - Microphone
PulseAudio OFF - Support

Media
-----

Audio Backend: alsa
Max Channels: 10000
Preferred Sample Rate: 48000
Output Devices
Name: Group
default: default
Input Devices
Name: Group
default: default

When Pulseaudio is installed:

PulseAudio ON - Microphone
PulseAudio ON - Support

Media
-----

Audio Backend: pulse-rust
Max Channels: 2
Preferred Sample Rate: 44100
Output Devices
Name: Group
Built-in Audio Analog Stereo: /devices/pci0000:00/0000:00:0e.0/sound/card0
Input Devices
Name: Group
Monitor of Built-in Audio Analog Stereo: /devices/pci0000:00/0000:00:0e.0/sound/card0
Built-in Audio Analog Stereo: /devices/pci0000:00/0000:00:0e.0/sound/card0

So, I probably need to somehow give a hint to Firefox about my audio interfaces.

Last edited by Delgan (2020-01-24 16:45:38)

Offline

#4 2020-01-24 15:36:02

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,660

Re: Firefox doesn't detect microphone without PulseAudio (sound is OK)

"default" should be the device to use, does that strictly not work? You aren't going to have a "pretty name" as Firefox strictly enumerates on the PCMs (which is why I asked you if you've set up any config, as one can easily "break" the config in a way that will work with most tools that aren't dead set on expecting a PCM from the aplay -L listing like firefox). Do you care about a pretty name? Does

arecord -Ddefault test-mic.wav

not work?

Also please post only thumbnails or links of the images.

Last edited by V1del (2020-01-24 15:54:32)

Offline

#5 2020-01-24 17:14:16

Delgan
Member
Registered: 2020-01-24
Posts: 9

Re: Firefox doesn't detect microphone without PulseAudio (sound is OK)

V1del wrote:

"default" should be the device to use, does that strictly not work? You aren't going to have a "pretty name" as Firefox strictly enumerates on the PCMs (which is why I asked you if you've set up any config, as one can easily "break" the config in a way that will work with most tools that aren't dead set on expecting a PCM from the aplay -L listing like firefox). Do you care about a pretty name? Does

arecord -Ddefault test-mic.wav

not work?

Well, "pretty names" would be better of course, but I don't care much for now, getting the microphone to work is the most important.

The "arecord -Ddefault test-mic.wav" command works fine, my voice is properly recorded. However, Firefox does not seem to receive any sound while using the "default" microphone.

I made a test with another website and observed something curious : https://online-voice-recorder.com/
See the result here: https://i.imgur.com/v0dGzTK.gifv
Although I'm waiting more than 10 seconds, the output only looks to last for 0.5 seconds.
So, maybe that the microphone is actually correctly detected, but Firefox does not use the proper configuration for sampling or something?

V1del wrote:

Also please post only thumbnails or links of the images.

Sorry, I edited the post accordingly.

Offline

#6 2020-05-16 19:09:04

Rio6
Member
Registered: 2016-01-16
Posts: 9

Re: Firefox doesn't detect microphone without PulseAudio (sound is OK)

Hello, did you manage to solve it? I'm also having the same problem.

Offline

#7 2020-05-17 06:45:19

Delgan
Member
Registered: 2020-01-24
Posts: 9

Re: Firefox doesn't detect microphone without PulseAudio (sound is OK)

Rio6 wrote:

Hello, did you manage to solve it? I'm also having the same problem.

No, I couldn't find any other solution than to leave PulseAudio installed.

Offline

#8 2020-08-16 17:45:25

Achelinux
Member
Registered: 2017-03-11
Posts: 3

Re: Firefox doesn't detect microphone without PulseAudio (sound is OK)

Hi Delgan,

I had he same issue you had and found the following solution partly on the "Gentoo Forums"¹ and on the "Independent ALSA and linux audio support site"².

Output
Firefox is able to output audio through ALSA directly.

Input
Apparently due to dependencies of Firefox's WebRTC API, Firefox requires
either

  • the Pulseaudio-Sound-Server
    or

  • the Alsa-Pulseaudio-Compabilty-Layer (Apulse)³.

1. So, to not install Pulseaudio we install and use Apulse instead.⁴
2. Furthermore, it apparently is necessary to enable ALSA's duplex capabilities in your ALSA configuration file for simultaneous audio in- and output, in my case it is the asound.conf.²|⁵

    My working asound.conf:

  • Notice my first three deactivated lines, when I was using ALSA only for Playback

  • It is necessary that you specify your own Card-Number and Device-Number accordingly. "hw:Card-Number,Device-Number"

#defaults.ctl.card 1
#defaults.pcm.card 1
#defaults.pcm.device 0


pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:1,0"
        period_time 0
        period_size 1024
        buffer_size 8192
   rate 44100
    }
 
    bindings {
        0 0
        1 1
    }
}

pcm.asymed {
        type asym
        playback.pcm "dmixer"
        capture.pcm "hw:1,0"
}


 
pcm.dsp0 {
    type plug
    slave.pcm "asymed"
}
 
pcm.!default {
        type plug
        slave.pcm "asymed"
}
 
pcm.default {
   type plug
   slave.pcm "asymed"
}
 
ctl.mixer1 {
    type hw
    card 1
}

3. To start Firefox using Apulse, execute

apulse firefox

    For convenient launching change the launch command of your launcher accordingly.

I hope this helps.

All the Best
Oliver

¹https://forums.gentoo.org/viewtopic-t-1112504-start-0.html
²https://alsa.opensrc.org/Asym
³Apulse is a compabilty layer for ALSA, tricking programs like Firefox into thinking they are communicating with Pulseaudio, but which they are not.
⁴https://aur.archlinux.org/packages/apulse/
⁵https://forums.gentoo.org/viewtopic.php?p=958187

Last edited by Achelinux (2020-08-16 18:06:13)

Offline

Board footer

Powered by FluxBB