Re: usb audio device & sound card
> Greetings Mark:
> This script would set your on-board card (CS46xx) to be your default
> card for alsa regardless of which card it is in the system (0 or 1):
> #!/bin/bash
> #
> # The awk statement should get the first "word" (the card number)
> # from the line which contains the text (the card name)
> defcard=`awk '/\[CS46xx/ {print $1}' /proc/asound/cards`
> # Create the .asoundrc file as a "here" document inserting the
> # card number that the awk statement generated above
> cat > ~/.asoundrc <<EOF
> pcm.!default {
> type hw
> card $defcard
> }
> ctl.!default {
> type hw
> card $defcard
> }
> EOF
> The script is going to require both bash and awk to be installed on the
> system (I think both are installed by default). I would dump that code
> into a script file (maybe /usr/local/bin/setasoundrc) and make sure that
> the file is executable (chmod +x), and then call that script from your
> .bashrc file. Reboot a couple of times and make sure that your
> ~/.asoundrc file always lists the on-board device as the default card.
> Let me know if it's not doing what you need.
> -Scott
Thanks for the work. I finally did get around to trying this. I followed your advice, and created the file in /usr/local/bin/setasoundrc, making it executable. I altered the .bashrc file, and rebooted. The default soundcard was still the usb device, however. Also, when I would run the terminal, it would give me an error stating something like "/usr/local/bin/setasoundrc, line 5, {print: $1 command not found" and it would be stuck like that, until I changed the .bashrc file back (using gedit), and rebooted. I tried installing mawk, then gawk, and finally awk-original, but still no luck.
However, after a recent upgrade, it seems that the system itself is now correctly finding the soundcard as the default, and the usb device as the alternate (for skype); so, for the time being, problem solved. I say, "for the time being", because in the past, I did have it working, until a dist-upgrade fouled it up. Hopefully that won't happen again (I'm keeping my fingers crossed). This is part of the excitement of using testing, I guess.
Thanks again for your efforts. Much appreciated.
Mark
Reply to: