Raspberry Pi + Rune Audio ::: Một trải nghiệm nghe nhạc mới

tellme0823

Well-Known Member
Có thấy nói gì đến roon và upnp đâu bác

Đã cài thử, không có roon với uPNP, có thể cài ép roon core bằng lệnh, cũng có thông báo thành công nhưng vào roon thì lại không nhận. Roon chỉ nhận qua airplay:(, tín hiệu xanh lè:confused:
Spotify với mấy cái radio tích hợp là ngon, còn lại không thấy có gì đặc biệt hết.
C2Wbky.png


PS:
Mình cài bản cho pi3, bản dành cho pi4 hình như có uPnP, bác nào có pi4 cài thử:
1.FLAC音源の全サンプリングレート音源(44.1K~192K)再生
2.DSF音源のDSDtoPCM(176.4KHz/24bit)再生
3.UPnP化(upmpdcliのインストール)
4.USB3.0 SSDの接続(UASP適用除外含む)
5.minim server(含むopenjdkインストール)
6.ffmpeg(上記minim server用変換機能部分)

Bản dành cho pi4:
https://drive.google.com/file/d/1WrflSWLz-2oy-W-8fL2VLu72-7yB8efk/view?usp=drivesdk
 
Chỉnh sửa lần cuối:

tml3nr

Moderator
Đã cài thử, không có roon với uPNP, có thể cài ép roon core bằng lệnh, cũng có thông báo thành công nhưng vào roon thì lại không nhận. Roon chỉ nhận qua airplay:(, tín hiệu xanh lè:confused:
Spotify với mấy cái radio tích hợp là ngon, còn lại không thấy có gì đặc biệt hết.

C2Wbky.png

PS:
Mình cài bản cho pi3, bản dành cho pi4 hình như có uPnP, bác nào có pi4 cài thử:
1.FLAC音源の全サンプリングレート音源(44.1K~192K)再生
2.DSF音源のDSDtoPCM(176.4KHz/24bit)再生
3.UPnP化(upmpdcliのインストール)
4.USB3.0 SSDの接続(UASP適用除外含む)
5.minim server(含むopenjdkインストール)
6.ffmpeg(上記minim server用変換機能部分)

Bản dành cho pi4:
https://drive.google.com/file/d/1WrflSWLz-2oy-W-8fL2VLu72-7yB8efk/view?usp=drivesdk
Nếu dùng dac i2s master mode. Các anh xem đoạn này:

https://www.symphonic-mpd.com/forum/topic/5/インストール-installation-guide

3. dt-blob.bin

Note: Users of the I2S HAT card operating in slave mode can skip this content.

3.1 Replace dt-blob.bin

symphonic-mpd has dt-blob.bin in the boot directory. This is a file to add a function to generate PLL (Phase Locked Loop) optimized for music playback to raspberry pi. There is a difference in the PLL value to be optimized between master mode and slave mode. However, dt-blob.bin does not have a function to switch between master mode and slave mode, so it is necessary to switch the dt-blob.bin file manually. For that purpose, three types of dt-blob.bin, specifically, dt-blob.bin, dt-blob.bin.master, and dt-blob.bin.slave are arranged. The default dt-blob.bin is for slave mode.

Therefore, it is not necessary to replace dt-blob.bin when using an I2S HAT card for slave mode.

There is no problem even if I2S HAT card for master mode is driven by dt-blob.bin for slave. Even if you are a user of I2S HAT card for master mode, you can skip this step. However, by replacing dt-blob.bin with dt-blob.bin.master, you can expect some improvement in playback sound quality.

The replacement method is easy. Mount the micro SD card for boot on the PC. Rename or delete dt-blob.bin that is visible in the micro SD card. Then rename dt-blob.bin.master to dt-blob.bin.

Here is a brief description of raspberry pi’s PLL (Phase Locked Loop). Five types of PLL are connected to the raspberry pi’s clock (19.2MHz) to provide clocks for various functions.

Each of the five PLLs is used as follows:

PLLA … 未使用 (unused)

PLLB …CPU のクロックのみに使用(可変) (Used only for CPU clock, variable)

PLLC …GPU やSDRAM等のクロックに使用(可変)(Used for GPU and SDRAM clocks, variable)

PLLD …I2S 等で使用(デフォルトで500MHz) (Used by I2S etc., 500MHz by default)

PLLH …HDMI 等で使用

In raspberry pi, 44.1KHz / 48KHz BCLK used in I2S is usually calculated from PLLD (500MHz) using a fractional frequency division PLL and generated by the MASH algorithm.

For example, when generating BCLK 2,822,400Hz of 44.1KHz sound source, two frequencies of 2,808,988Hz and 2,824,858Hz are combined at a specific ratio, and 2,822,400Hz is generated as BCLK from the average.

However, the clock generated in this way is not suitable for music playback. Therefore, in symphonic-mpd, the MASH operation is turned off, and the PLL frequency is obtained from the common multiple of 44.1KHz / 48KHz and the oscillator (19.2MHz). In addition, the 44.1KHz PLL and the 48KHz PLL are automatically switched during playback. The default dt-blob.bin, which is for slave mode, has made this possible and has succeeded in improving clock quality.

Do not replace dt-blob.bin with dt-blob.bin.master when using an I2S HAT card that operates in slave mode.

In dt-blob.bin.master, unnecessary PLL settings are turned off. When the slave mode I2S HAT is driven in this state, the PLL frequency is completely different from the ideal one, which causes problems with playback speed and pitch.

In addition, because the operation cycle of the RTDM driver is shifted, the timer offset is frequently adjusted, and it is far from optimal operation. As a result, the sound quality is greatly reduced.

For that reason, the dt-blob.bin.master file should not be used for I2S HAT cards operating in slave mode.

3.2 Explanation of slave mode and master mode

Many I2S HAT cards operate in slave mode. The term "slave" here means that the digital data supplied from the Raspberry Pi to the I2S HAT card is supplied based on the clock generated by the Raspberry Pi.

On the other hand, some I2S HAT cards have their own oscillators, and can supply the clock generated by the oscillator on the I2S HAT card to the Raspberry Pi. These I2S HAT cards are supplied with data from the Raspberry Pi based on the clock generated by themselves. Such a driving method is called “master mode”.
 
Chỉnh sửa lần cuối:

toi511

Well-Known Member
Anh gửi mail cho 3 người đó để xin pass tham gia vào group.
Cảm ơn bác
Đã cài thử, không có roon với uPNP, có thể cài ép roon core bằng lệnh, cũng có thông báo thành công nhưng vào roon thì lại không nhận. Roon chỉ nhận qua airplay:(, tín hiệu xanh lè:confused:
Spotify với mấy cái radio tích hợp là ngon, còn lại không thấy có gì đặc biệt hết.
C2Wbky.png


PS:
Mình cài bản cho pi3, bản dành cho pi4 hình như có uPnP, bác nào có pi4 cài thử:
1.FLAC音源の全サンプリングレート音源(44.1K~192K)再生
2.DSF音源のDSDtoPCM(176.4KHz/24bit)再生
3.UPnP化(upmpdcliのインストール)
4.USB3.0 SSDの接続(UASP適用除外含む)
5.minim server(含むopenjdkインストール)
6.ffmpeg(上記minim server用変換機能部分)

Bản dành cho pi4:
https://drive.google.com/file/d/1WrflSWLz-2oy-W-8fL2VLu72-7yB8efk/view?usp=drivesdk
so sánh âm thanh với bản khác sao bác
 

tellme0823

Well-Known Member
Có 1 điểm các bác chú ý là khi khởi động lại, ko biết vì lý do gì rất hay treo, chờ hoài không thấy lên, phải tắt nguồn để tầm 2,3 phút rồi bật lại:oops:
 
Chỉnh sửa lần cuối:

tml3nr

Moderator
Có 1 điểm các bác chú ý là khi khởi động lại, ko biết vì lý do gì rất hay treo, chờ hoài không thấy lên, phải tắt nguồn để tầm 2,3 phút bật lại nó mới lên:oops:
Anh trả lại dt-blob.bin gốc xem nó có ít treo hơn và âm thanh có khác nhiều không ạ?
 

tml3nr

Moderator
Em rất thích cách smpd config khi chạy một service nào đó thì sẽ tự động tắt những cái khác. Cực hay.

mpd_event.sh

Mã:
#!/bin/bash

sudo sync
sudo mount -a

if [ $? = 1 ]; then
  exit
fi

# cifs
if [ -e /var/lib/mpd/music/NAS/ ]; then
  sudo taskset -p $CIFS_AFFINITY $(pidof cifsd)
  sudo chrt --fifo -p $CIFS_PRIORITY $(pidof cifsd)
fi

count=0
while [ "$(pstree -ps mpd|grep -o player.* |sed -r 's/^.*}\((.*)\)$/\1/')" = "" ]
do
  sleep 0.1
  let ++count; if [ $count = 100 ]; then break; fi
done
if [ ! $count = 100 ]; then
  mpd=$(pidof mpd)
  io=$(pstree -ps mpd|grep -o io.*  |sed -r 's/^.*}\((.*)\)$/\1/')
  player=$(pstree -ps mpd|grep -o player.* |sed -r 's/^.*}\((.*)\)$/\1/')
  decoder=$(pstree -ps mpd|grep -o decoder.*|sed -r 's/^.*}\((.*)\)$/\1/')
  sudo renice -10 $mpd
  sudo taskset -p 8 $mpd
  sudo chrt --rr -p 1 $io
  sudo chrt --rr -p 1 $player
  sudo chrt --rr -p 50 $decoder
fi

spotify_event.sh

Mã:
#!/bin/bash

pcminfo=/run/pcminfo

case "$PLAYER_EVENT" in

  start)
   # stop playback
   /usr/bin/mpc stop > /dev/null

   # stop mpd
   sudo systemctl stop ympd
   sudo systemctl stop ympd.socket
   sudo systemctl stop mpd
   sudo umount /var/lib/mpd/music/NAS

   # stop shairport-sync
   sudo systemctl stop shairport-sync
   sudo sync
   sleep 0.4
   exit
   ;;

  stop)
   if [ ! "`cat /run/pcminfo |cut -d ' ' -f4`" = "DEFAULT" ];then
     exit
   fi
   # wakeup mpd
   sudo systemctl start ympd.socket
   sudo mount -a
   sudo systemctl start mpd

   # start shairport-sync
   sudo systemctl start shairport-sync
   sudo sync
   exit
   ;;
esac

exit 0

shairport_event.sh

Mã:
#!/bin/bash

case "$1" in

  begin)
   echo "$DEFAULT_SAMPLE_FORMAT 44100 2 AIRPLAY" > /run/pcminfo
   sudo systemctl restart pipe

   # stop mpd
   sudo systemctl stop ympd
   sudo systemctl stop ympd.socket
   sudo systemctl stop mpd
   sudo umount /var/lib/mpd/music/NAS

   # stop spotify-connect
   sudo systemctl stop spotifyd

   sync
   sleep 0.4
   exit
   ;;

  end)
   # wakeup mpd
   sudo systemctl start ympd.socket
   sudo mount -a
   sudo systemctl start mpd

   # wakeup spotify-connect
   sudo systemctl start spotifyd
   sync
   exit
   ;;
