[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: usb audio device & sound card



Mark Grieveson wrote:
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



Mark,

I cut the above code example and pasted into an editor, removed leading email junk, changed the name awk is looking for to match my sound card and ran the command with no problem.

I'd be happy to look at your file to see if I can determine what's wrong. Send me the file directly, as an archive of some sort (tar would be fine), so as to prevent any possible munging by the mail system, and I'll let you know what I find out.

This way, you'll have a working tool available if/when this happens again.

Bob

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Reply to: