# Chromium audio



## grahamperrin@ (Jan 28, 2022)

With Teams, neither the _microphone_ nor the _speaker_ can be changed.

Is this normal?






www/chromium only in this topic, please.


----------



## Geezer (Jan 28, 2022)

In skype for web within chromium with standard options, the microphone  could not be changed. (And possibly speakers, I do not remember.)

Rebuilding it with [the.dreaded] pulseaudio [/the.dreaded] gave me the options to change all that lot.


----------



## MarcoB (Jan 28, 2022)

Chromium uses sndio by default.


----------



## grahamperrin@ (Jan 28, 2022)

MarcoB said:


> Chromium uses sndio by default.



Does sndio not allow audio devices to be chosen as pictured above? 

Is `sysctl hw.snd.default_unit=3` as root the only workaround in situations such as this?


----------



## grahamperrin@ (Feb 26, 2022)

Teams <https://teams.microsoft.com/> 

A few days ago I tried to use the microphone in a USB headset. The other person couldn't hear me. 

Teams for personal use <https://teams.live.com/>

If anyone would like to help me test (with www/chromium), please send a private message. Thanks.


----------



## grahamperrin@ (Feb 27, 2022)

Thanks to the person who volunteered to test 

Before opening Chromium, I used mixer(8) in FreeBSD 14.0-CURRENT to change the default e.g.

`mixer -d3`

– with a SteelSeries Siberia 350 v3 headset at `pcm3`.



Spoiler: SteelSeries Siberia 350 lines from /var/log/messages





```
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: ugen0.6: <SteelSeries SteelSeries Siberia 350> at usbus0
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0 on uhub6
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: <SteelSeries SteelSeries Siberia 350, class 0/0, rev 1.10/2.08, addr 20> on usbus0
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: Play[0]: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: Play[0]: 44100 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: Play[0]: 22050 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: Play[0]: 16000 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: Play[0]: 11025 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: Play[0]: 8000 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: Record[0]: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: Record[0]: 44100 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: Record[0]: 22050 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: Record[0]: 16000 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: Record[0]: 11025 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: Record[0]: 8000 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: No MIDI sequencer.
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: pcm3: <USB audio> on uaudio0
Feb 27 12:24:33 mowa219-gjp4-8570p-freebsd kernel: uaudio0: HID volume keys found.
```




At <https://teams.live.com/>, audio and video were fine.

During the call, I could

switch from one camera to another
not switch audio (a minor annoyance, not a show-stopper).



```
% pkg info -x chromium
chromium-97.0.4692.99
% uname -aKU
FreeBSD mowa219-gjp4-8570p-freebsd 14.0-CURRENT FreeBSD 14.0-CURRENT #4 main-n253343-9835900cb95-dirty: Wed Feb 23 00:14:15 GMT 2022     root@mowa219-gjp4-8570p-freebsd:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64 1400053 1400053
%
```

Applicable package upgrades include chromium 98.0.4758.102_3.

I'll retry <https://teams.microsoft.com/> with a work colleague, maybe next week.

Postscript, 2022-03-17

I have been on leave for much longer than expected. The opportunity to test with a work colleague must wait until my return to work.


----------



## argwings (Feb 27, 2022)