esac

exit 0
 
Chỉnh sửa lần cuối:

tellme0823

Well-Known Member
Em rất thích cách smpd config khi chạy một service nào đó thì sẽ tự động tắt những cái khác. Cực hay.

mpd_event.sh

Mã:
#!/bin/bash

sudo sync
sudo mount -a

if [ $? = 1 ]; then
  exit
fi

# cifs
if [ -e /var/lib/mpd/music/NAS/ ]; then
  sudo taskset -p $CIFS_AFFINITY $(pidof cifsd)
  sudo chrt --fifo -p $CIFS_PRIORITY $(pidof cifsd)
fi

count=0
while [ "$(pstree -ps mpd|grep -o player.* |sed -r 's/^.*}\((.*)\)$/\1/')" = "" ]
do
  sleep 0.1
  let ++count; if [ $count = 100 ]; then break; fi
done
if [ ! $count = 100 ]; then
  mpd=$(pidof mpd)
  io=$(pstree -ps mpd|grep -o io.*  |sed -r 's/^.*}\((.*)\)$/\1/')
  player=$(pstree -ps mpd|grep -o player.* |sed -r 's/^.*}\((.*)\)$/\1/')
  decoder=$(pstree -ps mpd|grep -o decoder.*|sed -r 's/^.*}\((.*)\)$/\1/')
  sudo renice -10 $mpd
  sudo taskset -p 8 $mpd
  sudo chrt --rr -p 1 $io
  sudo chrt --rr -p 1 $player
  sudo chrt --rr -p 50 $decoder
