LinuxQuestions.org
Help answer threads with 0 replies.
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 04-21-2016, 03:27 PM   #1
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,340

Rep: Reputation: 224Reputation: 224Reputation: 224
How do I configure X to use an alternate audio device?


The jack built into my computer stopped working. I now use a usb-audio converter. I changed asound.conf to use it but the X apps that I have tried still send sound to the built-in speakers. I assume I need a new OutputDevice section in xorg.conf, but I can't find a model for how to write it.
 
Old 04-21-2016, 09:06 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 15,870
Blog Entries: 27

Rep: Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662Reputation: 4662
What distro/version are you using? Results of a web search are like to refer to specific distros.

Here's an article from the ALSA wiki that might be helpful, but it would be useful to know whether you are using a distro with Pulse Audio.
 
1 members found this post helpful.
Old 04-21-2016, 10:29 PM   #3
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,000
Blog Entries: 1

Rep: Reputation: 846Reputation: 846Reputation: 846Reputation: 846Reputation: 846Reputation: 846Reputation: 846
If you're using pulse audio. pavucontrol

$ pavucontrol

Otherwise you need to change the users .asoundrc

FILE: ~/.asoundrc
Code:
defaults.ctl.card 1
defaults.pcm.card 1
defaults.pcm.device 0
Where the card # is the index associated in /proc/asound/cards

$ cat /proc/asound/cards

And of course test it. Sound is part of the kernel, not X.

$ speaker-test -c 2

Where -c 2 is 2 channels, so left and right speakers alternating. Control + C to exit.
 
Old 04-22-2016, 09:45 AM   #4
seasons
Member
 
Registered: Dec 2014
Distribution: siduction
Posts: 260

Rep: Reputation: 57
Avoid using custom asound.conf if possible (especially if using Pulseaudio). The easiest way is to disable your onboard audio device in the BIOS if it allows such an option.
Another way is to add a line like this in /etc/modprobe.d/alsa-base.conf:
Code:
options snd-hda-intel enable=0  #use enable=0,0 if you also need to disable HDMI audio
Also, make sure you don't have a line in alsa-base.conf that prevents USB audio devices from getting index 0.
 
1 members found this post helpful.
Old 04-23-2016, 01:53 PM   #5
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,340

Original Poster
Rep: Reputation: 224Reputation: 224Reputation: 224
I misdiagnosed. Outside of X I used mplayer, which I configured to use the usb device; the X clients use the default alsa device, which was the builtin. It seems that alsa always makes device 0 the default device, that one cannot configure it otherwise. Thus, preventing the builtin device's modules from loading makes the usb device the default.

Curiously Firefox still makes no noise (xine does), which would seem to make this a Firefox problem.
 
Old 04-23-2016, 03:41 PM   #6
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,000
Blog Entries: 1

Rep: Reputation: 846Reputation: 846Reputation: 846Reputation: 846Reputation: 846Reputation: 846Reputation: 846
You probably need the gstreamer-plugin stuff and other things for firefox to work. I believe in my case it works with alsa natively, but not with pulseaudio. Various configuration tricks to make it work with pulseaudio, but not the default in debian iirc.

Yes, device 0 is the default device. But you CAN re-order your driver modules to make any audio device have the index of 0. Although a tad old school to accomplish that and might be quirky if you have multiple sound devices of the same type using the same driver. Basically alsa.conf stuff in /etc/modprobe.d/ to make that happen.

Most times I can get away with NOT using pulseaudio and changing the .asoundrc to say which device index to use.

$ echo "defaults.pcm.card 1" > .asoundrc

Literally as simple as that, unless your distro installed and configured your audio system by default. And pulseaudio by default. Also note that if you do not setup forced indexing, that soundcards can get a different index between reboots. If you have more than one. And most do since your video card, webcam, and everything has a soundcard now. If it's just output or just input, it's still a soundcard.
 
  


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
[SOLVED] How do I send audio output to an alternate device? RandomTroll Linux - Kernel 3 01-21-2016 12:32 PM
Alternate applications for audio, video, console, editor crash_override_me Linux - Desktop 13 12-02-2008 01:37 PM
mpg321 is losing time; alternate audio console app andrewstr Linux - Software 0 12-29-2006 07:22 PM
Configure audio device for some applications paraiso Linux - Newbie 3 10-18-2005 03:47 PM
Trouble to configure my Crystal Audio Codec sound device Idriss BEK Linux - Software 1 05-22-2001 04:19 PM

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

All times are GMT -5. The time now is 03:37 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