OK, here is yet another script, but designed to check out your Audio Setup. What I would love to hear is any suggestions for added tests or if you think something is worthless, let me know and it can be removed from the test script. In order to create S.T.A.R.T. copy and past the text in the following code section into your favorite text editor and save it into your home area bin folder as the file start (~/bin/start):
#!/bin/bash
#: Title : /home/james/bin/start
#: Date Created: Sun Oct 31 14:21:01 CDT 2010
#: Last Edit : Sun Oct 31 20:26:01 CDT 2010
#: Author : J. McDaniel
#: Version : 1.00
#: Description : Check Your Audio Sound Setup
#: Options : none
# Written for the openSUSE forums on Sunday October 31, 2010
# Copy and paste this text as the file start into the ~/bin folder.
# Run the terminal command: chmod +x ~/bin/start, to make the file executable
# Open up a terminal session and type: start, to start the program
PROG="S.T.A.R.T. - V1.00 - SuSE Terminal Audio Reporting Tool -"
# Determine program user, save home folder location
USER="$HOME"
# Menu Disply System function
# Display up to $3 menu items and <enter> is always Exit
# Menu should have at least two choices plus exit
function print_menu {
# You can adjust the starting position of the start menu.
# Using s_line=0 & s_col=0 would place the menu in the top left corner of your screen"
# Starting Terminal Line Number for menu
s_line=0
# Starting Terminal Column Number for Menu
s_col=0
# Determine SuSE Version
suse=$(cat /etc/SuSE-release)
num=${#suse}
version="${suse:0:$((num - 15))}"
# Display Program Title
tput clear
tput cup $(( s_line )) $(( s_col ))
tput setf 7
tput setb 2
tput bold
echo "$1" $version
# Determine Kernel Version
kernel=$(uname -r)
# Display Menu, Present User home, kernel version
tput sgr0
tput cup $(( s_line + 2 )) $(( s_col ))
tput setf 7
tput setb 1
tput bold
echo "$2" "USER:$USER" " Kernel:$kernel "
tput sgr0
# Display All Menu Options 1 through $3
maxnum=$3
counter=0
while $(( counter )) -lt $(( maxnum + 1 )) ] ; do
let counter=counter+1
tput cup $(( s_line + 3 + counter )) $(( s_col ))
echo "$4"
shift
done
# Display menu option request and get user input
tput setf 2
tput bold
tput cup $(( s_line + 4 + counter )) $(( s_col ))
read -p "Enter Your Choice [1-"$maxnum"] or Just Press <enter> to Quit S.T.A.R.T. : " CHOICE
return $CHOICE
}
#
# Main Program Loop starts here ...
#
while true ; do
# Setup Menu string Fields displayed for your menu
MENU="Audio and Sound Testing - M E N U "
TOTL="12"
TST1=" 1 . Verify your Alsa Packages are installed for Operational Testing ... "
TST2=" 2 . Simple Left/Right Speaker Test Number One ... "
TST3=" 3 . Simple Left/Right Speaker Test Number Two ... "
TST4=" 4 . Test Sound using aplay to play Left, Right or Test Stereo wav files ... "
TST5=" 5 . Checking your audio setup in four steps for detailed information ... "
TST6=" 6 . Run ALSA setup script as a ROOT User (Run Once) Update if Newer Exists ... "
TST7=" 7 . Run ALSA setup script as a Normal User. Please Upload your information ... "
TST8=" 8 . Stop ALSA, Restart ALSA and then Reload Kmix (For KDE Users) ... "
TST9=" 9 . Check your Pulseaudio package Installation ... "
TSTA=" 10. Enable your Pulseaudio Sound System ... "
TSTB=" 11. Disable your Pulseaudio Sound System ... "
TSTC=" 12. Determining which application is using sound device ... "
# Call Menu and get user input selection
print_menu "$PROG" "$MENU" "$TOTL" "$TST1" "$TST2" "$TST3" "$TST4" "$TST5" "$TST6" "$TST7" "$TST8" "$TST9" "$TSTA" "$TSTB" "$TSTC"
CHOICE="$?"
# Execute User Command Here
case "$CHOICE" in
"1")
tput clear
tput bold
tput setf 7
tput setb 4
echo $TST1
echo
tput setf 7
tput setb 1
tput bold
echo "rpm --query --all --queryformat '%{NAME}-%{VERSION}-%{RELEASE}-%{ARCH} -> %{VENDOR}
' alsa alsa-utils alsa-firmware 'libasound2*'"
tput sgr0
echo
rpm --query --all --queryformat '%{NAME}-%{VERSION}-%{RELEASE}-%{ARCH} -> %{VENDOR}
' alsa alsa-utils alsa-firmware 'libasound2*'
echo
echo "You should expect to have at least four Alsa Packages Installed."
echo "32 bit files are not required when using 64bit openSUSE install."
echo
echo "called ----> alsa-utils <--------- from the openSUSE Repository."
echo "called ----> libasound2-32bit <--- from the openSUSE Repository."
echo "called ----> alsa <--------------- from the openSUSE Repository."
echo "called ----> libasound2 <--------- from the openSUSE Repository."
echo "called ----> alsa-firmware <------ from the openSUSE Repository."
echo
read -p "Press <enter> to continue..." ;;
"2")
tput clear
tput bold
tput setf 7
tput setb 4
echo $TST2
echo
tput setf 7
tput setb 1
tput bold
echo "Command: speaker-test -Dplug:front -c2 -l5 -twav"
tput sgr0
echo
echo "Note you should check your mixer settings (kmix if using KDE, and alsamixer"
echo "if using Gnome) to ensure that PCM and Master Volume are set high. If no"
echo "sound initially, try around 95%and back off the levels once basic sound"
echo "is established. Note the test for surround sound is different."
speaker-test -Dplug:front -c2 -l5 -twav
echo
read -p "Press <enter> to continue..." ;;
"3")
tput clear
tput bold
tput setf 7
tput setb 4
echo $TST3
echo
tput setf 7
tput setb 1
tput bold
echo "Command: speaker-test -c2 -l5 -twav"
tput sgr0
echo
echo "Note you should check your mixer settings (kmix if using KDE, and alsamixer"
echo "if using Gnome) to ensure that PCM and Master Volume are set high. If no"
echo "sound initially, try around 95%and back off the levels once basic sound"
echo "is established. Note the test for surround sound is different."
speaker-test -c2 -l5 -twav
echo
tput bold
tput setf 7
tput setb 1
echo "If you did not hear any sound, you might need to add yourself to the audio user"
echo "group. Would you like to add yourself to the audio user group right now? (Yes or No)"
tput sgr0
echo
read -p "Enter your choice [y/N] " CHOICE
if "$CHOICE" == "y" ] || "$CHOICE" == "Y" ] ; then
sudo usermod -A audio $(basename $USER)
usermod_exit_value=$?
if "${usermod_exit_value}" -eq "0" ] ; then
echo
echo "User "$USER" Was added to the Audio User Group as Requested."
echo
fi
fi
echo
read -p "Press <enter> to continue..." ;;
"4")
while "$choice" != "q" ] ; do
tput clear
tput bold
tput setf 7
tput setb 4
echo $TST4
echo
tput setf 7
tput setb 1
tput bold
echo "Using aplay -vv to play Front_Left.wav, Front_Right.wav or Test.wav sound files"
tput sgr0
echo
read -p "Enter <L>eft, <R>ight, <T>est or <Q>uit. Enter your choice [l/r/t/q]" choice
if "$choice" == "l" ] || "$choice" == "L" ] ; then
aplay -vv /usr/share/sounds/alsa/Front_Left.wav
echo
read -p "Press <enter> to continue..."
fi
if "$choice" == "r" ] || "$choice" == "R" ] ; then
aplay -vv /usr/share/sounds/alsa/Front_Right.wav
echo
read -p "Press <enter> to continue..."
fi
if "$choice" == "t" ] || "$choice" == "T" ] ; then
aplay -vv /usr/share/sounds/alsa/test.wav
echo
read -p "Press <enter> to continue..."
fi
if "$choice" == "Q" ] ; then
choice="q"
fi
done
choice="" ;;
"5")
tput clear
tput bold
tput setf 7
tput setb 4
echo $TST5
echo
tput setf 7
tput setb 1
tput bold
echo "Command: cat /proc/asound/version"
tput sgr0
echo
cat /proc/asound/version
echo
tput setf 7
tput setb 1
tput bold
echo "Command: cat /proc/asound/modules"
tput sgr0
echo
cat /proc/asound/modules
echo
tput setf 7
tput setb 1
tput bold
echo "Command: cat /proc/asound/cards"
tput sgr0
echo
cat /proc/asound/cards
echo
tput setf 7
tput setb 1
tput bold
echo "Command: cat /etc/modprobe.d/50-sound.conf"
tput sgr0
cat /etc/modprobe.d/50-sound.conf
echo
echo "If this does not provide the required info, then another approach to obtain more "
echo "information on your hardware and your sound configuration, is to run the ALSA script."
echo
read -p "Press <enter> to continue..." ;;
"6")
tput clear
tput bold
tput setf 7
tput setb 4
echo $TST6
echo
tput setf 7
tput setb 1
tput bold
echo "Command: sudo /usr/sbin/alsa-info.sh"
tput sgr0
echo
sudo /usr/sbin/alsa-info.sh
echo
read -p "Press <enter> to continue..." ;;
"7")
tput clear
tput bold
tput setf 7
tput setb 4
echo $TST7
echo
tput setf 7
tput setb 1
tput bold
echo "Command: /usr/sbin/alsa-info.sh"
tput sgr0
echo
/usr/sbin/alsa-info.sh
echo
read -p "Press <enter> to continue..." ;;
"8")
tput clear
tput bold
tput setf 7
tput setb 4
echo $TST8
echo
tput setf 7
tput setb 1
tput bold
echo "Command: /etc/init.d/alsasound stop - /etc/init.d/alsasound start - /usr/bin/kmix"
tput sgr0
echo
sudo /etc/init.d/alsasound stop
sudo /etc/init.d/alsasound start
/usr/bin/kmix
echo
echo "Just Answer NO to removing any Audio Devices if Asked."
echo
read -p "Press <enter> to continue..." ;;
"9")
tput clear
tput bold
tput setf 7
tput setb 4
echo $TST9
echo
tput setf 7
tput setb 1
tput bold
echo "Command: rpm --query --all --queryformat '%{NAME}-%{VERSION}-%{RELEASE}-%{ARCH} -> %{VENDOR}
' '*pulseaudio*'"
tput sgr0
echo
rpm --query --all --queryformat '%{NAME}-%{VERSION}-%{RELEASE}-%{ARCH} -> %{VENDOR}
' '*pulseaudio*'
echo
echo "You need the several programs (around 8) installed to use Pulse Audio from openSUSE"
echo
read -p "Press <enter> to continue..." ;;
"10")
tput clear
tput bold
tput setf 7
tput setb 4
echo $TSTA
echo
tput setf 7
tput setb 1
tput bold
echo "Command: sudo setup-pulseaudio --enable"
tput sgr0
echo
sudo setup-pulseaudio --enable
echo
read -p "Press <enter> to continue..." ;;
"11")
tput clear
tput bold
tput setf 7
tput setb 4
echo $TSTB
echo
tput setf 7
tput setb 1
tput bold
echo "Command: sudo setup-pulseaudio --disable"
tput sgr0
echo
sudo setup-pulseaudio --disable
echo
read -p "Press <enter> to continue..." ;;
"12")
tput clear
tput bold
tput setf 7
tput setb 4
echo $TSTC
echo
tput setf 7
tput setb 1
tput bold
echo "Command: lsof /dev/dsp* /dev/audio* /dev/mixer* /dev/snd/*"
tput sgr0
echo
lsof /dev/dsp* /dev/audio* /dev/mixer* /dev/snd/*
echo
echo "Sometimes, when one has basic sound functioning, but then it appears to stop in"
echo "the middle of a session (to be restored after a reboot) it may be because an "
echo "application has seized your audio device, and the application is not sharing nor"
echo "letting go the audio device. To determine what application is using one's sound"
echo "simple run this command from the S.T.A.R.T. script or use the CLI command above."
echo "If one runs this command at different times, when one's sound is working and not"
echo "working, one can learn better as to what the output means, and be better able to"
echo "point one's finger at the offending application that has seized the audio device."
echo
read -p "Press <enter> to continue..." ;;
"0")
tput clear
tput sgr0
echo
exit 0 ;;
*) ;;
esac
done
exit 0
# End of Bash File
In order to use the start script, it must be marked executable. So, open up a terminal session and enter the following command:
chmod +x ~/bin/start
Once you have marked it executable, to use start, simply open up a terminal session and type the command:
start
If you have any questions or suggestions, please let me know.
Thank You,