DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 1st May 2008
corey_james corey_james is offline
Uber Geek
 
Join Date: Apr 2008
Location: Brisbane, Australia
Posts: 238
Default Sound on FreeBSD

Setting sound up on FreeBSD is quite simple and well documented but here's a simple how-to.

There are two ways to add sound support to FreeBSD - compile the driver into the kernel or dynamically load the driver. I'll just detail the latter as it's faster and easier.

First you will need to load the driver, if you know the driver name, you can load it straight away. If not, load the whole lot and hope one binds.

Depending which version of FreeBSD you are running it will be :
# kldload snd
or
# kldload snd_driver

If you have loaded all the sound drivers with the above command, you can see the specific driver you have loaded by doing the following

#cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 32bit 2007061600/i386)
Installed devices:
pcm0: <VIA VT8237> at io 0xb400 irq 22 kld snd_via8233 [MPSAFE] (5p:1v/1r:1v channels duplex default)

In this case snd_via8233 is the driver being used.

To make sure this driver loads on boot, you'll need to edit /boot/loader.conf. In this case i would put the following in this file:
snd_via8233_load="YES"

If you want all the drivers to load ( for whatever reason ) you can put the following in loader.conf
snd_driver_load="YES"

References:
http://www.freebsddiary.org/sound.php
http://www.freebsd.org/doc/en_US.ISO...und-setup.html

* Note: if anyone notices any errors in this how-to, please correct them
Reply With Quote
  #2   (View Single Post)  
Old 1st May 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default

Here is a script that will load the sound drivers one by one, detect which one you're using, and add it to /boot/loader.conf.

This will work on any version of FreeBSD.

Code:
#!/bin/sh
#
# Detect sound driver

for driver in /boot/kernel/snd_*; do
  driver=$(echo ${driver} | sed 's|/boot/kernel/snd_||')
  if [ ${driver} = "driver.ko" ]; then
    continue;
  fi

  kldload snd_${driver}
  if [ -c /dev/mixer0 ]; then
    echo "I'm smelling 'snd_${driver}'"
    echo "snd_${driver}_load=\"YES\"" >> /boot/loader.conf
    exit 0
  fi
  kldunload snd_${driver}
done
Attached Files
File Type: sh snd.sh (374 Bytes, 240 views)
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #3   (View Single Post)  
Old 1st May 2008
corey_james corey_james is offline
Uber Geek
 
Join Date: Apr 2008
Location: Brisbane, Australia
Posts: 238
Default

llaazzzyyyyy :P
Reply With Quote
  #4   (View Single Post)  
Old 1st May 2008
starbuck's Avatar
starbuck starbuck is offline
Port Guard
 
Join Date: Apr 2008
Location: Eugene, OR
Posts: 31
Default

Quote:
Originally Posted by Carpetsmoker View Post
Here is a script that will load the sound drivers one by one, detect which one you're using, and add it to /boot/loader.conf.

This will work on any version of FreeBSD.

Code:
#!/bin/sh
#
# Detect sound driver

for driver in /boot/kernel/snd_*; do
  driver=$(echo ${driver} | sed 's|/boot/kernel/snd_||')
  if [ ${driver} = "driver.ko" ]; then
    continue;
  fi

  kldload snd_${driver}
  if [ -c /dev/mixer0 ]; then
    echo "I'm smelling 'snd_${driver}'"
    echo "snd_${driver}_load=\"YES\"" >> /boot/loader.conf
    exit 0
  fi
  kldunload snd_${driver}
done
Nice shell script. Any chance on seeing a "BSD Scripting 101" guide or a post with some useful tutorials?
Reply With Quote
  #5   (View Single Post)  
Old 1st May 2008
corey_james corey_james is offline
Uber Geek
 
Join Date: Apr 2008
Location: Brisbane, Australia
Posts: 238
Default

starbuck - i don't mind writing one but it's hard when there's so much to scripting - PM me and we'll organise something
Reply With Quote
  #6   (View Single Post)  
Old 6th May 2008
FloridaBSD FloridaBSD is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 58
Default

starbuck.

