Pratik Devkota
Pratik Devkota
I am a software engineering student interested in UNIX (GNU/Linux, *BSD, etc.), security as well as free and open-source software.

Setting up Sound in FreeBSD 13

- Advertisement -

In this article, I am going to go through the process of setting up sound in FreeBSD (13.1-RC6, to be precise). All of the credits goes to the FreeBSD Handbook. I am merely just documenting the process.

Determing Correct Drivers

In order for our FreeBSD system to be able to output sound, we need to load the correct drivers. Since, the FreeBSD kernel uses the microkernel architecture, most of the system is dynamically configurable. That is, we can dynamically load different kernel modules depending on the hardware we have. On FreeBSD, kernel modules are loaded via the kldload(8) command. FreeBSD makes available the snd_driver module which is essentially a metadriver . It loades all of the common sound drivers so that we can determine which one we need. So let’s use that for our system as well.

# kldload snd_driver

We can now view the contents of /dev/sndstat.

This can give use hints for the required driver sound card. We can have the driver automatically be loaded at boot by telling it to the FreeBSD loader. The configuration for the loader is done in /boot/loader.conf. Tell it to load our snd_driver with the snd_driver_load="YES" option.

Testing Sound

There are various ways we can test if sound is working on our system. Since all we care is that the sound card is able to output sound, we can use the /dev/dsp device node to test this. We can send any data to that device file and the speakers will produce sound.
cat <(echo "hello") > /dev/dsp

It is to be noted that, the /dev/dsp devices won’t show up in the output of ls as they’re created automatically when needed.


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook