-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add components folder to installation and docs. First component is hi…
…fiberry sound card
- Loading branch information
Showing
4 changed files
with
83 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Phoniebox components directory | ||
|
||
* [Hifberry](./hifiberry.md) |
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,41 @@ | ||
# HiFiBerry | ||
|
||
## Automatic setup | ||
|
||
Use this install script to enable your HiFiBerry board. | ||
|
||
``` | ||
$ cd; cd ~/RPi-Jukebox-RFID/installation/components && chmod +x setup-hifiberry.sh && sudo ./setup_hifiberry.sh | ||
``` | ||
|
||
## Manual steps to enable sound through HiFiBerry board | ||
|
||
1. Make sure your onboard sound of your Raspberry Pi is disabled. Check `/boot/config.txt`. The installation | ||
|
||
``` | ||
dtparam=audio=off | ||
``` | ||
2. Run the following command to enable HiFiBerry boards. | ||
``` | ||
echo "dtoverlay=hifiberry-dac" | sudo tee -a /boot/config.txt | ||
``` | ||
3. Enable volume control. Create or edit the following file: `sudo vi /etc/asound.conf` | ||
``` | ||
pcm.hifiberry { | ||
type softvol | ||
slave.pcm "plughw:0" | ||
control.name "HifiBerry" | ||
control.card 0 | ||
} | ||
pcm.!default { | ||
type plug | ||
slave.pcm "hifiberry" | ||
} | ||
``` | ||
4. Restart your device. |
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,38 @@ | ||
#!/bin/bash | ||
|
||
# Check if the script is run as root | ||
if [ "$(id -u)" != "0" ]; then | ||
echo "This script must be run as root" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
# Disable onboard sound of Raspberry Pi | ||
echo "Disabling onboard sound..." | ||
sed -i '/dtparam=audio=on/c\dtparam=audio=off' /boot/config.txt | ||
|
||
# Enable HiFiBerry board | ||
echo "Enabling HiFiBerry board..." | ||
grep -qxF 'dtoverlay=hifiberry-dac' /boot/config.txt || echo 'dtoverlay=hifiberry-dac' >> /boot/config.txt | ||
|
||
# Backup asound.conf | ||
if [ -f /etc/asound.conf ]; then | ||
echo "Backing up existing asound.conf..." | ||
cp /etc/asound.conf "/etc/asound.conf.backup.$(date +%Y%m%d%H%M%S)" | ||
fi | ||
|
||
echo "Configuring sound settings..." | ||
cat > /etc/asound.conf << EOF | ||
pcm.hifiberry { | ||
type softvol | ||
slave.pcm "plughw:0" | ||
control.name "HifiBerry" | ||
control.card 0 | ||
} | ||
pcm.!default { | ||
type plug | ||
slave.pcm "hifiberry" | ||
} | ||
EOF | ||
|
||
echo "Configuration complete. Please restart your device." |
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