-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version of I2S digital audio
- Loading branch information
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,40 @@ | ||
#!/bin/bash | ||
|
||
chown -R pi:pi /home/pi/hack-clock | ||
|
||
# Also modify /boot/config.txt | ||
# Turn off audio and add dtoverlay=hifiberry-dac | ||
# As well as dtoverlay=i2s-mmap | ||
CONFIG=/boot/config.txt | ||
|
||
if [ -e $CONFIG ] && grep -q "^dtoverlay=hifiberry-dac$" $CONFIG; then | ||
echo "dtoverlay already active" | ||
else | ||
echo "dtoverlay=hifiberry-dac" | sudo tee -a $CONFIG | ||
ASK_TO_REBOOT=true | ||
fi | ||
|
||
if [ -e $CONFIG ] && grep -q -E "^dtparam=audio=on$" $CONFIG; then | ||
bcm2835off="no" | ||
newline | ||
echo "Disabling default sound driver" | ||
sudo sed -i "s|^dtparam=audio=on$|#dtparam=audio=on|" $CONFIG &> /dev/null | ||
if [ -e $LOADMOD ] && grep -q "^snd-bcm2835" $LOADMOD; then | ||
sudo sed -i "s|^snd-bcm2835|#snd-bcm2835|" $LOADMOD &> /dev/null | ||
fi | ||
ASK_TO_REBOOT=true | ||
elif [ -e $LOADMOD ] && grep -q "^snd-bcm2835" $LOADMOD; then | ||
bcm2835off="no" | ||
newline | ||
echo "Disabling default sound module" | ||
sudo sed -i "s|^snd-bcm2835|#snd-bcm2835|" $LOADMOD &> /dev/null | ||
ASK_TO_REBOOT=true | ||
else | ||
newline | ||
echo "Default sound driver currently not loaded" | ||
bcm2835off="yes" | ||
fi | ||
|
||
speaker-test -l5 -c2 -t wav | ||
|
||
amixer set PCM -- 85% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pcm.!default { | ||
type hw card 0 | ||
} | ||
ctl.!default { | ||
type hw card 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters