:: [DNG] My new sound repair system
Forside
Slet denne besked
Besvar denne besked
Skribent: Steve Litt
Dato:  
Til: golugtech
CC: Devuan ML
Emne: [DNG] My new sound repair system
Hi all,

Sound is always a pain in the labonze. It's even more so when you're
always plugging in and removing USB microphones and webcams. So I
developed a system for easily making sure that when the card number of
my sound card changes, I can quickly address the situation.

First of all, I stopped running the alsa daemon. I found it
unnecessary, and I found it just complicated sound troubleshooting. So
I removed it from runit and it no longer tries to start.

My system consists of three files:

1) ~/.asoundrc
2) alsa.sh that is on $PATH
3) whatever.sh (name it what you want) that is on the path.

============ ~/.asoundrc ==============
# CRITICAL!!! For "hw:num:othernum" in slave, match num to card number
# CRITICAL!!! See comments at bottom for readout of card numbers

pcm.!default {
        # Must be type plug
        type plug
        slave.pcm "my_arbitrary_name"
}


pcm.my_arbitrary_name  {
        # Must be type dmix
        type dmix
        # Must be ipc_key 1024, I don't know why
        ipc_key 1024
        slave {
                # Card comma device. Device is probably 0
                # Preceding numbers are what needs to change
                # If your card order changes.
                # cat /proc/asound/cards for list
                pcm "hw:1,0"


                # Following stuff probably unnecessary, possibly
                harmful,
                #     but might help with certain songs
                #period_time 0
                #period_size 1024
                #buffer_size 4096
                #rate 44100
        }
}
=======================================



============ alsa.sh ==============
#!/bin/sh
lxterminal -e "alsamixer -c 1 -V playback"
=======================================


============ whatever.sh ==============
cp -p .asoundrc asoundrc.bup
echo '' >> .asoundrc
echo '' >> .asoundrc

echo '# WARNING: Must change card number in both' >> .asoundrc
echo '# ~/.asoundrc and /d/bats/alsa.sh !!!!!' >> .asoundrc
echo '# Use Vim :bn, which is next buffer,' >> .asoundrc
echo '# to access alsa.sh!!!!!' >> .asoundrc
echo '# The -c arg in alsa.sh is the card num!!!!!' >> .asoundrc

echo '' >> .asoundrc

echo '#========================================================' >> .asoundrc
cat /proc/asound/cards | sed -e's/^/#/' >> .asoundrc
echo '#========================================================' >> .asoundrc

echo '' >> .asoundrc
echo '# Delete this comment and stuff between equal signs when done troubleshooting.' >> .asoundrc

gvim .asoundrc /d/bats/alsa.sh
=======================================

Some of the longer echo lines in whatever.sh might wrap in your email,
but you get the idea.

So when you run whatever.sh, both ~/.asoundrc and alsa.sh come up in
Vim, with the bottom of ~/.asoundrc containing info about which card is
what, so you can easily change the card number in both ~/.asoundrc and
alsa.sh.

The reason I created this system was that I never again want to take 10
minutes fixing a "no sound" symptom while in a Jitsi meeting. I'm
figuring with my new system it will be about 30 seconds and if I play
it right, my fellow meeting attendees won't even know :-)

By the way, this system is made for an ALSA-only computer. If
Pulseaudio gets thrown into the mix, I'm sure this system will need to
be substantially expanded.

SteveT

Steve Litt
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques