-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathsound_card_install.sh
executable file
·183 lines (168 loc) · 3.92 KB
/
sound_card_install.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/bin/bash
# This file will add the proper sound card configurations to your /etc/asound.conf
# I am unsure whether or not you need pulse and pulse_connect, but will be testing if its absolutely necessary.
# If you are not using any sound card please change all the following line of "card 1" to "card 0"
if [ $SUDO_USER ];
then
user=$SUDO_USER;echo
else
echo "Must be run as root user!!"
exit 1
fi
if [ -z "$exc" ]
then
source functions.sh
source dependencies.sh
fi
if [ -z "$SoundCard" ]
then
installlog "0. No Sound Card"
installlog "1. HifiBerry DAC Light"
installlog "2. HifiBerry DAC Standard/Pro"
installlog "3. HifiBerry Digi+"
installlog "4. Hifiberry Amp+"
installlog "5. Pi-IQaudIO DAC"
installlog "6. Pi-IQaudIO DAC+, Pi-IQaudIO DACZero, Pi-IQaudIO DAC PRO"
installlog "7. Pi-IQaudIO DigiAMP"
installlog "8. Pi-IQaudIO Digi+"
installlog "9. USB Sound Card"
installlog "10. JustBoom DAC and AMP Cards"
installlog "11. JustBoom Digi Cards"
SoundCard="SoundCard"
while true
do
read -p "Which Sound Card are you using? (0/1/2/3/4/5/6/7/8/9/10/11) : " SoundCard
case "$SoundCard" in
[0-9]|10|11)
break
;;
*)
echo "Please enter a valid choice"
;;
esac
done
fi
save_original /etc/asound.conf
sudo cat << EOT >> /etc/asound.conf
pcm.pulse {
type pulse
card 0
}
ctl.pulse {
type pulse
card 0
}
pcm.!default {
type hw
card 0
}
ctl.!default {
type hw
card 0
}
EOT
save_original /boot/config.txt
sudo cat <<EOT >> /boot/config.txt
# Enable HiFiberry Amp
#dtoverlay=hifiberry-amp
# Enable HiFiberry DAC Light
#dtoverlay=hifiberry-dac
# Enable HiFiberry DAC Standard/Pro
#dtoverlay=hifiberry-dacplus
# Enable HiFiberry Digi
#dtoverlay=hifiberry-digi
# Enable iqaudio-dac
#dtoverlay=iqaudio-dac
# Enable iqaudio-dac+
#dtoverlay=iqaudio-dacplus
# Enable iqaudio-DigiAMP+
#dtoverlay=iqaudio-dacplus,unmute_amp
# Enable iqaudio-Digi+
#dtoverlay=iqaudio-digi-wm8804-audio
# Enable JustBoom DAC and AMP Card
#dtoverlay=justboom-dac
# Enable JustBoom Digi Cards
#dtoverlay=justboom-digi
EOT
if [ "$SoundCard" != "0" ]
then
save_original /boot/config.txt
sed -i "s/dtparam=audio=on/#dtparam=audio=on/" /boot/config.txt
fi
if [ "$SoundCard" = "0" ]
then
save_original /etc/modprobe.d/alsa-base.conf
echo "options snd_bcm2835 index=0" | sudo tee -a /etc/modprobe.d/alsa-base.conf
elif [ "$SoundCard" = "1" ]
then
save_original /boot/config.txt
cat << EOT >>/boot/config.txt
# Enable HiFiberry DAC Light
dtoverlay=hifiberry-dac
EOT
elif [ "$SoundCard" = "2" ]
then
save_original /boot/config.txt
cat <<EOT >>/boot/config.txt
# Enable HiFiberry DAC Standard/Pro
dtoverlay=hifiberry-dacplus
EOT
elif [ "$SoundCard" = "3" ]
then
save_original /boot/config.txt
cat <<EOT >>/boot/config.txt
# Enable HiFiberry Digi
dtoverlay=hifiberry-digi
EOT
elif [ "$SoundCard" = "4" ]
then
save_original /boot/config.txt
cat <<EOT >>/boot/config.txt
# Enable HiFiberry Amp
dtoverlay=hifiberry-amp
EOT
elif [ "$SoundCard" = "5" ]
then
save_original /boot/config.txt
cat <<EOT >>/boot/config.txt
# Enable iqaudio-dac
dtoverlay=iqaudio-dac
EOT
elif [ "$SoundCard" = "6" ]
then
save_original /boot/config.txt
cat <<EOT >>/boot/config.txt
# Enable iqaudio-dac+
dtoverlay=iqaudio-dacplus
EOT
elif [ "$SoundCard" = "7" ]
then
save_original /boot/config.txt
cat <<EOT >>/boot/config.txt
# Enable iqaudio-DigiAMP+
dtoverlay=iqaudio-dacplus,unmute_amp
EOT
elif [ "$SoundCard" = "8" ]
then
save_original /etc/modprobe.d/alsa-base.conf
echo "options snd_bcm2835 index=0" | sudo tee -a /etc/modprobe.d/alsa-base.conf
save_original /boot/config.txt
cat <<EOT >>/boot/config.txt
# Enable iqaudio-Digi+
dtoverlay=iqaudio-digi-wm8804-audio
EOT
elif [ "$SoundCard" = "10" ]
then
save_original /boot/config.txt
cat <<EOT >>/boot/config.txt
# Enable JustBoom DAC and AMP Card
dtoverlay=justboom-dac
EOT
elif [ "$SoundCard" = "11" ]
then
save_original /boot/config.txt
cat <<EOT >>/boot/config.txt
# Enable JustBoom Digi Cards
dtoverlay=justboom-digi
EOT
fi