Chia sẻ một cách setup Spotify Connect trên Raspberry Pi (Cập nhật lần 2)

Discussion in 'Nguồn phát từ máy tính' started by tml3nr, 6/6/18.

  1. luckyluke

    luckyluke Advanced Member

    Joined:
    21/7/09
    Messages:
    75
    Likes Received:
    102
    Location:
    Hà Nội
    volumio có vẻ update nhanh, có điều chất lượng âm thanh ko dc review tốt bằng moode, picoreplayer cũng dc đánh giá cao SQ, đã bác nào thử chưa ?
     
  2. hn1804

    hn1804 Advanced Member

    Joined:
    29/2/16
    Messages:
    571
    Likes Received:
    605
    mình thì ít nghe spotify , chủ yếu chơi tidal ( FLAC/24bit/48khz/~1xxxkbps ) . thấy tidal chơi trên pi b+ với boss dac khá tốt , có điều không compare volume dc với tidal . Còn moode thấy hỗ trợ tidal qua UnPn compare volume tốt. Nhìn chung với nguồn phát là tidal thì các hdh volumio, rune, moode cho ra chất lượng âm thanh không chênh nhau nhiều
     
    tqv-hcm likes this.
  3. chauphuong

    chauphuong Advanced Member

    Joined:
    4/4/12
    Messages:
    2.351
    Likes Received:
    1.814
    Hic em thì đọc được nhiều review tốt về volumio. Mà volumio sau khi được tinh chỉnh sẽ hay hơn.
     
    mlab likes this.
  4. luckyluke

    luckyluke Advanced Member

    Joined:
    21/7/09
    Messages:
    75
    Likes Received:
    102
    Location:
    Hà Nội
    khả năng bác đọc review ở những chỗ toàn fan của volumio còn mình thì lại đọc ở chỗ toàn fan của moode :)
     
  5. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.514
    Mỗi OS có cái hay riêng ạ. Tùy theo cách sử dụng, tai và đồ đánh mà mình sẽ thấy cái nào OK hơn. Em test hết khả năng để yên tâm với lựa chọn của mình o_O
     
    Last edited: 26/6/18
  6. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.514
    Em mới test pi3 B+ / moode 4.1 / SC Fornoth v003 / Sound USB chạy OK ạ. Bản v003 và v004 đồng bộ được với alsa volume luôn.

    Dòng lệnh test của em là:

    Code:
    ./spotify-connect-web.sh --playback_device 'front:CARD=Device,DEV=0' --mixer_device_index 1 --mixer Speaker --username abc --password xyz --name moOde --bitrate 320
    File spotify-connect.service:

    Code:
    [Unit]
    Description=Spotify Connect
    After=network.target
    
    [Service]
    ExecStart=/root/spotify-connect-web.sh --playback_device 'front:CARD=Device,DEV=0' --mixer_device_index 1 --mixer Speaker --username abc --password xyz --name moOde --bitrate 320
    Restart=always
    RestartSec=10
    StartLimitInterval=30
    StartLimitBurst=20
    
    [Install]
    WantedBy=multi-user.target
    Các tham số của --playback_device / --device / --mixer /
    --mixer_device_index dựa theo kết quả của các lệnh sau:

    Code:
    root@moode:~# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
      Subdevices: 7/7
      Subdevice #0: subdevice #0
      Subdevice #1: subdevice #1
      Subdevice #2: subdevice #2
      Subdevice #3: subdevice #3
      Subdevice #4: subdevice #4
      Subdevice #5: subdevice #5
      Subdevice #6: subdevice #6
    card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    Code:
    root@moode:~# aplay -L
    null
        Discard all samples (playback) or generate zero samples (capture)
    btaplay_dmix
    alsaequal
    plug_alsaequal
    btstream
    crossfeed
    plug_bs2b
    eqfa4p
    plug_eqfa4p
    default:CARD=ALSA
        bcm2835 ALSA, bcm2835 ALSA
        Default Audio Device
    sysdefault:CARD=ALSA
        bcm2835 ALSA, bcm2835 ALSA
        Default Audio Device
    dmix:CARD=ALSA,DEV=0
        bcm2835 ALSA, bcm2835 ALSA
        Direct sample mixing device
    dmix:CARD=ALSA,DEV=1
        bcm2835 ALSA, bcm2835 IEC958/HDMI
        Direct sample mixing device
    dsnoop:CARD=ALSA,DEV=0
        bcm2835 ALSA, bcm2835 ALSA
        Direct sample snooping device
    dsnoop:CARD=ALSA,DEV=1
        bcm2835 ALSA, bcm2835 IEC958/HDMI
        Direct sample snooping device
    hw:CARD=ALSA,DEV=0
        bcm2835 ALSA, bcm2835 ALSA
        Direct hardware device without any conversions
    hw:CARD=ALSA,DEV=1
        bcm2835 ALSA, bcm2835 IEC958/HDMI
        Direct hardware device without any conversions
    plughw:CARD=ALSA,DEV=0
        bcm2835 ALSA, bcm2835 ALSA
        Hardware device with all software conversions
    plughw:CARD=ALSA,DEV=1
        bcm2835 ALSA, bcm2835 IEC958/HDMI
        Hardware device with all software conversions
    default:CARD=Device
        USB Audio Device, USB Audio
        Default Audio Device
    sysdefault:CARD=Device
        USB Audio Device, USB Audio
        Default Audio Device
    front:CARD=Device,DEV=0
        USB Audio Device, USB Audio
        Front speakers
    surround21:CARD=Device,DEV=0
        USB Audio Device, USB Audio
        2.1 Surround output to Front and Subwoofer speakers
    surround40:CARD=Device,DEV=0
        USB Audio Device, USB Audio
        4.0 Surround output to Front and Rear speakers
    surround41:CARD=Device,DEV=0
        USB Audio Device, USB Audio
        4.1 Surround output to Front, Rear and Subwoofer speakers
    surround50:CARD=Device,DEV=0
        USB Audio Device, USB Audio
        5.0 Surround output to Front, Center and Rear speakers
    surround51:CARD=Device,DEV=0
        USB Audio Device, USB Audio
        5.1 Surround output to Front, Center, Rear and Subwoofer speakers
    surround71:CARD=Device,DEV=0
        USB Audio Device, USB Audio
        7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
    iec958:CARD=Device,DEV=0
        USB Audio Device, USB Audio
        IEC958 (S/PDIF) Digital Audio Output
    dmix:CARD=Device,DEV=0
        USB Audio Device, USB Audio
        Direct sample mixing device
    dsnoop:CARD=Device,DEV=0
        USB Audio Device, USB Audio
        Direct sample snooping device
    hw:CARD=Device,DEV=0
        USB Audio Device, USB Audio
        Direct hardware device without any conversions
    plughw:CARD=Device,DEV=0
        USB Audio Device, USB Audio
        Hardware device with all software conversions
    Code:
    root@moode:~# amixer -c 1
    Simple mixer control 'Speaker',0
      Capabilities: pvolume pswitch pswitch-joined
      Playback channels: Front Left - Front Right
      Limits: Playback 0 - 37
      Mono:
      Front Left: Playback 27 [73%] [-10.00dB] [on]
      Front Right: Playback 27 [73%] [-10.00dB] [on]
    Simple mixer control 'Mic',0
      Capabilities: pvolume pvolume-joined cvolume cvolume-joined pswitch pswitch-joined cswitch cswitch-joined
      Playback channels: Mono
      Capture channels: Mono
      Limits: Playback 0 - 31 Capture 0 - 35
      Mono: Playback 0 [0%] [-99999.99dB] [off] Capture 20 [57%] [8.00dB] [on]
    Simple mixer control 'Auto Gain Control',0
      Capabilities: pswitch pswitch-joined
      Playback channels: Mono
      Mono: Playback [on]
    pi3_Bplus_2_USB.jpg
    2018-06-25_195620.png

    2018-06-25_195807.png
     
    Last edited: 26/6/18
  7. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.514
    Anh cho em xin vài hướng để tinh chỉnh Volumio với ạ. Tính năng của nó có vài cái hay nhưng về âm thanh em chưa thích lắm :rolleyes:
     
  8. chauphuong

    chauphuong Advanced Member

    Joined:
    4/4/12
    Messages:
    2.351
    Likes Received:
    1.814
    Oài trên hdvn nói mãi rồi bác.....
     
  9. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.514
    Em nhớ là chưa có nói tới việc optimize cho Volumio trên Pi ạ. Anh nhắc lại cho em nghe với :confused:
     
  10. luckyluke

    luckyluke Advanced Member

    Joined:
    21/7/09
    Messages:
    75
    Likes Received:
    102
    Location:
    Hà Nội
    bác mua cái đo dòng, áp ở đâu vậy ?
    hôm qua test thử volumio bản mới nhất với spotify plugin trên pi3 b+ và digione thì vẫn bị delay dù đã giảm so với moode
     
  11. chauphuong

    chauphuong Advanced Member

    Joined:
    4/4/12
    Messages:
    2.351
    Likes Received:
    1.814
    Mấy bài của dynobot trên mạng đó bác
     
  12. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.514
  13. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.514
    Vậy là các bài optimize kernel tương tự như vầy phải không ạ?

    https://volumio.org/forum/improve-sound-performance-subjective-t7499.html

    https://sites.google.com/site/compu...pberry-pi-music-server/raspberry-pi---volumio

    https://sites.google.com/view/dynob...pberry-pi-music-server/raspberry-pi---volumio

    Anh thấy settings nào OK cho em vài cái gợi ý. Vì các kiểu này nhiều quá chưa biết nên test cái nào trước :rolleyes:
     
    Last edited: 26/6/18
  14. chauphuong

    chauphuong Advanced Member

    Joined:
    4/4/12
    Messages:
    2.351
    Likes Received:
    1.814
    https://sites.google.com/site/computeraudioorg/home/setting-up-alsa
     
    tml3nr likes this.
  15. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.514
  16. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.514
    Em lấy thêm một em nữa để test SC. Ugreen 30712. Chipset Realtek ALC4040. Run out of the box.

    ugreen_30712.jpg

    Pi3 B+ / moode 4.1 / SC Fornoth v003. SC quản lý được alsa volume.

    Dòng lệnh chạy là:

    Code:
    ./spotify-connect-web.sh --playback_device 'front:CARD=Audio,DEV=0' --mixer_device_index 1 --mixer Headphone --username abc --password xyz --name moOde --bitrate 320 
    Code:
    root@moode:~# lsusb
    Bus 001 Device 004: ID 0bda:4835 Realtek Semiconductor Corp.
    Bus 001 Device 005: ID 0424:7800 Standard Microsystems Corp.
    Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
    Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Code:
    root@moode:~# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
      Subdevices: 7/7
      Subdevice #0: subdevice #0
      Subdevice #1: subdevice #1
      Subdevice #2: subdevice #2
      Subdevice #3: subdevice #3
      Subdevice #4: subdevice #4
      Subdevice #5: subdevice #5
      Subdevice #6: subdevice #6
    card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: Audio [USB Audio], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    Code:
    root@moode:~# aplay -L
    null
        Discard all samples (playback) or generate zero samples (capture)
    btaplay_dmix
    alsaequal
    plug_alsaequal
    btstream
    crossfeed
    plug_bs2b
    eqfa4p
    plug_eqfa4p
    default:CARD=ALSA
        bcm2835 ALSA, bcm2835 ALSA
        Default Audio Device
    sysdefault:CARD=ALSA
        bcm2835 ALSA, bcm2835 ALSA
        Default Audio Device
    dmix:CARD=ALSA,DEV=0
        bcm2835 ALSA, bcm2835 ALSA
        Direct sample mixing device
    dmix:CARD=ALSA,DEV=1
        bcm2835 ALSA, bcm2835 IEC958/HDMI
        Direct sample mixing device
    dsnoop:CARD=ALSA,DEV=0
        bcm2835 ALSA, bcm2835 ALSA
        Direct sample snooping device
    dsnoop:CARD=ALSA,DEV=1
        bcm2835 ALSA, bcm2835 IEC958/HDMI
        Direct sample snooping device
    hw:CARD=ALSA,DEV=0
        bcm2835 ALSA, bcm2835 ALSA
        Direct hardware device without any conversions
    hw:CARD=ALSA,DEV=1
        bcm2835 ALSA, bcm2835 IEC958/HDMI
        Direct hardware device without any conversions
    plughw:CARD=ALSA,DEV=0
        bcm2835 ALSA, bcm2835 ALSA
        Hardware device with all software conversions
    plughw:CARD=ALSA,DEV=1
        bcm2835 ALSA, bcm2835 IEC958/HDMI
        Hardware device with all software conversions
    default:CARD=Audio
        USB Audio, USB Audio
        Default Audio Device
    sysdefault:CARD=Audio
        USB Audio, USB Audio
        Default Audio Device
    front:CARD=Audio,DEV=0
        USB Audio, USB Audio
        Front speakers
    surround21:CARD=Audio,DEV=0
        USB Audio, USB Audio
        2.1 Surround output to Front and Subwoofer speakers
    surround40:CARD=Audio,DEV=0
        USB Audio, USB Audio
        4.0 Surround output to Front and Rear speakers
    surround41:CARD=Audio,DEV=0
        USB Audio, USB Audio
        4.1 Surround output to Front, Rear and Subwoofer speakers
    surround50:CARD=Audio,DEV=0
        USB Audio, USB Audio
        5.0 Surround output to Front, Center and Rear speakers
    surround51:CARD=Audio,DEV=0
        USB Audio, USB Audio
        5.1 Surround output to Front, Center, Rear and Subwoofer speakers
    surround71:CARD=Audio,DEV=0
        USB Audio, USB Audio
        7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
    iec958:CARD=Audio,DEV=0
        USB Audio, USB Audio
        IEC958 (S/PDIF) Digital Audio Output
    dmix:CARD=Audio,DEV=0
        USB Audio, USB Audio
        Direct sample mixing device
    dsnoop:CARD=Audio,DEV=0
        USB Audio, USB Audio
        Direct sample snooping device
    hw:CARD=Audio,DEV=0
        USB Audio, USB Audio
        Direct hardware device without any conversions
    plughw:CARD=Audio,DEV=0
        USB Audio, USB Audio
        Hardware device with all software conversions
    Code:
    root@moode:~# amixer -c 1
    Simple mixer control 'Headphone',0
      Capabilities: pvolume pswitch pswitch-joined
      Playback channels: Front Left - Front Right
      Limits: Playback 0 - 175
      Mono:
      Front Left: Playback 121 [69%] [-20.25dB] [on]
      Front Right: Playback 121 [69%] [-20.25dB] [on]
    Simple mixer control 'Mic',0
      Capabilities: cvolume cswitch cswitch-joined
      Capture channels: Front Left - Front Right
      Limits: Capture 0 - 67
      Front Left: Capture 67 [100%] [0.00dB] [on]
      Front Right: Capture 67 [100%] [0.00dB] [on]
    2018-06-26_192545.png

    sc_usb_testing_2.jpg
     
    Last edited: 26/6/18
  17. chauphuong

    chauphuong Advanced Member

    Joined:
    4/4/12
    Messages:
    2.351
    Likes Received:
    1.814
    Làm như nào để vào alsa mixer của Volumio vậy? Gg mãi ko ra
     
  18. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.514
    Em chưa rõ ý của anh ạ?

    http://volumio.local/dev

    enable ssh

    Dùng putty kết nối vào

    sudo su

    nhập pass volumio

    alsamixer
     
    chauphuong likes this.
  19. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.514
    RuneAudio_0.4_20170229 update 4.14.50-2 chạy được trên Pi3 B+

    (Đã install Spotify Connect Fornoth v003 xong bước 4)


    Bản này được làm như sau (Em bỏ qua bước addons menu và update MPD vì trước đây sau khi update tiếng nó dở đi nhiều):

    - Rune 04_20170229 chạy trên Pi3

    - Update theo cách của tay hondagx35:

    http://www.runeaudio.com/forum/runeaudio-0-4-beta-for-raspberry-pi2-3-t4434-390.html#p23950

    - Update RuneUI:

    http://www.runeaudio.com/forum/post24987.html

    - Install Spotify Connect Fornoth v003 đến bước thứ 4.

    - Add /etc/rc.local để fix cho sched_rr_timeslice_ms = 10 như bản gốc:

    Code:
    #!/bin/sh
    echo 10 > /proc/sys/kernel/sched_rr_timeslice_ms
    - Tạo link cho app remote hiện cover:

    Code:
    ln -s /mnt/MPD /var/www/covers
    ln -s /mnt/MPD /var/www/music
    ===============================​

    Debug data sau khi update lên 4.14.50-2 và fix sched_rr_timeslice_ms:

    Code:
    ###### Kernel optimization parameters ######
    hardware platform:   RaspberryPi2
    current orionprofile:   RuneAudio
    
    kernel scheduler for mmcblk0:       [noop] deadline cfq
    /proc/sys/vm/swappiness:       0
    /proc/sys/kernel/sched_latency_ns:     4500000
    /proc/sys/kernel/sched_rt_period_us:     1000000
    /proc/sys/kernel/sched_rt_runtime_us:     950000
    /proc/sys/kernel/sched_autogroup_enabled:   1
    /proc/sys/kernel/sched_rr_timeslice_ms:     10
    /proc/sys/kernel/sched_min_granularity_ns:   2250000
    /proc/sys/kernel/sched_wakeup_granularity_ns:   3000000
     
    Last edited: 28/6/18
  20. luckyluke

    luckyluke Advanced Member

    Joined:
    21/7/09
    Messages:
    75
    Likes Received:
    102
    Location:
    Hà Nội
    bác dùng pi3 b+ và HAT là gì để tạo bộ setup này ?
     
  21. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.514
    Bộ setup này em làm hoàn toàn trên Pi3. Không add Dac. Sau khi đóng gói mới mang qua Pi3 B+ để test. Trên Pi3 B+ em test với Hifiberry Dac+ Standard và USB Ugreen 30712.
     
    Last edited: 28/6/18
  22. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.514
    Em sửa lỗi không fix được kernel khi chạy wifi only:

    RuneAudio_0.4_20170229 update 4.14.50-2 chạy được trên Pi3 B+

    (Đã install Spotify Connect Fornoth v003 xong bước 4)

    Download:

    RuneAudio_0.4_20180629_SC_Pi3B_Plus_v3

    https://www.fshare.vn/file/GWYV887Z5EB3
    Bản v3 này được làm như sau (Em bỏ qua bước addons menu và update MPD vì trước đây sau khi update tiếng nó dở đi nhiều):

    - Rune 04_20170229 chạy trên Pi3

    - Update theo cách của tay hondagx35:

    http://www.runeaudio.com/forum/runeaudio-0-4-beta-for-raspberry-pi2-3-t4434-390.html#p23950

    - Update RuneUI:

    http://www.runeaudio.com/forum/post24987.html

    - Install Spotify Connect Fornoth v003 đến bước thứ 4:

    https://www.vnav.vn/threads/chia-se...spberry-pi-cap-nhat-lan-2.60527/#post-2010970

    - Add /etc/rc.local để fix cho sched_rr_timeslice_ms = 10 như bản gốc:

    Code:
    #!/bin/sh
    echo 10 > /proc/sys/kernel/sched_rr_timeslice_ms
    - Edit /usr/lib/systemd/system/rc-local.service:

    Code:
    [Unit]
    Description=fix kernel optimizations
    After=network.target
    
    [Service]
    Type=simple
    ExecStart=/etc/rc.local
    TimeoutSec=0
    
    [Install]
    WantedBy=multi-user.target
    - Tạo link cho app remote MPD hiện cover:

    Code:
    ln -s /mnt/MPD /var/www/covers
    ln -s /mnt/MPD /var/www/music
    ===============================​

    Debug data sau khi update lên 4.14.50-2 và fix sched_rr_timeslice_ms:

    Code:
    ###### Kernel optimization parameters ######
    hardware platform:   RaspberryPi2
    current orionprofile:   RuneAudio
    
    kernel scheduler for mmcblk0:       [noop] deadline cfq
    /proc/sys/vm/swappiness:       0
    /proc/sys/kernel/sched_latency_ns:     4500000
    /proc/sys/kernel/sched_rt_period_us:     1000000
    /proc/sys/kernel/sched_rt_runtime_us:     950000
    /proc/sys/kernel/sched_autogroup_enabled:   1
    /proc/sys/kernel/sched_rr_timeslice_ms:     10
    /proc/sys/kernel/sched_min_granularity_ns:   2250000
    /proc/sys/kernel/sched_wakeup_granularity_ns:   3000000
     
    Last edited: 30/6/18
    luckyluke and caigoc like this.
  23. hoangdinhson123

    hoangdinhson123 Approved Member

    Joined:
    3/9/17
    Messages:
    33
    Likes Received:
    30
    Bản Moode thì thì SC chạy được,sao Rune thì SC không nhận đc,không biết em làm sai chổ nào.Tải bản Rune làm đến bước 4 của bác.Trên Rune em cũng đã nhập account SC vào rồi.
     
    tml3nr likes this.
  24. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.514
    Anh test kỹ các tham số (x):

    --device x

    --mixer x

    hoặc như sau nếu là bản Fornoth 003

    --playback_device x

    --mixer_device_index x

    --mixer x
     
    hoangdinhson123 likes this.
  25. hoangdinhson123

    hoangdinhson123 Approved Member

    Joined:
    3/9/17
    Messages:
    33
    Likes Received:
    30
    Em dùng Pi3 +BossDac thì phải điền tham số như thế nào bác?
     
    tml3nr likes this.
Tags:

Share This Page

Loading...