The officially official Devuan Forum!

You are not logged in.

#1 2025-09-28 21:55:10

igorzwx
Member
Registered: 2024-05-06
Posts: 337  

How to fix Chromium's ALSA backend (+ fix for Brave Browser)

ALSA - Gentoo Wiki
_https://wiki.gentoo.org/wiki/ALSA#Firefox.2C_Chromium.2C_and_YouTube_have_no_audio_with_custom_.asoundrc_but_other_apps_do

Both browsers [Firefox and Chromium] either depend on pulseaudio to set up correct sample rate or in absence of pulseaudio set sample rate to 48000 as defacto standard in sound card world.

NOTE: For dmix with the fftrate resampler, any sample rate is consumable. It should play sound without problems.

Experiment:

1. .asoundrc was generated by arateconf (with dmix, dsnoop, etc.)

2. the same YouTube video is played with Firefox and Chromium (with and without apulse)

$ firefox --version
Mozilla Firefox 140.3.0esr

Firefox with ALSA (with apulse):

$ apulse firefox 2>&1
Input:  48000 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 1920
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  48000 --> 48000 (J: 0.00%, T: None, W: Planar)
Ok.

Firefox with ALSA (without apulse) - notice the difference:

$ firefox 2>&1
Input:  44100 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 1764
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  44100 --> 48000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.

Input:  44100 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 1764
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  44100 --> 48000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.

Input:  48000 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 1920
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  48000 --> 48000 (J: 0.00%, T: None, W: Planar)
Ok.

Chromium:

$ chromium --version
Chromium 140.0.7339.207 built on Debian GNU/Linux 12 (bookworm)

Chromium with ALSA (with apulse):

$ apulse chromium 2>&1
Input:  44100 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 1764
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  44100 --> 48000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.

Input:  44100 Hz, 2 ch, 's32_le' (0xa): dummy = 0, period = 1764
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  44100 --> 48000 (J: 0.00%, T: FFT, W: Vorbis)
Ok.

Chromium with ALSA (without apulse) - sound quality is horrible:

$ chromium 2>&1
Input:  48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  48000 --> 48000 (J: 0.00%, T: None, W: Planar)
Ok.

Input:  48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  48000 --> 48000 (J: 0.00%, T: None, W: Planar)
Ok.

dmix does not employ resampling:

Rates:  48000 --> 48000 (J: 0.00%, T: None, W: Planar)

The most likely cause of audio distortions is, perhaps, Chromium ALSA backend.

To improve sound quality with Chrome, Chromium, Brave, Min, and the like, one may try to use them with apulse.

EDIT:

This seems to be a solution:

chromium 2>&1 --audio-buffer-size=4096
$ chromium 2>&1 --audio-buffer-size=8192
Input:  48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  48000 --> 48000 (J: 0.00%, T: None, W: Planar)
Ok.

Input:  48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  48000 --> 48000 (J: 0.00%, T: None, W: Planar)
Ok.

The same solution works for Brave Browser:

$ brave-browser-stable 2>&1 --audio-buffer-size=8192
Input:  48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  48000 --> 48000 (J: 0.00%, T: None, W: Planar)
Ok.

Input:  48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  48000 --> 48000 (J: 0.00%, T: None, W: Planar)
Ok.

Input:  48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Output: 48000 Hz, 2 ch, 's16_le' (0x2): dummy = 0, period = 1920
Rates:  48000 --> 48000 (J: 0.00%, T: None, W: Planar)
Ok.

With the default audio-buffer-size, Brave Browser produces the same audio distortions.

Redirection of stderr to stdout, 2>&1, is used to print debug information from the fftrate resampler.

Desktop launcher for Brave Browser (with fix for ALSA):

$ cat ~/.local/share/applications/brave-browser.desktop
[Desktop Entry]
Version=1.0
Name=Brave Web Browser
GenericName=Web Browser
Comment=Access the Internet
Exec=/usr/bin/brave-browser-stable --audio-buffer-size=8192 %U
StartupNotify=true
Terminal=false
Icon=brave-browser
Type=Application
Categories=Network;WebBrowser;
MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/http;x-scheme-handler/https;
Actions=new-window;new-private-window;

[Desktop Action new-window]
Name=New Window
Exec=/usr/bin/brave-browser-stable --audio-buffer-size=8192

[Desktop Action new-private-window]
Name=New Incognito Window
Exec=/usr/bin/brave-browser-stable --incognito --audio-buffer-size=8192

The Brave browser includes a built-in ad-blocking feature called Brave Shields that automatically blocks unwanted advertisements and trackers on most websites and video platforms by default, offering a cleaner, faster, and more private browsing experience without needing third-party extensions.

Last edited by igorzwx (2025-09-29 14:39:40)

Offline

Board footer