If you have multiple soundcards in your system and have to switch between them regularly (e.g. laptop owners like me, who use an external soundcard while being docked to groove to the highest and the lowest of frequencies through those 7.1 channels and use the in-built sound card while on the move) you would definitely be under-whelmed by the less-than-stellar performance of ubuntu in switching between the sound cards. For me at least, ubuntu (fiesty 7.04 amd64) never seems to recognize that I’ve connected the speakers to my Audigy 2 ZS Notebook PCMCIA card, and merrily continues to huff-puff through the tinny laptop speakers until I manually go into the sound preferences, switch over to multichannel playback and vice versa. Well, I still haven’t found an automated solution for the switching, but here is a little cli-magic to do this in a click.
If you have alsa on ur system, just use the command “asoundconf list” first to list out all the soundcards connected to your system. e.g. on my system, the output is
Here, IXP is my internal sound card and AUDIGY2 is my external (PCMCIA) sound card. Now, all you need to is use “asoundconf set-default-card <cardname>” to switch over to any card desired. So, what I did was make 2 bash scripts, and insert this command in them with each having one of my soundcards’ names.
script 1 – setixp.sh
asoundconf set-default-card IXP
Similarly, script 2 – setaudigy.sh
asoundconf set-default-card AUDIGY2
Now, all that remains is save the two scripts (maybe in ur home directory or ur desktop), and make them executable (use “chmod +x <scriptname>”). Now, whenever you want to switch to a card, just double-click on the appropriate script, and watch the sound getting redirected. oops, make that “hear” the sound :P.
[tags]linux, ubuntu, soundcard, sound card, switch sound card, asoundconf, bash, cli, audigy2, internal soundcard, external soundcard[/tags]