-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaudiotest.sh
executable file
·54 lines (50 loc) · 1.15 KB
/
audiotest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
CARD=1
DEVICE=0
INPDIR="/usr/share/sounds/alsa"
INPUTS="Side_Left.wav \
Side_Right.wav \
Front_Center.wav \
Front_Left.wav \
Front_Right.wav \
Noise.wav \
Rear_Center.wav \
Rear_Left.wav \
Rear_Right.wav"
usage() {
printf "\nUsage: audiotest [-c card] [-d device] [-u]"
printf "\nDefaults: card 1, device 0\n\n"
if [ -f ${HOME}/.asoundrc ]
then
printf "Current ALSA settings in $HOME/.asoundrc :\n\n"
cat ${HOME}/.asoundrc
printf "\n"
else
if [ -f /etc/asound.conf ]
then
printf "Current ALSA settings in /etc/asound.conf :\n\n"
cat /etc/asound.conf
printf "\n"
else
echo "Cannot locate ALSA configuration $HOME/.asoundrc or /etc/asound.conf"
fi
fi
exit 1
}
while getopts "c:d:u" flag; do
case $flag in
c)
CARD="$OPTARG"
;;
d)
DEVICE="$OPTARG"
;;
u)
usage
;;
esac
done
for input in ${INPUTS}
do
aplay -D plughw:${CARD},${DEVICE} ${INPDIR}/${input}
done