2019-07-18

FreeBSD audio setup

For magical reasons, audio on my FreeBSD desktop has just worked. That was true in VLC as well Firefox. Today I plugged in a set of USB headphones and somehow expected things to just work. No such luck.  dmesg yields:

uaudio0 numa-domain 0 on uhub1
uaudio0: on usbus0
uaudio0: Play: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play: 44100 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play: 32000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play: 24000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play: 16000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play: 8000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 44100 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 32000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 24000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 16000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 8000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: No MIDI sequencer.
pcm6: numa-domain 0 on uaudio0
uaudio0: HID volume keys found.


It took some exploring but I finally found that I had to tell pulse audio what "sink" to use.  The sinks are given by the pcm number and for some reason pulse wasn't picking the device given by hw.snd.default_unit which would have been 6 in my case (see pcm6 above) but 4.  I don't know where that 4 came from.  So I did a couple of things.  First off I updated /etc/sysctl.conf to include:

hw.snd.default_auto=2
hw.snd.default_unit=6

Then I updated /usr/local/etc/pulse/client.conf to include:

default-sink = 6
default-source = 6


I still have an issue with xmixer but that's another problem for another day.