I switched to Chromium the other day, but I noticed immediately the sound quality is bad and stutters a lot. I didn't experience this with Firefox. Any suggestions? For inexplicable reasons I can't successfully build certain big ports anymore, so ideally it would be some sndio tweak (I guess that's the default from pkgs?).


----------



## argwings (Feb 27, 2022)

Seems like running sndiod helped.


----------



## grahamperrin@ (Feb 27, 2022)

argwings said:


> … sound quality is bad and stutters a lot.



The same for me, long ago. _Excruciatingly_ bad.

Audio was fine, today.



> I didn't experience this with Firefox.



The same for me.



> Any suggestions?



Hopefully `sndiod_enable: YES` will provide a lasting improvement for you. 

I do have it enabled, but can't remember when I set the preference. 

If symptoms recur: let's have the version of FreeBSD, the version of Chromium, and whether your packages are from latest or quarterly. Thanks.


----------



## argwings (Feb 27, 2022)

It's still not ideal, I'm afraid. OSS was perfect. I'm using latest but I didn't build Chromium from source. I'm on FreeBSD 13.0-RELEASE-p7.

Specifically  chromium-98.0.4758.102_2 and sndio-1.8.1.


----------



## argwings (Feb 27, 2022)

I rebuilt sndio just to make sure I was actually on the latest version, since I was using a lot of packages. I'll build something heavy and see if I'm getting the same stuttering as before. It seems alright foro the moment!


----------



## cederom (Mar 1, 2022)

The same here. I am using PulseAudio by default. Can use padsp program to wrap oss capable audio into the PulseAudio. But Chromium uses sndio by default. And the sound is jittered. Why not use OSS as default backend?


----------



## argwings (Mar 1, 2022)

I don't think an OSS backend exists in Chromium and it's probably not trivial to write one. Firefox actually officially supports FreeBSD as far as I know.


----------



## argwings (Mar 1, 2022)

My bad, it's unofficial support. But that cubeb thingie is probably easier to port.


----------



## grahamperrin@ (Mar 1, 2022)

argwings said:


> Firefox



<https://forums.freebsd.org/posts/558467>


----------



## cederom (Mar 1, 2022)

Well, I usually use Firefox, but some web conferencing works only in Chrome(ium). SNDIO is really PITA. Setting AUDIODEVICE does not seem to work with my bluetooth headset. What is more Chromium does not seem to allow changing audio backend on the fly like Firefox can with CUBEB so I can select OSS or PulseAudio :-(

Most OSS applications can be wrapped with PADSP commnand that routes OSS audio to PulseAudio. I does not work with sndio.

PulseAudio is nice because I can change single stream input/output on the fly - for instance I can listen to music on loudspeakers, web browser on bluetooth headset, and some other stuff on USB audio card.. and I can change that without restarting application 

Thank you for your feedback and time.. another reason not to use Chromium.. but explain that to Zoom or Teams users ;-)


----------



## grahamperrin@ (Mar 1, 2022)

cederom said:


> PulseAudio



It's an option <https://www.freshports.org/www/chromium/#config> 

For anyone who's not already aware: 



grahamperrin said:


> Ports such as Chromium can take a surprisingly long time to build. I recommend ports-mgmt/poudriere-devel and poudriere-bulk(8) option `-b` to prefetch as many binaries as possible, to not waste your time.


----------



## argwings (Mar 1, 2022)

I haven't really tested Pulseaudio on FreeBSD much but whenever I derp around on Linux it seems pretty reliable nowadays. I feel like I have too many audio options already, so I just try to keep using OSS everywhere if possible. The perceptual audio quality is just better to me also.

If sndio gets more adoption it will naturally improve. The upgrade I did before (from quarterly I presume) was already noticeable.


----------



## cederom (Mar 1, 2022)

grahamperrin said:


> It's an option <https://www.freshports.org/www/chromium/#config>
> 
> For anyone who's not already aware:



This requires tremendous port rebuild.. sad these options cannot coexist at the same time so user can chose what to use with one binary fetched by pkg like it is with Firefox..


----------



## grahamperrin@ (Mar 1, 2022)

cederom said:


> tremendous port rebuild



Oof! From a brief, cancelled run: 

`[main-default] [2022-03-01_20h37m42s] [sigint:] Queued: 273 Built: 0   Failed: 0   Skipped: 0   Ignored: 0   Fetched: 0   Tobuild: 273  Time: 00:00:38`

Many of the 273 might build quickly, but with gargantuan Chromium at the tail end, it's simply not appealing.


----------



## patovm04 (Mar 1, 2022)

Hmmm Chromium sound quality was really bad for me till I tried changing the default* (48 kHz)* sndio sample rate to* 44.1 kHz*.
I just added this lines to /etc/rc.conf:

```
sndiod_enable="YES"
sndiod_flags="-r 44100"
```
It solved my problem. Maybe you can tinker with that


----------



## argwings (Mar 1, 2022)

Sounds good. I was messing around with mpv's OSS audio driver and I saw some cases where s32 was failing, and according to this -r from the sndio daemon is probably setting rate to to s16.


			sndio - hints on writing & porting audio code
		


My theory anyway.


----------



## argwings (Mar 1, 2022)

Well, t's a little washed out (and weirdly quieter) but less latency. I'll keep messing with it.


----------



## argwings (Mar 1, 2022)

This has a good bit about virtual_oss, which Chromium seems to pick up fine: https://wiki.freebsd.org/Sound#virtual_oss_.28advanced.29 
From a little testing it seems to work better without sndiod enabled. I'm not an audio junkie and shouldn't really comment further, but it looks like fun.


----------



## cederom (Mar 18, 2022)

grahamperrin said:


> Oof! From a brief, cancelled run:
> 
> `[main-default] [2022-03-01_20h37m42s] [sigint:] Queued: 273 Built: 0   Failed: 0   Skipped: 0   Ignored: 0   Fetched: 0   Tobuild: 273  Time: 00:00:38`
> 
> Many of the 273 might build quickly, but with gargantuan Chromium at the tail end, it's simply not appealing.



Could you please provide full invocation of poudriere bulk build that will allow me to select audio backend and build that Chrome package for me in 38 seconds ?

I am not familiar with poudriere but I have jails and port tree ready. Also my poudriere (version 3.3.7_1) bulk does not know -b switch. Your example above shows 273 tobuild and 0 built. If there is any magical way to shorten (i.e. 38h -> 38s) any port build with selected config options using poudriere then I was not aware of that.


----------



## grahamperrin@ (Mar 19, 2022)

cederom said:


> Could you please provide full invocation of poudriere bulk build that will allow me to select audio backend and build that Chrome package for me in 38 seconds ?



 it was from a _cancelled run_. Cancelled before build began.


----------



## cederom (Mar 19, 2022)

grahamperrin said:


> it was from a _cancelled run_. Cancelled before build began.


I was complaining that building whole web browser takes lots of time, then you replied with that cancelled poudriere. What was that gonna prove? Is there any faster way for local web browser build or no?


----------



## grahamperrin@ (Mar 20, 2022)

cederom said:


> What was that gonna prove?



I showed the number 273, please see page 1 for context.


----------



## cederom (Mar 20, 2022)

I already knew all that. Still you need long hours to rebuild browser even if everything around is ready. I thought you may know how to speed up browser build. Clearly package flavors would come handy here


----------



## blackhaz (Dec 4, 2022)

Are there any workarounds available for FreeBSD 13.1 without rebuilding Chromium? Bought a webcam but unable to select it's mic as the input device.


----------



## blackhaz (Dec 5, 2022)

I'll just leave it here. Chromium works if launching with environment variables explicitly setting which sndio device to use for input and output. In my case I do this in my verison of /usr/local/bin/chrome:


```
export AUDIODEVICE="rsnd/0"
export AUDIORECDEVICE="rsnd/2"
mixer -f /dev/mixer2 mic 50
```

rsnd/0 is the built-in sound card for output, rsnd/2 is the Logitech webcam connected via USB. Mixer setting below sets a reasonable mic level. Now I have Zoom, Teams and Google Meet in FreeBSD. Nice.


----------

