LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-16-2008, 01:58 PM   #1
edgjerp
Member
 
Registered: Dec 2004
Location: Trondheim, Norway
Distribution: kubuntu 10.04
Posts: 308

Rep: Reputation: 31
usb speakers as default


I have a set of usb speakers for my laptop. when I play music using audacious, (and other gui players) I can change settings to send the music through them.

but for waking up in the morning I have a script that calls mplayer to play a random song from my library. I have not figured out how to make the system use the usb speakers for default system wide.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 06-17-2008, 08:20 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Plug in your USB speakers. Now
cat /proc/asound/cards
You'll see something like this:
Code:
tred@vaio:~$ cat /proc/asound/cards
 0 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0x80000000 irq 16
 1 [Audio          ]: USB-Audio - Bose USB Audio
                      Bose Corporation Bose USB Audio at usb-0000:00:1d.2-1, full speed
tred@vaio:~$
So I can see my USB speakers are at [1]
As root do the following:
Code:
cp /usr/share/alsa/alsa.conf  /usr/share/alsa/alsa.conf.orig
Now, still as root, edit the file /usr/share/alsa/alsa.conf and find this bit:

Code:
# defaults

defaults.ctl.card 0
defaults.pcm.card 0
Change the 0's to 1's
Save the file
Still as root, do
Code:
cp /usr/share/alsa/alsa.conf  /usr/share/alsa/alsa.conf.USB
Restart the sound system,
Code:
sudo /etc/init.d/alsa-utils restart
And your USB speakers will be working.

I made an ugly hack, so that if the PC boots with the USB speakers plugged in, it uses them, otherwise, it uses the internal soundcard (Intel, in my case)
So I put this code at the end of /etc/rc.local
Code:
# Simple control of Bose USB speakers
# If they are plugged in at boot, they'll be used,
# otherwise the internal soundcard will be used
#
# It may fail if anything is using the sound card when it is called

foo=$(cat /proc/asound/cards | grep Bose)
if [ "$foo" != "" ] ;  then 
# Use USB speakers
# echo Bose USB speakers detected >> /var/log/messages
cp /usr/share/alsa/alsa.conf.USB /usr/share/alsa/alsa.conf
/etc/init.d/alsa-utils restart
# BUT realplay defaults to using /dev/dsp, and doesn't know to use
# /dev/dsp1, so we need a another hack:
rm /dev/dsp
ln -sT  /dev/dsp1 /dev/dsp;
else
# Use the original conf file
# echo No Bose USB speakers detected >> /var/log/messages
cp /usr/share/alsa/alsa.conf.orig  /usr/share/alsa/alsa.conf
/etc/init.d/alsa-utils restart
fi
exit 0
I would have liked to do something clever with udev rules, so that when the USB speakers were plugged it, they were selected and configured automatically, and unselected when unplugged, but it got too complicated for my tiny brain, and I resorted to the above, which works fine

Anyone out there good with udev rules?
 
2 members found this post helpful.
Old 06-17-2008, 12:11 PM   #3
edgjerp
Member
 
Registered: Dec 2004
Location: Trondheim, Norway
Distribution: kubuntu 10.04
Posts: 308

Original Poster
Rep: Reputation: 31
thanks! now my script-launched mplayer uses the usb speakers.
 
Old 06-26-2008, 02:12 PM   #4
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
now my script-launched mplayer uses the usb speakers.
But I have discovered that this may not work always.
Please see this thread for a more robust script:
http://www.linuxquestions.org/questi...0/#post3196077
You'll have to adapt it a bit to recognise your USB soundcard's unique identifier, but this should be easy once you have read the post.
 
Old 02-16-2013, 04:28 PM   #5
Naimbora
LQ Newbie
 
Registered: Feb 2013
Posts: 3

Rep: Reputation: Disabled
Hi,

Iwas just following the steps but Idont have the alsa-utils file in the directory /etc/init.d/ . I only have alsa-restore and alsa-store files. How can restart the sound system?

Cheers!
 
Old 02-17-2013, 04:12 AM   #6
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Welcome to LQ!

This thread is over 4 years old, and many things have changed with linux since then, including the way sound cards are handled.

So, please start a new thread with the details of your problem.

Also, it is important for you to tell us the linux distribution you are using (eg "Mint 14" or "Fedora 18"), because the different distributions sometimes handle things very differently.
 
Old 08-16-2021, 01:38 PM   #7
Andray
LQ Newbie
 
Registered: Aug 2021
Location: Aylmer, Gatineau, Quebec, Canada
Distribution: Mint 20.2
Posts: 2

Rep: Reputation: Disabled
Thumbs up 4 Years Old Thread Still Applicable

Quote:
Originally Posted by tredegar View Post
Welcome to LQ!

This thread is over 4 years old, and many things have changed with Linux since then, including the way sound cards are handled.

So, please start a new thread with the details of your problem.

Also, it is important for you to tell us the linux distribution you are using (eg "Mint 14" or "Fedora 18"), because the different distributions sometimes handle things very differently.
_________________________

The solution provided in this thread to make the Bose Companion 5 speakers work as default audio system output worked perfectly under recently released (June 2021) Linus Mint 20.2.

Thank you very much for your post tredegar, excellent solution!

Andray
 
Old 08-16-2021, 01:58 PM   #8
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Andray,

It's your first post, so, "Welcome to LQ!"

I am very surprised that a 14 year old post is still being found as useful. Perhaps this is a tribute to the power of scripts and the command line?

systemd and pulseaudio might soon be the death of this very dated advice though.

Thanks for your feedback, but it might be better if you scrolled back to the post that most helped you and clicked on "Did you find this post helpful? [Yes]" which might help a few other latecomers find the solution they need.
 
Old 08-16-2021, 04:01 PM   #9
Andray
LQ Newbie
 
Registered: Aug 2021
Location: Aylmer, Gatineau, Quebec, Canada
Distribution: Mint 20.2
Posts: 2

Rep: Reputation: Disabled
A 14 Years Old Post Still Very Useful !

Quote:
Originally Posted by tredegar View Post
Andray,

It's your first post, so, "Welcome to LQ!"

I am very surprised that a 14 year old post is still being found as useful. Perhaps this is a tribute to the power of scripts and the command line?

systemd and pulseaudio might soon be the death of this very dated advice though.

Thanks for your feedback, but it might be better if you scrolled back to the post that most helped you and clicked on "Did you find this post helpful? [Yes]" which might help a few other latecomers find the solution they need.
______________________________

Hi tredegar,

Thanks for your prompt reply tredegar. I did implement your script as well, but I haven't tested it yet. However, simply being able to get my Bose Companion 5 speakers working on Mint 20.2 is a big plus. I hadn't realized how old this post is, but by all means, no matter how old it gets, don't delete it!!! I followed your advice, and used the "Did you find this post useful? [Yes]" link. Of course I did! Thank you very much one more time. Cheers!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I need help with my USB Speakers Delicate_Shadow Linux - Hardware 2 08-23-2006 03:39 PM
USB based speakers alnet Fedora 3 06-02-2006 10:57 AM
USB Speakers Help Delicate_Shadow Linux - Hardware 0 05-10-2006 02:50 PM
Will USB Speakers work? weijie90 Linux - Hardware 1 04-21-2006 06:08 AM
sound with usb speakers pomelo Linux - Hardware 6 02-04-2006 03:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration