Re: Tragic State of FreeBSD Audio/Sound

From: Tomek CEDRO <tomek_at_cedro.info>
Date: Sun, 26 Jul 2026 13:37:05 UTC
On Sun, Jul 26, 2026 at 12:04 AM Tomoaki AOKI <junchoon@dec.sakura.ne.jp> wrote:
> (..)
> Not a fix, nor clarification of root cause, but as a workaround,
> adding
>
>   pgrep -U "$(id -u)" -x pulseaudio >/dev/null && killall pulseaudio
>   sleep 5
>
> lines between the conditional for XDG_RUNTIME_DIR and first pgrep line
> in your start-pipewire-freebsd script is working for me.
>
> 5 seconds of sleep may be tuned. Just set because `killall pulseaudio`
> took 1 to 3 seconds depending on underlying workloads by seeing repeated
> `ps | fgrep pulseaudio`, so add 2 second mergin (as I don't think
> this 1-3 secs is not yet have valid statistical backgrounds).
>
> If killall doesn't return until confirming all detected matching
> processes are finished, this guard does NOT have any sense, but
> unfortunately, it seems to return just after the signal was sent.

I also use PulseAudio for a long time with no problem as I have many
sources and sinks that I can re-route runtime. Waiting for operational
fire-and-forget PipeWire implementation on FreeBSD, so far no luck in
running :-)

One thing related here is that I had to disable/remove
/usr/local/etc/xdg/autostart/pulseaudio.desktop and start PA within my
X session _after_ it runs (using Enlightenment), otherwise
applications could not connect to daemon, which is important when
using mixers, oss emulation (padsp), SDL compatibility, etc. This is
important even if not using global daemon.

It is also possible to use local ~/.config/pulse/ configuration files
instead global /usr/local/etc/pulse/ and tune it according to your
needs.

Specifically daemon.conf contains things that may cause glitching:
* resample-method - impacts audio quality and cpu load, most likely
also glitching!!
* default-sample-format - select best possible as in sysctll (you may
also want to tune sysctl).
* default-sample-rate - select best possible as in sysctl.
* default-sample-channels - normally stereo unless you have 5.1/7.1
speakers. Using more than 2 may cause usb audio issues on bt
(dis)connects.
* default-channel-map - tune to match channels count.
* default-fragments and default-fragments-size-msec - tune to match low latency.

As mentioned above pulseaudio also depends on sysctl parameters that
may work better or worse depending on how things are matched.

The one thing problematic for me is snd_hda nid matrix setup. There is
still no easy way nor application to setup physical audio codec.
Playing in console is hard, complex, time consuming, and on one laptop
I ended up breaking the internal speaker sound output completely and I
have no windoze application to revert :D

Have a good weekend folks :-)
Tomek

--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info