LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-23-2015, 11:01 AM   #1
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-current
Posts: 780

Rep: Reputation: 66
Switching default sound device


I have two sound devices, the onboard is default and plays all pc audio, but I have my mediaplayer (moc) configured to use a USB DAC which connects to my hifi amplifier.

Is it possible to easily (so without editing alsa settings and rebooting) switch the default sound device, or tie other applications temporarily to the USB DAC as well? For example, when I play music in Firefox I would like to direct that through the USB DAC.

I hope it is clear what I aim to do...?
 
Old 08-24-2015, 07:09 AM   #2
oldtechaa
Member
 
Registered: May 2015
Location: US
Distribution: Fedora
Posts: 364

Rep: Reputation: 83
What desktop environment are you using? I don't suppose you use either of these devices from the command line, right? Because the DEs (e.g. KDE, XFCE) have sound device configs, but there should be a way to do it from the CLI as well. I might check.

Last edited by oldtechaa; 08-24-2015 at 07:15 AM. Reason: Spelling.
 
Old 08-24-2015, 07:14 AM   #3
oldtechaa
Member
 
Registered: May 2015
Location: US
Distribution: Fedora
Posts: 364

Rep: Reputation: 83
You could try this if you want to make it "global", not just in the DE:
https://wiki.archlinux.org/index.php...faults.22_node
Just use the top two lines of the file they show there and it should do it.
 
Old 08-24-2015, 05:11 PM   #4
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-current
Posts: 780

Original Poster
Rep: Reputation: 66
Thanks oldtechaa.

I use i3 so I would prefer a command line option (which could then be put in a script or alias). But I have a full Slackware-current install so a convenient GUI application would do as well.

As I see it, the link you suggested only sets the default device, that's not what I want (as this requires a reboot, but please correct me if I'm wrong). Maybe I didn't specify clearly what I want. Rather then "switching" I should maybe have written "toggle" the default device without rebooting the pc. Even better would be if I could choose the device on a per application basis. For example, mplayer has a command line option to define the audio device, something like mplayer -ao alsa:device=hw=0,2. ('per application' mainly concerns Firefox and Chromium, but also other media players)
 
Old 08-24-2015, 09:14 PM   #5
USUARIONUEVO
Member
 
Registered: Apr 2015
Posts: 588

Rep: Reputation: 177Reputation: 177
asoundconfig ... select card and then open app , changes made on the fly , no need system restart.

At least no reboot needed , i test and works great.
https://aur.archlinux.org/packages/asoundconf/

I made package for slackware ...desktop entry in menu , categories Audio/Video Multimedia.
http://www.mediafire.com/download/k0...1-i586-1sw.txz

Last edited by USUARIONUEVO; 08-24-2015 at 09:15 PM.
 
1 members found this post helpful.
Old 08-25-2015, 12:36 AM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 7,521

Rep: Reputation: 2874Reputation: 2874Reputation: 2874Reputation: 2874Reputation: 2874Reputation: 2874Reputation: 2874Reputation: 2874Reputation: 2874Reputation: 2874Reputation: 2874
Just copy over your .asoundrc, and it will take effect immediately. No need to reboot.
 
1 members found this post helpful.
Old 08-25-2015, 06:44 PM   #7
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-current
Posts: 780

Original Poster
Rep: Reputation: 66
Quote:
Originally Posted by USUARIONUEVO View Post
asoundconfig ... select card and then open app , changes made on the fly , no need system restart.
Code:
$ ./asoundconf set-default-card DragonFly
Cheers, works like a charm!

@dugan: thanks, I tried your suggestion as well, but apparently I didn't find the correct syntax yet. It should do the same as asoundconf, but a bit 'cleaner', so I will give it another go.

Marked as solved
 
Old 08-25-2015, 11:51 PM   #8
Drakeo
Senior Member
 
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,153
Blog Entries: 3

Rep: Reputation: 339Reputation: 339Reputation: 339Reputation: 339
Quote:
Originally Posted by BroX View Post
I have two sound devices, the onboard is default and plays all pc audio, but I have my mediaplayer (moc) configured to use a USB DAC which connects to my hifi amplifier.

Is it possible to easily (so without editing alsa settings and rebooting) switch the default sound device, or tie other applications temporarily to the USB DAC as well? For example, when I play music in Firefox I would like to direct that through the USB DAC.

I hope it is clear what I aim to do...?
yes it can be done in kde enviroment just go in to system setting phonon SLK14.1 and set the device you prefer to the top for playback. and apply to the device list device list.
then set the record item you want for perfer to the top and apply to device list. test them while your in there then log out of kde log back remove the old when it complains. then for programs like kdeplayer Gmplayer go it to preferences and set it to your device.
then for firefox you have two things going on one is adobe flash player and html5 this can be hit and miss.
those programs want to use the default alsa playback from aplay -l .
so I did this for my usbdevice .asounndrc
Code:
pcm.SB { type hw; card SB; }
ctl.SB { type hw; card SB; }
pcm.NVidia { type hw; card NVidia; }
ctl.NVidia { type hw; card NVidia; }
pcm.Headset { type hw; card Headset; }
ctl.Headset { type hw; card Headset; }
pcm.HD2200 { type hw; card HD2200; }
ctl.HD2200 { type hw; card HD2200; }
pcm.!default pcm.Headset
ctl.!default ctl.Headset
now firefox should use default.
 
  


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
default device on sound card pete91 Linux - Newbie 7 01-23-2014 05:29 PM
Default sound device wrinkledcheese Slackware 3 10-07-2011 01:31 AM
USB Sound Device as Default Skazi Linux - Hardware 1 07-15-2010 09:33 AM
Default Sound Device KHAAAN Linux - Hardware 3 07-27-2004 08:35 AM
switching default sound rufius Linux - Hardware 2 05-03-2003 08:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:20 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration