From 3ae69c39be1089c6f1d14a0247f4786e64ef2b2a Mon Sep 17 00:00:00 2001 From: Aaron Taylor Date: Mon, 8 Mar 2021 23:32:40 -0800 Subject: [PATCH] Added notes for increasing number of audio vchannels under FreeBSD. --- data/notes/freebsd_11.md | 68 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/data/notes/freebsd_11.md b/data/notes/freebsd_11.md index 009e557..d7b49c1 100644 --- a/data/notes/freebsd_11.md +++ b/data/notes/freebsd_11.md @@ -238,7 +238,7 @@ In `about:config`: Note that the `gfx.*` entries enable hardware acceleration since the Nvidia drivers I am using support cairo but not skia, or is it that cairo supports my -video drives and skia doesn't? +video drivers and skia doesn't? In preferences: @@ -276,6 +276,72 @@ create the file `~/.config/gtk-3.0/settings.ini` with contents: gtk-primary-button-warps-slider=false +# Audio Configuration # + +By default, FreeBSD only provides 16 virtual audio channels via `/dev/dsp`. +Since Firefox appears to open a new connection for each tab that plays audio +and does not release those connections as long as the tab remains open, I +sometimes encounter error messages like the following. + + mpv: can't open /dev/dsp! + +To verify the problem, use `fstat` to confirm that too many connections exist. + + ataylor@lagavulin:~ % fstat | grep dsp + ataylor mpv 42458 27 /dev 215 crw-rw-rw- dsp0.15 w + ataylor mpv 36531 27 /dev 194 crw-rw-rw- dsp0.11 w + ataylor mpv 24332 25 /dev 204 crw-rw-rw- dsp0.13 w + ataylor firefox 61929 48 /dev 209 crw-rw-rw- dsp0.14 w + ataylor firefox 61718 23 /dev 259 crw-rw-rw- dsp0.22 w + ataylor firefox 61718 47 /dev 296 crw-rw-rw- dsp0.46 w + ataylor firefox 61718 51 /dev 273 crw-rw-rw- dsp0.30 w + ataylor firefox 61718 64 /dev 284 crw-rw-rw- dsp0.40 w + ataylor firefox 61718 68 /dev 245 crw-rw-rw- dsp0.17 w + ataylor firefox 61718 70 /dev 265 crw-rw-rw- dsp0.25 w + ataylor firefox 61718 73 /dev 280 crw-rw-rw- dsp0.36 w + ataylor firefox 61718 74 /dev 188 crw-rw-rw- dsp0.10 w + ataylor firefox 61718 75 /dev 278 crw-rw-rw- dsp0.34 w + ataylor firefox 61718 76 /dev 272 crw-rw-rw- dsp0.29 w + ataylor firefox 61718 79 /dev 282 crw-rw-rw- dsp0.38 w + ataylor firefox 61718 80 /dev 293 crw-rw-rw- dsp0.43 w + ataylor firefox 61695 47 /dev 264 crw-rw-rw- dsp0.24 w + ataylor firefox 61695 48 /dev 279 crw-rw-rw- dsp0.35 w + ataylor firefox 61695 66 /dev 274 crw-rw-rw- dsp0.31 w + ataylor firefox 61695 69 /dev 292 crw-rw-rw- dsp0.42 w + ataylor firefox 61620 17 /dev 247 crw-rw-rw- dsp0.18 w + ataylor firefox 61620 72 /dev 291 crw-rw-rw- dsp0.41 w + ataylor firefox 61208 17 /dev 254 crw-rw-rw- dsp0.20 w + ataylor firefox 61208 18 /dev 275 crw-rw-rw- dsp0.32 w + ataylor firefox 61208 48 /dev 201 crw-rw-rw- dsp0.12 w + ataylor firefox 59654 45 /dev 276 crw-rw-rw- dsp0.33 w + ataylor firefox 59654 70 /dev 295 crw-rw-rw- dsp0.45 w + ataylor python2.7 82359 20 /dev 145 crw-rw-rw- dsp0.16 w + +Before proceeding, ensure that no processes have `/dev/dsp` open. IOW, the +above `fstat` list should be empty. + +With nothing using the audio device, increase the number of virtual channels +with `sysctl`. + + root@lagavulin:~ % sysctl -a | grep vchans + hw.snd.maxautovchans: 16 + dev.pcm.2.play.vchans: 1 + dev.pcm.1.play.vchans: 1 + dev.pcm.0.rec.vchans: 4 + dev.pcm.0.play.vchans: 16 + + root@lagavulin:~ # sysctl dev.pcm.0.play.vchans=256 + dev.pcm.0.play.vchans: 16 -> 256 + + root@lagavulin:~ # sysctl hw.snd.maxautovchans=256 + hw.snd.maxautovchans: 16 -> 256 + +Add the following two lines to `/etc/sysctl.conf` so the change persists. + + dev.pcm.0.play.vchans=256 + hw.snd.maxautovchans=256 + + # X11 Configuration # In `~/.Xresources`: -- 2.20.1