Getting The Right Sound

| No TrackBacks
Arch Linux logo

Arch Linux logo (Photo credit: Wikipedia)

FSF artwork of the gnu (GNU mascot) and the pe...

FSF artwork of the gnu (GNU mascot) and the penguin Tux (Linux kernel mascot) representing their viewpoint on "GNU/Linux". The GNU General Public License (GPL), which is used by the Linux kernel as well as by most GNU software, armors both characters. (Photo credit: Wikipedia)

I finally figured out how to change the default output sound device!
I finally figured out how to change the default output sound device!

I've been using Linux as my main OS now for years. But one thing has always eluded me - how to swap which is the default sound device. If I have a USB headphone plugged in at start time, it would randomly pick it as the default output sound device and I just couldn't convince the sound system (ALSA in this case) otherwise. I actually have a pretty nice 5.1 sound setup and when listening to the radio, I'd rather not wear headphones in my home office.

But the only way I could change its mind was to unplug the headphones and reboot, which seemed a little bit of overkill. I had edited the .asoundrc file to try and convince it not to pick the headphones, but there were times when I wanted to use them, so that wasn't an optimal solution.

Some apps, like Audacity and VLC, will let you choose at runtime, but most apps just don't do that and just use the currently selected device. Even when I run KDE, the device selection dialog (KMix) is a mite confusing and it doesn't often work, especially when not in KDE.

But finally today I stumbled across asoundconf, a utility that creates a asoundrc compatible file and mucks about with it then, I guess, restarts ALSA to pick up the changes. It won't affect any currently running programs, so you have to restart them to get the changes, but that's way better than anything else I've run into!

Like I said, I already had a badly edited .asoundrc file, so when I first ran the GUI interface for it, I got a very mysterious error:

$ asoundconf-gtk 
You need to make sure asoundconf is active!
By default, asoundconf's configuration file is ~/.asoundrc.asoundconf
and must be included in ~/.asoundrc. Open this file to make sure it is!

Hmm, how does one go about including .asoundrc.asoundconf in .asoundrc? I guess asoundconf operates by working on its own file and then expects it to be "included" in the ALSA configuration file, but what is the syntax?

I went on a bit of a Google quest to no avail. Even the .asoundrc reference page makes no mention of it. No where I looked told me how to "include" an ALSA rc file into another.

Finally I came across something that mentioned asoundconf would create an .asoundrc file for itself if there wasn't one. So I deleted my .asoundrc file and re-ran asoundconf-gtk. And sure enough, it created a new .asoundrc file with the correct syntax:

# ALSA library configuration file
# Include settings that are under the control of asoundconf(1).
# (To disable these settings, comment out this line.)

So it looks like if you have your own .asoundrc, you can just include the .asoundrc.asoundconf file using the <> syntax. Good to know. Don't you hate it when documentation is incomplete?

So how I can run asoundconf-gtk and it gives me a list of the current sound devices (usally just my sound card and a USB headset) and I can choose one of them. It it works like a charm!

Enhanced by Zemanta

No TrackBacks

TrackBack URL:

About this Entry

This page contains a single entry by Jonathan published on February 23, 2014 10:15 AM.

Surprising Link was the previous entry in this blog.

Brace Yourself For Expansion is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.