IMHO your probably going to learn more from reading a manual like Unix Shell Scripting Third Addition By Sams.
__________________
Google Linux is a Green Horns Best Friend (GHBF).
Windows = a 32 bit extensions to a 16 bit patch to an 8 bit operating system originally coded for a four bit processor written by 2-bit monopolistic software company founded by a .3-bit Harvard Drop out, who can't stand one respectable bit of competition.
If I believe something to be immoral a will not keep quite and let my voice of annoyance be heard loud and clear.
Reply With Quote
  #7   (View Single Post)  
Old 6th May 2008
anomie's Avatar
anomie anomie is offline
Local
 
Join Date: Apr 2008
Location: Texas
Posts: 445
Default

OT (sort of) learning material suggestions:

I'll second the suggestion to pick up a book as reference material. Personally, I really liked Sams Teach Yourself Shell Programming in 24 Hours (2nd Edition) by Sriranga Veeraraghavan. (I'd write a review on it, but someone at work stole it and I haven't read it in a couple years...)

Also, check out the Advanced Bash-Scripting Guide from TLDP. Just keep in mind that sh != bash, exactly.
__________________
Kill your t.v.
Reply With Quote
  #8   (View Single Post)  
Old 6th May 2008
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 652
Default

I have a page with some links that *I* found useful.
http://home.nyc.rr.com/computertaiju...scripting.html

As was said, bash isn't shell, so think about keeping your scripts portable. For example, I wrote something on a Linux box that starts by checking if you're root. I used $UID instead of id -n, not realizing it was a bash-ism. (errm id -u, whatever.) We have some AIX machines as well, and that caused me a bit of embarrassment.
Reply With Quote
  #9   (View Single Post)  
Old 6th May 2008
corey_james corey_james is offline
Uber Geek
 
Join Date: Apr 2008
Location: Brisbane, Australia
Posts: 238
Default

your mere existence is an embarrassment, young scottro!
Reply With Quote
Old 6th May 2008
DrJ DrJ is offline
ISO Quartermaster
 
Join Date: Apr 2008
Location: Gold Country, CA
Posts: 507
Default

Quote:
Originally Posted by corey_james View Post
... young scottro!
Move closer to the ear horn, please.
Reply With Quote
Old 13th August 2010
clovis clovis is offline
Port Guard
 
Join Date: Aug 2010
Posts: 17
Default

Quote:
Originally Posted by corey_james View Post
First you will need to load the driver, if you know the driver name, you can load it straight away
how to no the name of my card? right now without no sound...
Reply With Quote
Old 13th August 2010
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

If you run pciconf -lv as root and examine the results (I suggest using a pager), you will likely be able to identify some info: also look at the dmesg.

If there's any specific issue, you might want to launch a thread for it.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Old 13th August 2010
clovis clovis is offline
Port Guard
 
Join Date: Aug 2010
Posts: 17
Default

got this dude...

Code:
$  pciconf -lv 
hostb0@pci0:0:0:0:	class=0x060000 card=0x25601849 chip=0x25608086 rev=0x03 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'DRAM Controller / Host-Hub I/F Bridge (82845G/GL/GV/GE/PE)'
    class      = bridge
    subclass   = HOST-PCI
vgapci0@pci0:0:2:0:	class=0x030000 card=0x25621849 chip=0x25628086 rev=0x03 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82845G/GL/GV/GE/PE Integrated Graphics Device'
    class      = display
    subclass   = VGA
uhci0@pci0:0:29:0:	class=0x0c0300 card=0x24c01849 chip=0x24c28086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller *1'
    class      = serial bus
    subclass   = USB
uhci1@pci0:0:29:1:	class=0x0c0300 card=0x24c01849 chip=0x24c48086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller *2'
    class      = serial bus
    subclass   = USB
uhci2@pci0:0:29:2:	class=0x0c0300 card=0x24c01849 chip=0x24c78086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller *3'
    class      = serial bus
    subclass   = USB
ehci0@pci0:0:29:7:	class=0x0c0320 card=0x24c01849 chip=0x24cd8086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB 2.0 EHCI Controller'
    class      = serial bus
    subclass   = USB
pcib1@pci0:0:30:0:	class=0x060400 card=0x00000000 chip=0x244e8086 rev=0x82 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '82801 Family (ICH2/3/4/5/6/7/8/9,63xxESB) Hub Interface to PCI Bridge'
    class      = bridge
    subclass   = PCI-PCI
isab0@pci0:0:31:0:	class=0x060100 card=0x00000000 chip=0x24c08086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge'
    class      = bridge
    subclass   = PCI-ISA
atapci0@pci0:0:31:1:	class=0x01018a card=0x24c01849 chip=0x24cb8086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801DB/DBL (ICH4/ICH4-L) UltraATA/100 EIDE Controller'
    class      = mass storage
    subclass   = ATA
none0@pci0:0:31:5:	class=0x040100 card=0x434d1849 chip=0x24c58086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Realtek AC97 Audio (82801DBM SoundMAXController (ICH4-M B0 step))'
    class      = multimedia
    subclass   = audio
none1@pci0:0:31:6:	class=0x070300 card=0x53494c21 chip=0x24c68086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller'
    class      = simple comms
    subclass   = generic modem
rl0@pci0:3:10:0:	class=0x020000 card=0x81391849 chip=0x813910ec rev=0x10 hdr=0x00
    vendor     = 'Realtek Semiconductor'
    device     = 'Realtek RTL8139 Family PCI Fast Ethernet NIC (RTL-8139/8139C/8139D)'
    class      = network
    subclass   = ethernet
ui fu can give a hand it'd be nice!
Reply With Quote
Old 13th August 2010
clovis clovis is offline
Port Guard
 
Join Date: Aug 2010
Posts: 17
Default

*if you(i meant)blablabla
Reply With Quote
Old 13th August 2010
Beastie Beastie is offline
Daemonology student
 
Join Date: Jan 2009
Location: /dev/earth0
Posts: 335
Default

Quote:
Originally Posted by clovis View Post
Code:
$  pciconf -lv 
[...]
    device     = 'Realtek AC97 Audio (82801DBM SoundMAXController (ICH4-M B0 step))'
    class      = multimedia
    subclass   = audio
[...]
Add snd_ich_load="YES" to /boot/loader.conf.
# kldload snd_ich
__________________
May the source be with you!
Reply With Quote
Old 13th August 2010
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

The following would be your card, indeed no driver currently claims it, yet.
Code:
none0@pci0:0:31:5:	class=0x040100 card=0x434d1849 chip=0x24c58086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Realtek AC97 Audio (82801DBM SoundMAXController (ICH4-M B0 step))'
    class      = multimedia
    subclass   = audio
This handbook page indicates that kldload snd_driver will attempt to load several common drivers, did you try that?

A full list of sound card drivers can be found using apropos or man -k on a FreeBSD system, but here is an online list.

My bet is snd_ich(4) or less likely snd_hda(4).

Hope that helps, but, it seems Beastie got here first.
Reply With Quote
Old 13th August 2010
clovis clovis is offline
Port Guard
 
Join Date: Aug 2010
Posts: 17
Default

Quote:
Originally Posted by Beastie View Post
Add snd_ich_load="YES" to /boot/loader.conf
the file is in blank! is that ok?
Reply With Quote
Old 13th August 2010
Pjoter's Avatar
Pjoter Pjoter is offline
Shell Scout
 
Join Date: Sep 2008
Posts: 92
Default

After the initial installation yes, it is empty.

Piotr
Reply With Quote
Old 13th August 2010
clovis clovis is offline
Port Guard
 
Join Date: Aug 2010
Posts: 17
Default [solved]

running sound! ur can close this post now...
Reply With Quote
Old 13th August 2010
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

Closing posts isn't common place here, especially considering this isn't even your original topic.
Reply With Quote
Reply

Tags
kernel module, snd, snd_driver, sound

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recording sound with external sound card backrow OpenBSD General 5 21st August 2009 08:17 PM
FreeBSD 7.2 amd64 no sound erim FreeBSD General 5 3rd June 2009 07:54 AM
Sound JimC FreeBSD General 9 15th August 2008 06:05 PM
Have no sound freeBSD 7.0 yavko FreeBSD Installation and Upgrading 3 31st July 2008 10:20 AM
problem with Virtual Sound Channels in FreeBSD 7 casper007 FreeBSD Installation and Upgrading 3 16th July 2008 04:22 PM


All times are GMT. The time now is 11:01 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick