FreeBSD setup sound:


Open the file /boot/defaults/loader.conf

Find the Sound modules section and edit the line that turns on all sound drivers.
snd_driver_load="YES"         # All sound drivers

This will load all the sound drivers. Reboot the system.

Once logged back in type:
dmesg | grep pcm0

This shows:
pcm0: <Intel ICH4 (82801DB)> port 0xb800-0xb8ff,0xbc40-0xbc7f mem 0xf4fff800-0xf4fff9ff,0xf4fff400-0xf4fff4ff irq 9 at device 31.5 on pci0
pcm0: <SigmaTel STAC9750/51 AC97 Codec>

Mine uses Intel ICH
Loading all the sound drivers adds 10 to 30 seconds to the boot time. We know the correct driver now so lets go back to /boot/defaults/loader.conf and switch snd_driver_load="YES" to NO

Hunt down the driver we found and switch it to YES:
snd_ich_load="YES"         # Intel ICH

Not sure if the sound driver is always pcm0, so you may have to just use dmesg and scroll to find the correct line.

Before this error was fixed, if you started KDE you may see this error:

Sound server informational message:
Error wile initializing the sound driver:
device /dev/dsp can't be opened (No such file or directory)
The sound server will continue, using the null output device.

Test to see if you found the correct driver. If KDE is installed you should hear startup and shutdown sounds. If you don't use KDE feel free to play an mp3 or movie file to test the sound. If you don't have speakers, why you reading this? Me, I was curious.

Dell Latitude D630 had this in dmesg:
pcm0: at cad 0 nid 1 on hdac0
Had to choose this driver in loader.conf
snd_hda_load="YES"         # Intel High Definition Audio (Controller)
This worked in frebesd7.2, but did not with 7.0. Had something to do with the hda driver. There was some information for a patch, but I never bothered since it still worked with headphones and knew a fix would be coming.