fi

spotify_event.sh

Mã:
#!/bin/bash

pcminfo=/run/pcminfo

case "$PLAYER_EVENT" in

  start)
   # stop playback
   /usr/bin/mpc stop > /dev/null

   # stop mpd
   sudo systemctl stop ympd
   sudo systemctl stop ympd.socket
   sudo systemctl stop mpd
   sudo umount /var/lib/mpd/music/NAS

   # stop shairport-sync
   sudo systemctl stop shairport-sync
   sudo sync
   sleep 0.4
   exit
   ;;

  stop)
   if [ ! "`cat /run/pcminfo |cut -d ' ' -f4`" = "DEFAULT" ];then
     exit
   fi
   # wakeup mpd
   sudo systemctl start ympd.socket
   sudo mount -a
   sudo systemctl start mpd

   # start shairport-sync
   sudo systemctl start shairport-sync
   sudo sync
   exit
   ;;
esac

exit 0

shairport_event.sh

Mã:
#!/bin/bash

case "$1" in

  begin)
   echo "$DEFAULT_SAMPLE_FORMAT 44100 2 AIRPLAY" > /run/pcminfo
   sudo systemctl restart pipe

   # stop mpd
   sudo systemctl stop ympd
   sudo systemctl stop ympd.socket
   sudo systemctl stop mpd
   sudo umount /var/lib/mpd/music/NAS

   # stop spotify-connect
   sudo systemctl stop spotifyd

   sync
   sleep 0.4
   exit
   ;;

  end)
   # wakeup mpd
   sudo systemctl start ympd.socket
   sudo mount -a
   sudo systemctl start mpd

   # wakeup spotify-connect
   sudo systemctl start spotifyd
   sync
   exit
   ;;
esac

exit 0
Khi đang chơi nhạc nó tắt sạch, đỉnh thật:eek: nghe spotify thôi cũng thấy phê.
C24Gut.png
 

tellme0823

Well-Known Member
add nas như nào bác, em làm hoài mà chả được. em xài Fifo Pi thì cần cài đặt như nào ah. thanks bác
Nas mình chưa thử, còn cấu hình thì có 2 mode slave và master. Master xài clock của board slave xài lock của pi, tuỳ con board của bác có lock rời hay không mà chọn tương ứng. Nếu chọn master bác phải đổi file bin.master thành file bin. Còn tên board bác chọn trong thiết định soundcard, mình cũng ko biết có board fifo của bác ko, tối về mình xem lại thử
 

dungsin_lqd

Well-Known Member
Em rất thích cách smpd config khi chạy một service nào đó thì sẽ tự động tắt những cái khác. Cực hay.

mpd_event.sh

Mã:
#!/bin/bash

sudo sync
sudo mount -a

if [ $? = 1 ]; then
  exit
fi

# cifs
if [ -e /var/lib/mpd/music/NAS/ ]; then
  sudo taskset -p $CIFS_AFFINITY $(pidof cifsd)
  sudo chrt --fifo -p $CIFS_PRIORITY $(pidof cifsd)
fi

count=0
while [ "$(pstree -ps mpd|grep -o player.* |sed -r 's/^.*}\((.*)\)$/\1/')" = "" ]
do
  sleep 0.1
  let ++count; if [ $count = 100 ]; then break; fi
done
if [ ! $count = 100 ]; then
  mpd=$(pidof mpd)
  io=$(pstree -ps mpd|grep -o io.*  |sed -r 's/^.*}\((.*)\)$/\1/')
  player=$(pstree -ps mpd|grep -o player.* |sed -r 's/^.*}\((.*)\)$/\1/')
  decoder=$(pstree -ps mpd|grep -o decoder.*|sed -r 's/^.*}\((.*)\)$/\1/')
  sudo renice -10 $mpd
  sudo taskset -p 8 $mpd
  sudo chrt --rr -p 1 $io
  sudo chrt --rr -p 1 $player
  sudo chrt --rr -p 50 $decoder
fi

spotify_event.sh

Mã:
#!/bin/bash

pcminfo=/run/pcminfo

case "$PLAYER_EVENT" in

  start)
   # stop playback
   /usr/bin/mpc stop > /dev/null

   # stop mpd
   sudo systemctl stop ympd
   sudo systemctl stop ympd.socket
   sudo systemctl stop mpd
   sudo umount /var/lib/mpd/music/NAS

   # stop shairport-sync
   sudo systemctl stop shairport-sync
   sudo sync
   sleep 0.4
   exit
   ;;

  stop)
   if [ ! "`cat /run/pcminfo |cut -d ' ' -f4`" = "DEFAULT" ];then
     exit
   fi
   # wakeup mpd
   sudo systemctl start ympd.socket
   sudo mount -a
   sudo systemctl start mpd

   # start shairport-sync
   sudo systemctl start shairport-sync
   sudo sync
   exit
   ;;
esac

exit 0

shairport_event.sh

Mã:
#!/bin/bash

case "$1" in

  begin)
   echo "$DEFAULT_SAMPLE_FORMAT 44100 2 AIRPLAY" > /run/pcminfo
   sudo systemctl restart pipe

   # stop mpd
   sudo systemctl stop ympd
   sudo systemctl stop ympd.socket
   sudo systemctl stop mpd
   sudo umount /var/lib/mpd/music/NAS

   # stop spotify-connect
   sudo systemctl stop spotifyd

   sync
   sleep 0.4
   exit
   ;;

  end)
   # wakeup mpd
   sudo systemctl start ympd.socket
   sudo mount -a
   sudo systemctl start mpd

   # wakeup spotify-connect
   sudo systemctl start spotifyd
   sync
   exit
   ;;
esac

exit 0
giờ muốn chơi audio chắc phải học thêm khoá linux quá...nhiều dòng code linux đọc vào mù tịt ....
 
Bên trên