aplay -l shows different card ids after reboot in Debian Squeeze GNOME

If you experience sound problems in Debian Squeeze (GNOME) this article should help you: http://www.shcherbyna.com/?p=1800. However, sometime it happens that the card id you put into .asoundrc might be changed next time you boot your machine.

I’ve noticed that after a few reboots the aplay -l command shows that my card is assigned a new id. Therefore, I have to change file ~/.asoundrc and store there a new id of my card otherwise sound does not work in my browser. In order to automatize this process I have created a simple bash script which is doing the following:

1. Searches for card id by card name pattern (default pattern: LifeChat – this is a name of USB headphones I got)

2. Once card id is found it backups the original file /.asoundrc into /.asoundrc_bk

3. Once file is backup it writes a new card id into /.asoundrc

4. At this point your sounds should work in browser, flash, etc

The script can be put into “Startup Applications” in Debian so that each time you start your computer it syncs your .asoundrc file and sound works out of the box. Here is example output of the script on my machine:

[1] Searching for pattern LifeChat among installed cards: found: card 1: default [Microsoft LifeChat LX-3000 ], device 0: USB Audio [USB Audio]

[2] Fetching id from card: 1

[3] Configuring .asoundrc with card id 1: OK

Now, if you want to use the script, perform the following steps:

1. Download script from my blog either using command line or using browser: http://www.shcherbyna.com/files/linux/debugs/fixsounds.sh

2. Open fixsounds.sh using any text editor and locate line CARD_NAME=”LifeChat”

3. Specify your card name instead of “LifeChat”. In order to find out what cards you have run in terminal aplay -l

4. Save script and make it executable using chmod:

chmod +x ./fixsounds.sh

5. Run it and make sure there are no errors reported:

./fixsounds.sh

6. Make sure that you have sound – open browser, navigate to youtube.com, etc, etc, etc

7. Once everything is okay, you can register script for auto-start in System->Preferences->Startup Applications

Leave a Reply

Your email address will not be published. Required fields are marked *


− four = 3

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>