Re: Using USB sound card with FreeBSD

From: Waitman Gobble <gobble.wa_at_gmail.com>
Date: Mon, 25 Oct 2021 14:50:55 UTC
On Mon, Oct 25, 2021 at 12:05 PM Tomasz CEDRO <tomek@cedro.info> wrote:
>
> On Mon, Oct 25, 2021 at 11:35 AM Olivier wrote:
> > Hi,
> > I have a system with no sound interface. I have tried to install a USB
> > sound card, but so far, I don't see how to use it.
> > What is the device (/dev/xvz) that I should be sending my sound to? In
> > the past I had devices like /dev/dspW0.0 but I see nothing with that USB
> > sound card.
> > TIA,
> > Olivier
>
> Hey Olivier, I assume you are using RELEASE / GENERIC kernel, so
> modules / drivers should be already in the system, you need to load
> them if they do not auto-load. Then using USB Audio card looks exactly
> the same as built-in audio card.
>
> As root execute:
> kldload snd_uaudio
>
> This will load the USB Audio module. After that attach USB Audio card
> and /dev/dspXX should show up.
>
> If you want this module auto-loaded at boot time put
> `snd_uaudio_load="YES"` in `/boot/loader.conf`.
>
> Make sure your card is recognised and supported. See `dmesg` output or
> watch first console after connecting the USB Audio card (Ctrl+Alt+F1
> to go there from X). If you do not have /dev/dsp despite loaded
> `snd_uaudio` try `usbconfig` to see if the card is attached and
> visible to the computer among other USB devices. If usb subsystem does
> not see the card then audio also won't see the card. In that case you
> may want to try different USB port, cable, check if that card works on
> another computer / os, etc.
>
> The simplest way to test if sound card works is to `cat /dev/random >
> /dev/dspXX` providing the device of interest you should hear random
> noise in the speakers. Also make sure with mixer that output is not
> muted.
>
> If you haven't read yet there is a Handbook section dedicated to Multimedia:
>
> https://docs.freebsd.org/en/books/handbook/multimedia/
>
> Good luck and have fun! :-)
>
> --
> CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
>


Also, I usually have to

# sysctl hw.snd.default_unit=4

( # of your device, might not be 4, in /dev/dsp* )

To set the USB device as the default. Setting the default permanently
may cause problems if the device is not plugged in on a reboot.

If you're not getting sound out of your web browser after plugging in
USB audio and setting hw.snd.default, there are two things you might
check - If you're using pulse audio you might have to run pulseaudio
with -k switch on command line, as the logged in user (probably not
root). You may have to restart the web browser depending on what sound
abstraction api you're using (SNDIO, pulse, etc).

-- 
Waitman Gobble