The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
Sound with FreeBSD - A How-To Guide 14 July 1999
Need more help on this topic? Click here
This article has 3 comments
Show me similar articles
Unless you are using an older version of FreeBSD (e.g. before FreeBSD 4.1) you should be reading the section in the handbook dealing with sound.

NOTE: I've been told that controllers have been removed starting with FreeBSD 4.0.   If you are running 4.*, then you need this information.

This article was submitted by HexGhost, a regular on the UnderNet IRC channel #FreeBSD.   Please contact him regarding this article.  His contact details are at the end of this article.  I'm afraid I can't help you as I don't have a sound card.

Here are some random notes which may be of help:

  • an AWE64 is basically an SB16 PnP with wavetable MIDI tacked onto it.
  • an AWE64 and AWE32 PnP are actually identical, except for included software and their memory expansion capabilities.
  • if your card uses the SB16 interface, you should have device pcm0 and device sbc0 in your kernel (this would apply to all ISA cards).
  • the newer PCI cards from SB (SoundBlaster) just need the pcm0 device.
Why sound?
Ever since I discovered FreeBSD I've been trying to find more ways to make it beat windows.  After all, I converted from Windows 95, and going from pretty-looking GUI to dismal (comparatively speaking) UNIX was a major change.  Since I don't use FreeBSD as a major server (other than an mp3 server), sound is a major thing for me.   Setting up sound in FreeBSD has two paths: kernel support or OSS.  OSS is a nice commercial way to go, around $15 to $20 and I hear it isn't bad.  However, if you're like me and hate to pay for something that you can do yourself, kernel support is the way to go.
Things you need to know first
Your first bet would be to gather information about your sound hardware.
  • Is it a SoundBlaster?
  • If so, what type?
  • If not, is it SoundBlaster compatible?
  • What IRQ/DMA is it on?
  • Is it PnP (Plug and Play)?

These are all important questions you need to address before attempting to add sound support. 

Modify the kernel
After finding and writing down all the information in the previous section, the next step is to modify your kernel.  For instructions on how to create a new kernel, refer to Configuring the FreeBSD Kernel section in the FreeBSD handbook.   Pay special attention to the section on Building and Installing a Custom Kernel.

This is where that information from the previous section comes into play.   Depending on what sound system you have, you will be doing one of two things.   If your sound system is Plug and Play, you will be using the PnP drivers.  If not (or if the PnP drivers don't work for your system) you can use the VoxWare drivers.   However, these are supposedly not as cool.  Your mileage may vary. 

PnP
Lets start with the PnP route.  Add the following lines to the bottom of your kernel:
#Sound Card
controller pnp0
device pcm0 at isa? port 0x220 tty irq 5 drq 1 flags 0x0 vector pcmintr

The first line is a comment.  The second adds the PnP controller.  The third is where the action is.  If your sound card is on different settings (IRQ/DMA/Address) then change the values accordingly.  After you add these lines, save and exit your text editor.

VoxWare
If you decided to go the VoxWare way, you need to check out:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html

This URL should contain the lines pertaining to your sound card.  Simply copy them instead of the pcm0 line from the previous section.

#Sound Card
controller snd0
device pas0 at isa? port 0x388 irq 10 drq 6 vector pasintr

Please note that the device line given above is an example only.  You need to refer to the URL above for the line appropriate to your needs.

Compile and install the kernel
Then you need to compile your kernel:
/usr/sbin/config <your kernel name>
cd ../../compile/<your kernel name>
make depend ; make ; make install 

Again, please refer to Configuring the FreeBSD Kernel section in the FreeBSD handbook.   Pay special attention to the section on Building and Installing a Custom Kernel.

The new kernel will be compiled and installed.  All you do now is reboot with the new kernel.

After rebooting with the new kernel
After you have rebooted, issue the one of the following command when root:

for PNP:

cd /dev sh MAKEDEV snd0

for VoxWare:

cd /dev sh MAKEDEV snd1 

For PnP cards, run pnpinfo as root to get your settings.

That should do it!  You now should have sound working. 

Trouble shooting
If this still doesn't work, you could have copied down the wrong line, or perhaps the wrong address/IRQ/DMA settings.

If after all this you still cannot get sound up, check out Undernet's #FreeBSD or email me at ghost@mmcable.com and I will help you out until it works.

- HexGhost, ghost@mmcable.com

Other references
These are the other references for sound that I know of.  Please add your comments if you know of other resources not listed here.

http://www.wicklein.org/~chrisw/FreeBSD/ Chris Wicklein instructions for a SoundBlaster 128 PCI card.
http://www.cis.ohio-state.edu/~matey/au88x0/ FreeBSD driver for Aureal Vortex-based sound cards (requires 4.0-stable or 5.0-current)
And this works for FreeBSD 4.0: http://defcon1.erudition.net/html/Hardware_Articles/PnP_Sound/PnP_Modem/SB-Live5/sb-live4.html
Sound under 4.* 20 July 2000
Richard Charron wrote in with this information.  Good on him.

This is for AWE64 support under 4.*:  Add this to your kernel:

device pcm

For instructions on how to create a new kernel, refer to Configuring the FreeBSD Kernel section in the FreeBSD handbook.   Pay special attention to the section on Building and Installing a Custom Kernel.  Then follow the other instructions found on this page.

Also, Dan Papasian wrote in to say this:

You may still have to remake your sound device as described here:

http://www.wicklein.org/~chrisw/FreeBSD/sb128pci.txt

New handbook section 3 December 2000
See also http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/sound.html

Need more help on this topic? Click here
This article has 3 comments
Show me similar articles