colinrmitchell.com

Blog

Getting surround sound for PC-BSD

Posted Tuesday, January 8th 2013 in FreeBSD - Permalink

PC-BSD comes with the FreeBSD OSS-based sound kernel modules pre-compiled into the kernel. For my home computer, I have installed an older Creative SoundBlaster Live! sound card, which has multiple outputs. I wanted to use this with a 5.1 stereo to get surround sound for music, movies, and games.

The FreeBSD sound module contains a driver (snd_emu10k1) which allows the sound card to work, but does not give more than one sound device for the sound card. I then tried installing audio/snd_emu10kx, another driver for these cards. This driver gave me two dsp devices for the front and rear channels of the sound card. This could have worked with extra software put on top to demultiplex surround-sound audio channels, but I didn’t find an easy way to do it.

My next option was to install OSS v. 4 from ports, which is the OSS from 4Front. This was pretty easy to do once I figured out the correct steps. The first thing to do is disable the built-in sound module in PC-BSD. This is compiled into the kernel, not loaded as a module. Hence, we need to rebuild the kernel.

You will need the kernel sources installed in order to rebuild the kernel. You will also need the ports tree installed, since we will be building OSS4 from ports. You can do this by entering the PC-BSD System Configuration menu and selecting the “Tasks” tab. Then you can install the system source and the ports tree.

First, edit the file /usr/src/sys/<arch>/conf/GENERIC, where <arch> is your architecture. Comment out any lines in the “Sound Support” section.

Next, rebuild the kernel and install it:

# cd /usr/src/sys/amd64/conf/
# config GENERIC
# cd ../compile/GENERIC
# make cleandepend && make depend
# make; make install
# reboot now

After the systems comes back up from the reboot, you should have no sound system installed. Now, we can build and install OSS4:

# cd /usr/ports/audio/oss
# make install clean

Once OSS is built and installed, you can test it using osstest. If you have multiple sound cards installed, such as the SoundBlaster along with the motherboard’s internal audio, you may need to set the default card to be the correct audio device. For example, I have ten dsp devices, and dsp10 is the device for 5.1 audio channel to the sound card. You can find which system device is for your desired audio device by using the ossinfo command. Remove the link to the current default sound card and set it to your proper device:

# cd /dev
# rm dsp
# ln -sf /dev/dsp10 /dev/dsp

You should now have surround sound. You can test the individual surround sound channels by downloading and playing the test file at http://www.lynnemusic.com/surround.html. For example, to test it with mplayer,

# mplayer -ao oss -channels 6 www_lynnemusic_com_surround_test.ac3

The point of all of this, for me, was to get surround sound for Zandronum. I run this game through the Linux compatibility layer, since it uses FMOD sound libraries, which are not available for FreeBSD. I was able to get surround to work by installing the audio/linux-f10-alsa-lib and audio/linux-f10-alsa-plugins-oss ports. After installation, I was able to get surround sound in Zandronum using the OSS Linux sound driver.


List Posts Newest Posts Page 1Next Page