1214d How to change default sound card - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Base System > System Hardware

System Hardware Internal storage, motherboards, PCI cards, stuff inside the case.

Reply
 
Thread Tools Display Modes
  #1  
Old December 15th, 2009, 10:09
OJ OJ is offline
Member
 
Join Date: Dec 2009
Location: Coalmont BC, Canada
Posts: 207
Thanks: 25
Thanked 10 Times in 9 Posts
Default How to change default sound card

I have three sound cards in this machine and the handbook doesn't appear to address this problem. One card works with one driver and the other two work with another. For now, I have set the single card using /boot/loader.conf and have sound, but I would like to use the other two cards as well.

1. How do I set the default card?
2. How do I switch between them?
Reply With Quote
  #2  
Old December 15th, 2009, 10:31
SirDice's Avatar
SirDice SirDice is offline
Moderator
 
Join Date: Nov 2008
Location: Rotterdam, Netherlands
Posts: 13,852
Thanks: 48
Thanked 2,061 Times in 1,890 Posts
Default

Quote:
Originally Posted by OJ View Post
1. How do I set the default card?
Create a softlink /dev/dsp pointing at the correct one.

Quote:
2. How do I switch between them?
Select the proper /dev/dsp[1..9] in your application.
__________________
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
Reply With Quote
The Following User Says Thank You to SirDice For This Useful Post:
OJ (December 15th, 2009)
  #3  
Old December 15th, 2009, 11:29
joel@'s Avatar
joel@ joel@ is offline
Administrator
 
Join Date: Sep 2007
Location: Arentorp, Sweden
Posts: 240
Thanks: 2
Thanked 37 Times in 30 Posts
Default

For example, typing the following will change your default audio device from 0 to 1 (as root, of course).
Code:
# sysctl hw.snd.default_unit=1
To view all detected audio devices, do a:
Code:
# cat /dev/sndstat
Output will look something like this:
Code:
# cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 32bit 2009061500/i386)
Installed devices:
pcm0: <AudioPCI ES1371-A> at io 0x2040 irq 16 kld snd_es137x [MPSAFE] (2p:1v/1r:1v channels duplex default)
In this example, I only have one device (pcm0).

Last edited by joel@; December 15th, 2009 at 12:41.
Reply With Quote
The Following 2 Users Say Thank You to joel@ For This Useful Post:
OJ (December 15th, 2009), ricstr (July 22nd, 2012)
  #4  
Old December 15th, 2009, 12:35
OJ OJ is offline
Member
 
Join Date: Dec 2009
Location: Coalmont BC, Canada
Posts: 207
Thanks: 25
Thanked 10 Times in 9 Posts
Default

Thanks joel@ sysctl works!
I haven't tested all the outputs yet but I assume there will be all five choices which are listed in /dev/sndstat when I load all drivers.

My next problem will be how to use different cards at once, but I haven't lined up all my programs yet so this is good for now.

@SirDice: your idea is interesting to me, but I don't know how to make links yet. I will have a look at the ln man pages.
Reply With Quote
  #5  
Old December 17th, 2009, 01:18
hedwards hedwards is offline
Member
 
Join Date: Nov 2008
Posts: 189
Thanks: 3
Thanked 18 Times in 16 Posts
Default

Quote:
Originally Posted by OJ View Post
@SirDice: your idea is interesting to me, but I don't know how to make links yet. I will have a look at the ln man pages.
You don't. That's something that you use devfs for. You can make links, but you'll be doing it each and ever boot, not necessarily bad for testing, but a pain.

I'd take a look at /etc/devfs.conf for examples as well as to actually set it up.
Reply With Quote
  #6  
Old December 17th, 2009, 05:51
OJ OJ is offline
Member
 
Join Date: Dec 2009
Location: Coalmont BC, Canada
Posts: 207
Thanks: 25
Thanked 10 Times in 9 Posts
Default

Quote:
I'd take a look at /etc/devfs.conf for examples as well as to actually set it up.
I'm not sure how to use that file for this particular purpose, but you mentioning it led me to look at /etc/sysctl.conf which seems to be the place to put sysctl parameters such as joel@ mentioned. Thanks.
Reply With Quote
  #7  
Old December 18th, 2009, 02:06
hedwards hedwards is offline
Member
 
Join Date: Nov 2008
Posts: 189
Thanks: 3
Thanked 18 Times in 16 Posts
Default

Quote:
Originally Posted by OJ View Post
I'm not sure how to use that file for this particular purpose, but you mentioning it led me to look at /etc/sysctl.conf which seems to be the place to put sysctl parameters such as joel@ mentioned. Thanks.
Ah, what you'd do is put something like:
Code:
link    dsp1     dsp
into the file and then each time that the devfs is started up the link is created linking dsp1 to dsp.
Reply With Quote
  #8  
Old July 30th, 2010, 19:59
commx commx is offline
Junior Member
 
Join Date: May 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Based on the sysctl idea, I've built a tiny command line tool which allows you to list available sound devices and set the default one. It may also be used to detect sound devices using the generic audio driver.

Maybe this helps someone.

Available via mercurial or as .tar.bz2 archive.
Reply With Quote
  #9  
Old January 10th, 2011, 20:12
Woland Woland is offline
Junior Member
 
Join Date: Aug 2010
Location: Colorado
Posts: 19
Thanks: 7
Thanked 6 Times in 2 Posts
Default change default soundcard dsp pcm device

Making a symlink won't work, because chances are that there is alrady a /dev/dsp that was set up at boot time.
This line:
Code:
link    dsp1     dsp
DOES NOT WORK!
so don't do that.

The only way I found to permanantly and effectively change my soundcard, is to add the follwing line to my /etc/sysctl.conf:
Code:
hw.snd.default_unit=1
You may need to replace the "1' with the correct number for the working pcm device. How do you know which is the correct device? do "ls /dev/dsp*" then "cat foo.txt > /dev/dsp$N" , where "foo.txt" is any non-empty file on your system, for each of the dsp devices found.

This problem has buggered me for way too long, considering how simple the solution is. I would represent that this is may be a stumbling block for the novice user, espceially since lots of systems have multiple soundcards these days. Perhaps a small addition to the handbook may be in order?

Last edited by Woland; January 10th, 2011 at 20:13. Reason: included title with some keywords for easier searching.
Reply With Quote
The Following 3 Users Say Thank You to Woland For This Useful Post:
ah7013 (June 5th, 2011), dgraham (April 29th, 2011), ricstr (July 22nd, 2012)
Reply

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
sound card lumiwa System Hardware 2 September 14th, 2009 00:30
[Solved] Sound card detected, but no sound on freebsd 7.2 sasha-fbsd System Hardware 6 September 12th, 2009 04:04
How to change default source address wazigster Networking 9 August 23rd, 2009 13:51
Sound card not detected... Help? spoon System Hardware 17 June 13th, 2009 00:19
No Sound Card Driver ? mdg System Hardware 5 June 7th, 2009 18:42


All times are GMT +1. The time now is 05:32.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0