Bản Pi2/3 này hack não quá không bù cho bản pi4 1.0x, chỉ copy cái vsound vào là kêu liền.
This is the procedure to use SMPD as the front end of smpd player.
★ Notes ★
・ Please execute cat to EOC as it is for file creation and addition.
-Although the file change is described by the nano command in the procedure
, replace it with a familiar editor and execute it.
-I think that the operation may be unstable depending on the environment, but
basically it cannot be handled. Please use with your consent.
・This is the procedure for v0.9 series.
※ If you are out from the image writing to the microSD card,
so we have prepared the modified file,
here please refer to the reference.
(1) Addition of / home / pi / configs / environment
* Added definition for ncat
* Correct the IP address of NCAT_HOST according to the environment when using HUB
cat << EOC >> /home/pi/configs/environment
######################################################
# ncat
######################################################
NCAT_HOST=10.0.0.2
NCAT_DAT_PORT=4444
NCAT_INS_PORT=4443
NCAT_ACK_PORT=4445
EOC
(2) Change /boot/config.txt
* Comment out the DAC settings
sudo nano /boot/config.txt
Change before
# I2S DAC
dtoverlay=rpi-dac
After change (insert # to the left of dtoverlay)
# I2S DAC
#dtoverlay=rpi-dac
(3) Change /etc/rc.local
* Load SCTP driver and change settings
sudo nano /etc/rc.local
Change before
# LED Off
echo 0 | sudo tee /sys/class/leds/led0/brightness
echo 0 | sudo tee /sys/class/leds/led1/brightness
;;
After change (;; insert SCTP related above line)
# LED Off
echo 0 | sudo tee /sys/class/leds/led0/brightness
echo 0 | sudo tee /sys/class/leds/led1/brightness
# SCTP
sudo modprobe sctp
echo Y > /sys/module/sctp/parameters/no_checksums
echo 0 > /proc/sys/net/sctp/prsctp_enable
echo 1 > /proc/sys/net/sctp/rcvbuf_policy
;;
(4) Change /etc/mpd.conf
* Change the file to be called during playback
sudo nano /etc/mpd.conf
Change before
command "exec /home/pi/misc/pcminfo.sh"
After change
command "exec /home/pi/misc/pcminfo_ncat.sh"
(5) Create
/home/pi/misc/pcminfo_ncat.sh * File called during playback via mpd and alsa
cat << EOC > /home/pi/misc/pcminfo_ncat.sh
#!/bin/bash
PCMINFO=/run/pcminfo
ENVFILE=/etc/environment
. \$ENVFILE
APP=MPD
if [ ! "\$4" = "" ]; then
APP=\$4
fi
echo "\$1 \$2 \$3 \$APP" > \$PCMINFO
/usr/local/bin/ncrecv -l \$NCAT_ACK_PORT -c /bin/true >/dev/null 2>&1 &
cat \$PCMINFO | /usr/local/bin/ncsend --sctp \$NCAT_HOST \$NCAT_INS_PORT
wait
if [ "\$APP" != "AIRPLAY" ]; then
exec cat - | /usr/local/bin/ncsend --sctp --send-only \$NCAT_HOST \$NCAT_DAT_PORT
else
sudo start-stop-daemon --start --quiet --background --exec /home/pi/misc/pipeout2ncat.sh
fi
exit
EOC
Add execute permission & confirm
chmod 755 /home/pi/misc/pcminfo_ncat.sh
ls -l /home/pi/misc/pcminfo_ncat.sh
Check result
-rwxr-xr-x 1 pi pi 516 Oct 19 15:38 /home/pi/misc/pcminfo_ncat.sh
(6) Change /home/pi/configs/pipe.sh
* Disable aplay-rt startup and add named pipe creation process (for Shairport Sync)
nano /home/pi/configs/pipe.sh
Before change 1
device="hw:0,0"
pcminfo=/run/pcminfo
After change 1 (insert pipeout line)
device="hw:0,0"
pcminfo=/run/pcminfo
pipeout=/run/pipeout
Before change 2
exec)
if [ ! -e $pcminfo ]; then
After change 2 (Insert conditional branch of pipeout directly under exec line)
exec)
if [ ! -e $pipeout ]; then
mkfifo --mode=666 $pipeout
fi
if [ ! -e $pcminfo ]; then
Before change 3
exec /usr/local/bin/aplay-rt $opt_aplay
After change 3 (insert # at the left end)
#exec /usr/local/bin/aplay-rt $opt_aplay
(7) Change /home/pi/configs/shairport_event.sh
* Fixed to start ncat when Shairport Sync starts.
nano /home/pi/configs/shairport_event.sh
Before change 1
begin)
echo "$DEFAULT_SAMPLE_FORMAT 44100 2 AIRPLAY" > /run/pcminfo
sudo systemctl restart pipe
After change 1 (comment out 2 lines, add 3 lines)
begin)
#echo "$DEFAULT_SAMPLE_FORMAT 44100 2 AIRPLAY" > /run/pcminfo
#sudo systemctl restart pipe
# stop pipe & start ncat
sudo systemctl stop pipe
/home/pi/misc/pcminfo_ncat.sh $DEFAULT_SAMPLE_FORMAT 44100 2 AIRPLAY
Before change 2
end)
# wakeup mpd
After change 2 (3 lines added directly under end)
end)
# stop ncat & start pipe
sudo start-stop-daemon --stop --ppid `pgrep pipeout2ncat`
sudo systemctl start pipe
# wakeup mpd
(8) Change /etc/shairport-sync.conf
* Change the output destination of pipe
sudo nano /etc/shairport-sync.conf
Change before
name = "/dev/xsink";
After change
name = "/run/pipeout";
(9) Create /home/pi/misc/pipeout2ncat.sh
* Pass Shairport Sync data to ncat
cat << EOC > /home/pi/misc/pipeout2ncat.sh
#!/bin/bash
PIPEOUT=/run/pipeout
ENVFILE=/etc/environment
. \$ENVFILE
cat \$PIPEOUT | /usr/local/bin/ncsend --sctp --send-only \$NCAT_HOST \$NCAT_DAT_PORT
exit
EOC
Add execute permission & confirm
chmod 755 /home/pi/misc/pipeout2ncat.sh
ls -l /home/pi/misc/pipeout2ncat.sh
Check result
-rwxr-xr-x 1 pi pi 159 Oct 19 15:42 /home/pi/misc/pipeout2ncat.sh
(10) Change /etc/asound.conf
* Change the file to be called when playing via alsa
sudo nano /etc/asound.conf
Change before
file "|exec /home/pi/misc/pcminfo.sh %f %r %c DEFAULT"
After change
file "|exec /home/pi/misc/pcminfo_ncat.sh %f %r %c DEFAULT"
(11) Copy of ncat command
cd /tmp
wget "
https://drive.google.com/uc?export=download&id=1BRfDzFX9L6rZhYA9VxbnvvRgTrBXg_GL" -O front-end_pkg.tar.gz
tar xfp front-end_pkg.tar.gz
sudo cp -p front-end_pkg/ncrecv front-end_pkg/ncsend /usr/local/bin
Confirmation
ls -l /usr/local/bin/nc[rs]*
Check result
-rwxr-xr-x 1 pi pi 43104 Aug 3 17:26 /usr/local/bin/ncrecv
-rwxr-xr-x 1 pi pi 47188 Aug 3 17:31 /usr/local/bin/ncsend
(12) Power off
sudo poweroff
(13) Connect the backend and start