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. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    Thead cũ em vừa mò vừa post nên rối quá. Em mạn phép lập thead mới để cho mọi người dễ xem.

    Bài viết sẽ nói về cách setup Spotify Connect (SC) cho 3 OS phổ biến trên Raspberry Pi là RuneAudio, moodeaudio và Volumio.

    Như ta đã biết Spotify có 2 cách play:

    1. Spotify Client: Dùng app hoặc web browser. Có 2 trường hợp xảy ra, là mình có thể browse được album hay là chỉ phát được theo playlist có sẵn.

    Spotify Client của Rune là theo cách chỉ phát được theo playlist.

    2. Spotify Connect: Là cái em đề cập trong bài viết này.

    Em xin phép nhắc lại một chút về nguyên lý hoạt động của Spotify Connect cho các anh chưa rõ. Với cách này, khi mình chạy Spotify trên một app / software / web browser bất kỳ. Mình sẽ định cho nó xuất âm thanh ra thiết bị đang chạy Spotify Connect. Sau đó server Spotify sẽ chủ động đẩy playlist đang phát đó xuống thẳng Spotify Connect mà không lệ thuộc vào app phát lệnh play. Có nghĩa là sau khi bấm play trên iPad, mình turn off iPad đi thì nhạc vẫn phát ra Spotify Connect bình thường.

    Spotify Connect cần phải có acc premium mới chạy được.

    Bài viết sẽ có 3 phần. Nói về cách setup SC cho 3 OS.

    Để cho dễ thao tác. Ta sẽ dùng Putty và WinSCP.

    Thiết bị test và tham số trong bài viết này dựa trên Pi2 và Boss Dac. Nếu DAC khác các tham số (x) sau có thể sẽ thay đổi:

    --device (x)

    --playback_device (x)

    --mixer_device_index (x)

    --mixer (x)

    Để biết những tham số này ta dùng các lệnh sau để xem:

    alsamixer

    amixer

    aplay -l

    aplay -L
     
    Last edited: 6/6/18
    Tags:
    Rndce, mlab and chuong46 like this.
  2. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    Phần 1 - RuneAudio (Hiện tại chỉ có 1 cách của Fornoth):

    Trước tiên ta cần phải extend partition cho thẻ nhớ:

    Code:
    fdisk /dev/mmcblk0
    
    - Press "p" to show the current partitions and note down the details of the main one that RuneOS is on.
    - Delete it, pressing "d" and choosing the relevant partition number.
    - Press "n" to make a new partition, and "p" to select a primary partition. Enter the same start block that you wrote down above, and allow it to use the default end block (the last block available on the device).
    - Press "w" to write changes and exit.
    
    You may have to reboot after this for changes to be registered. This has resized the partition, but not yet the filesystem.
    
    Next, use the resize2fs command in this way:
    
    resize2fs /dev/mmcblk0p2
    Bước 1, putty:

    Code:
    curl -O http://spotify-connect-web.s3-website.eu-central-1.amazonaws.com/spotify-connect-web.sh
    Bước 2:

    Edit file /root/spotify-connect-web.sh. Remove hết các "sudo ". (Dùng lệnh: nano /root/spotify-connect-web.sh hoặc edit bằng WinSCP). Kết quả sẽ giống như sau:

    Code:
    #!/bin/bash
    set -e
    
    DIR=~/spotify-connect-web-chroot
    
    if [ "$1" == "install" ]; then
      mkdir -p $DIR
      cd $DIR
      curl http://spotify-connect-web.s3-website.eu-central-1.amazonaws.com/spotify-connect-web.tar.gz | tar xz
    else
      trap "umount $DIR/dev $DIR/proc" EXIT
      mount --bind /dev $DIR/dev
      mount -t proc proc $DIR/proc/
      cp /etc/resolv.conf $DIR/etc/
      chroot $DIR /bin/bash -c "cd /usr/src/app && python main.py $*"
    fi
    Bước 3, putty:

    Code:
    chmod +x spotify-connect-web.sh
    Code:
    ./spotify-connect-web.sh install
    Bước 4, WinSCP:

    Copy file spotify_appkey.key trong file nén bên dưới vào /root/spotify-connect-web-chroot/usr/src/app

    Copy overwrite file console_callbacks.py trong file nén bên dưới vào /root/spotify-connect-web-chroot/usr/src/app

    Bước 5, putty:

    Run test:

    Code:
    /root/spotify-connect-web.sh --name RuneAudio --device 0 --mixer Digital --username abc --password xyz --bitrate 320
    Giá trị của --device và --mixer mình dựa theo alsamixer, như hình bên dưới. User và pass là account thật.

    Khi mình chỉnh volume trong app / web Spotify. Nó kéo theo được volume của Rune!

    [​IMG]

    Nếu OK mình sẽ thấy như sau, thời điểm này Spotify Connect đã hoạt động:

    Code:
    SpInit: 0
    public key: Xwj3zMW9xxxxxxxxxxxxxxxxxxxxxx
    device id: 43a952b7-a8cb-xxxxxxxxxxxxxxxxxxxx
    remote name: RuneAudio
    account req: PREMIUM
    device type: AUDIODONGLE
    kSpConnectionNotifyLoggedIn
    F6hvzT7Hudsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Bước 6: putty:

    Tạo file service:

    Code:
    nano /usr/lib/systemd/system/spotify-connect.service
    Chứa nội dung sau. User và pass là account thật:

    Code:
    [Unit]
    Description=Spotify Connect
    After=network.target
    
    [Service]
    ExecStart=/usr/bin/sh /root/spotify-connect-web.sh --name RuneAudio --device 0 --mixer Digital --username abc --password xyz --bitrate 320
    Restart=always
    RestartSec=10
    StartLimitInterval=30
    StartLimitBurst=20
    
    [Install]
    WantedBy=multi-user.target
    Bước 7, putty:

    Set cho service auto start:

    Code:
    systemctl enable spotify-connect
    Code:
    systemctl start spotify-connect
    Vậy là xong ạ!

    Download file spotify_appkey.key và console_callbacks.py (Đã fix volume):

    http://www.mediafire.com/file/hbe47j1f5wkyj67/spotify_connect_rune_fix_volume.rar

    Source tham khảo:

    https://libraries.io/github/Fornoth/spotify-connect-web

    http://www.runeaudio.com/forum/spotify-connect-autostart-t3315.html

    [​IMG]
     
    Last edited: 7/6/18
    minhnd81, Rndce and chuong46 like this.
  3. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    Phần 2 - moodeaudio. Có 2 cách.

    Cách 1 - Raspotify:

    Cách này chỉnh volume trong app Spotify không kéo được volume alsa của Pi. Nhưng có cái hay là không cần nhập user / pass vào Pi.

    Bước 1:

    Code:
    curl -sL https://dtcooper.github.io/raspotify/install.sh | sh
    Bước 2:

    Code:
    sudo nano /etc/default/raspotify
    Mình chỉ cần edit 3 dòng bên dưới. Kết quả sẽ như sau:

    Code:
    DEVICE_NAME="moOde Player"
    
    BITRATE="320"
    
    VOLUME_ARGS="--linear-volume --initial-volume=100"
    Bước 3:

    Code:
    sudo systemctl start raspotify
    Source tham khảo:

    https://github.com/dtcooper/raspotify

    Cách 2 - Fornoth:

    Cách này tương tự cách của Rune. Có cái hay là đồng bộ được volume của app Spotify và volume alsa của Pi. Cần phải nhập user / pass.

    Bước 1:

    Code:
    sudo su
    
    cd /root
    
    curl -O http://spotify-connect-web.s3-website.eu-central-1.amazonaws.com/spotify-connect-web.sh
    Bước 2:

    Code:
    chmod u+x spotify-connect-web.sh
    Code:
    ./spotify-connect-web.sh install
    Bước 3, WinSCP:

    Copy file spotify_appkey.key trong file nén bên dưới vào /home/root/spotify-connect-web-chroot/usr/src/app

    Copy overwrite file console_callbacks.py trong file nén vào /home/root/spotify-connect-web-chroot/usr/src/app

    Bước 4:

    Test. User và pass là account thật.

    Code:
    ./spotify-connect-web.sh --name moOde --device 0 --mixer Digital --username abc --password xyz --bitrate 320
    Nếu OK mình sẽ thấy như sau, thời điểm này Spotify Connect đã hoạt động:

    Code:
    SpInit: 0
    public key: Xwj3zMW9xxxxxxxxxxxxxxxxxxxxxx
    device id: 43a952b7-a8cb-xxxxxxxxxxxxxxxxxxxx
    remote name: moOde
    account req: PREMIUM
    device type: AUDIODONGLE
    kSpConnectionNotifyLoggedIn
    F6hvzT7Hudsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Bước 5:

    Tạo file service:

    Code:
    sudo nano /lib/systemd/system/spotify-connect.service
    Chứa nội dung sau. User và pass là account thật:

    Code:
    [Unit]
    Description=Spotify Connect
    After=network.target
    [Service]
    ExecStart=/root/spotify-connect-web.sh --name moOde --device 0 --mixer Digital --username abc --password xyz --bitrate 320
    Restart=always
    RestartSec=10
    StartLimitInterval=30
    StartLimitBurst=20
    [Install]
    WantedBy=multi-user.target
    Bước 6:

    Set cho service auto start:

    Code:
    sudo systemctl enable spotify-connect
    Code:
    sudo systemctl start spotify-connect
    Download file spotify_appkey.key và console_callbacks.py (Đã fix volume):

    http://www.mediafire.com/file/hbe47j1f5wkyj67/spotify_connect_rune_fix_volume.rar

    [​IMG]
     
    Last edited: 7/6/18
    Rndce, caigoc and chuong46 like this.
  4. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    Phần 3 - Volumio. Có 2 cách.

    Cách 1 (balbuze):

    Cách này dựa trên plugin có sẵn của Volumio. Mình cần phải update vì Spotify thay đổi API. Cách này không cần user / pass.

    - Disable và remove plugin Volumio Spotify Connect2 trong Volumio

    - Vào http://volumio.local/dev bật SSH.

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

    Code:
    wget https://github.com/balbuze/volumio-plugins/raw/master/plugins/music_service/volspotconnect2/volspotconnect2.zip
    
    mkdir ./volspotconnect2
    
    miniunzip volspotconnect2.zip -d ./volspotconnect2
    
    cd ./volspotconnect2
    
    volumio plugin install
    Sau đó vào giao diện web của Volumio. Trong mục Installed Plugins bật Volumio Spotify Connect2 lên. Bấm vào setting, set volume 100% rồi bấm save.

    Source tham khảo:

    https://github.com/balbuze/volumio-plugins/tree/master/plugins/music_service/volspotconnect2

    [​IMG]

    Cách 2 (Fornoth):

    Đồng bộ được volume của app Spotify và volume alsa của Pi. Cần phải nhập user / pass.

    Bước 1:

    Vào http://volumio.local/dev bật SSH.

    Code:
    sudo nano /etc/ssh/sshd_config
    Edit:

    Code:
    PermitRootLogin no
    Thành ra:

    Code:
    PermitRootLogin yes
    Bước 2:

    Dùng putty login bằng user root / password volumio:

    Code:
    curl -O curl -OL https://github.com/Fornoth/spotify-connect-web/releases/download/0.0.4-alpha/spotify-connect-web.sh
    Code:
    chmod u+x spotify-connect-web.sh
    Code:
    ./spotify-connect-web.sh install
    Bước 3:

    Copy file spotify_appkey.key vào /root/spotify-connect-web-chroot/usr/src/app

    Bước 4:

    Test. User và pass là account thật.

    Code:
    ./spotify-connect-web.sh --playback_device sysdefault:CARD=BossDAC --mixer_device_index 1 --mixer Digital --username abc --password xyz --name Volumio --bitrate 320
    Bước 5:

    Nếu OK. Ta tạo file service:

    Code:
    nano /lib/systemd/system/spotify-connect.service
    Chứa nội dung sau. User và pass là account thật.

    Code:
    [Unit]
    Description=Spotify Connect
    After=network.target
    [Service]
    ExecStart=/root/spotify-connect-web.sh --playback_device sysdefault:CARD=BossDAC --mixer_device_index 1 --mixer Digital --username abc --password xyz --name Volumio --bitrate 320
    Restart=always
    RestartSec=10
    StartLimitInterval=30
    StartLimitBurst=20
    [Install]
    WantedBy=multi-user.target
    Test spotify-connect.service:

    Code:
    systemctl start spotify-connect
    Bước 6:

    Set cho spotify-connect.service chạy khi boot:

    Code:
    systemctl enable spotify-connect
    Vậy là xong ạ!

    @@@ Tùy chọn: Fix cho volume của Spotify app đồng bộ hợp lý hơn với volume Digital của Pi:

    Code:
    sudo nano /root/spotify-connect-web-chroot/usr/src/app/console_callbacks.py
    Sửa đoạn này, gần cuối file:

    Code:
    corected_playback_volume = int(min_volume_range + ((volume / 655.35) * (100 - min_volume_range) / 100))
    Thành ra:

    Code:
    corected_playback_volume = int(50 + (volume / 655.35) / 2 )
    [​IMG]
     
    Last edited: 6/6/18
    chuvanvu, caigoc, SQP and 2 others like this.
  5. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    caigoc likes this.
  6. quanghao

    quanghao Advanced Member

    Joined:
    30/10/06
    Messages:
    7.598
    Likes Received:
    318
    Location:
    Thành Công
    bài viết hay quá! cảm ơn anh đã chia sẻ!

    để em thử xem sao!
     
    tml3nr likes this.
  7. quanghao

    quanghao Advanced Member

    Joined:
    30/10/06
    Messages:
    7.598
    Likes Received:
    318
    Location:
    Thành Công
    Chào anh!

    Em đã thử nghiệm với spotify . Tuy nhiên nó chỉ chạy với i2s mà k chạy được Usb.

    Cảm ơn anh!
    Quanghao
     
    tml3nr likes this.
  8. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    Em mới test lại cái card sound này chạy được với moode 4.1. Rãnh tí em sẽ test với SC output USB ạ.

    [​IMG]
     
  9. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    Em đã test với sound USB.

    Với Raspotify, mình thêm dòng mô tả device trong file /etc/default/raspotify như sau:

    OPTIONS="--device hw:1,0"

    hoặc:

    OPTIONS="--device plughw:1,0"

    Mấy tham số này xà quần trong các lệnh:

    aplay -l

    aplay -L

    PS: hw và plughw đều ra tiếng nhưng cơ chế có khác nhau. Mình nên test xem cái nào OK hơn.

    Nếu DAC native support 16/44.1 mình nên dùng --device hw:1,0 tiếng sẽ hay hơn.

    Nếu DAC không native support 16/44 mình mới phải dùng --device plughw:1,0 để nó resampling về 16/44.1.

    Mình có thể dùng các lệnh test âm thanh như sau để xác định việc này:

    Code:
    aplay -D hw:1,0 16_44.wav
    
    aplay -D hw:1,0 24_96.wav
    
    aplay -D plughw:1,0 16_44.wav
    
    aplay -D plughw:1,0 24_96.wav
    Kết quả từ aplay -l:

    Code:
    **** 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
    Kết quả từ aplay -L:

    Code:
    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
     
    minhnd81 likes this.
  10. hn1804

    hn1804 Advanced Member

    Joined:
    29/2/16
    Messages:
    571
    Likes Received:
    605
    Vụ này em làm vẫn chưa Thông đến bước 3 thì khi chép file
    spotify_appkey.key

    console_callbacks.py

    Trong win SCP. thì nó báo lỗi không chép dc, còn trước đó khi partition thẻ reboot thẻ sẽ mất ip không vào web app dc .
    E583786C-42FB-4EDA-80B7-37F0FC635832.png
     
  11. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    Ý của anh là cài moode và SC Fornoth phải không ạ?

    A1. Muốn dùng WinSCP với quyền root, mình phải khai báo sudo su - trong mục Shell:

    2018-06-24_071123.png
    A2: moode khi extend partition, mình cần phải nhập con số sector đầu tiên của partition 2 vào chổ Partition Start. Con số này mình thấy khi dùng lệnh p sau khi chạy sudo fdisk /dev/mmcblk0

    sudo fdisk /dev/mmcblk0
    Command : d (NOTE: deletes the partition won't delete the content, it's just a partition table update)
    Partition number : default
    Command : n
    Select : default
    Partition number : 2
    Partition start : lấy theo sector đầu tiên của partition 2
    Partition end : default
    Partition #2 contain ext4 signature: yes
    Command : w
    sudo reboot

    Expand the updated partition:

    sudo resize2fs /dev/root
     
  12. hn1804

    hn1804 Advanced Member

    Joined:
    29/2/16
    Messages:
    571
    Likes Received:
    605
    Anh Đến bước test SC khi nhập usename và pass thật vào thì bị như này .
    9919FDA0-134F-461F-94F5-DD27BD0BF10C.png
     
  13. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    Anh chạy lệnh:

    aplay -l



    aplay -L

    Rồi post kết quả lên cho em xem thử.

    Có vẻ như khai báo --device và --mixer của anh chưa đúng.
     
  14. hn1804

    hn1804 Advanced Member

    Joined:
    29/2/16
    Messages:
    571
    Likes Received:
    605
    Đây em
    63A2B61F-60AA-47D1-B452-CC40E926F82F.jpeg
     
  15. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    Bước 1:

    Anh bỏ tham số --mixer Digital ra xem sao ạ?

    Bước 2:

    Anh cho em xem thông tin khi chạy lệnh bên dưới. Để em xem nó có hardware volume hay không:

    amixer -c 0
     
    Last edited: 24/6/18
  16. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    @@@ Lưu ý về tham số mô tả device. Cái này có ảnh hưởng tới âm thanh:

    Ở tất cả các kiểu SC nói trên. Có một điểm chung là dòng lệnh để start SC đều cần phải mô tả device.

    Nếu như DAC support 16/44.1 native. Mình nên dùng các tham số tô màu đỏ tiếng sẽ hay hơn 1 ít.

    Nếu DAC không support 16/44.1 native mình mới phải dùng các tham số tô màu xanh (Nó sẽ up / downsampling).

    Các kiểm tra rất dễ. Chỉ cần dùng lệnh aplay. Play 1 file wav 24/96 và 16/44.1 lần lượt trên các device là thấy liền

    Thí dụ như:

    aplay -D default:CARD=Device 2496.wav

    aplay -D hw:CARD=Device 2496.wav

    aplay -D default:CARD=Device 1644.wav

    aplay -D hw:CARD=Device 1644.wav

    Em lấy thí dụ với kết quả của lệnh aplay -L của sound USB Ugreen:

    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 speake
    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

    Tham số --device trong các trường hợp sau:

    - Fornoth v003 và v004:

    nano /usr/lib/systemd/system/spotify-connect.service

    ./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

    - Raspotify:

    sudo nano /etc/raspotify

    OPTIONS="--device hw:1,0"

    - Balbuze:

    sudo nano /data/plugins/music_service/volspotconnect2/startconnect.sh

    ./librespot -b 320 -c /tmp --name 'Volumio' --backend alsa --device hw:5 --disable-audio-cache --initial-volume 100

    @@@ Cần phải xóa file sau để nó không tự động reset lại default:

    /data/plugins/music_service/volspotconnect2/volspotconnect2.tmpl
     
    Last edited: 24/6/18
  17. luckyluke

    luckyluke Advanced Member

    Joined:
    21/7/09
    Messages:
    75
    Likes Received:
    97
    Location:
    Hà Nội
    Các bác có bị tình trạng Spotify cho moode audio stream nhạc chậm (bài hát trên điện thoại chạy dc mấy chục giây rồi mà loa vẫn chưa phát nhạc) và hay bị mất tiếng ngắt quãng ko, cảm thấy ko được ổn định. Mình cài theo Raspotify
     
    tml3nr likes this.
  18. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    Nghe có vẻ như do đường truyền? Pi anh kết nối vào LAN bằng dây hay wifi ạ?
     
  19. luckyluke

    luckyluke Advanced Member

    Joined:
    21/7/09
    Messages:
    75
    Likes Received:
    97
    Location:
    Hà Nội
    mình dùng p3 b+, trước dùng wifi thấy bị mình cũng tưởng do đường truyền, nhưng thay bằng dây LAN thì vẫn bị, mình vừa remove cài lại spotify cho moode thì vẫn bị delay, tuy rằng ko còn bị ngắt quãng khi phát nhạc nữa. Chắc là moode và spotify chưa tương thích tốt
    PS: có vẻ nó là issue này:
    https://github.com/dtcooper/raspotify/issues/103
     
    Last edited: 24/6/18
    tml3nr likes this.
  20. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    Dạ vậy chắc là do vấn đề tương thích của pi3 B+.

    Anh thử tiếp các bước sau xem có khá hơn không:

    - Nhập user / pass vào file /etc/default/raspotify

    - Chuyển sang dùng SC của Fornoth. Cách này mình có được 3 phiên bản đã pre-built chroot. Em test thì cả 3 chạy OK với moode. Cách setup hoàn toàn như nhau.

    @@@ 3 phiên bản pre-built chroot của Fornoth:

    Bản powerpi.de:

    https://libraries.io/github/Fornoth/spotify-connect-web

    Code:
    curl -O http://spotify-connect-web.s3-website.eu-central-1.amazonaws.com/spotify-connect-web.sh
    Bản v003 và v004:

    https://github.com/Fornoth/spotify-connect-web/releases

    Code:
    curl -OL https://github.com/Fornoth/spotify-connect-web/releases/download/0.0.3-alpha/spotify-connect-web.sh
    Code:
    curl -OL https://github.com/Fornoth/spotify-connect-web/releases/download/0.0.4-alpha/spotify-connect-web.sh
    PS: Còn một bản v002 pre-built chroot nữa do Balbuze làm. Bản này đường dẫn folder làm cho phù hợp với cơ chế install plugin của Volumio. Nhưng mình đưa về theo cách cũ vẫn chạy tốt:

    Trong file này:

    https://github.com/balbuze/volumio-plugins/tree/master/plugins/music_service/volspotconnect

    Code:
    https://github.com/balbuze/volumio-plugins/blob/master/plugins/music_service/volspotconnect/install.sh
    Có mô tả link đến bản v002 đã pre-built chroot:

    Code:
    wget https://github.com/balbuze/volumio-plugins/raw/master/plugins/music_service/volspotconnect/package/Volspotconnectchroot.tar.xz
     
    Last edited: 25/6/18
  21. hn1804

    hn1804 Advanced Member

    Joined:
    29/2/16
    Messages:
    571
    Likes Received:
    605
    cái vụ này chính xác , lúc trước mình chạy tidal với pi 3 sử dụng cả 3 hdh volumio,rune,moode đều không bao giờ bị lắc , nhưng từ khi chạy với pi b+ thì bị lắc khi vào giờ cao điểm ( thường là buổi tối , còn buổi sáng , trưa thì rất hiếm khi). Hình như là pi b+ chưa ổn định cho các hdh volumio, rune , moode .
     
    tml3nr likes this.
  22. luckyluke

    luckyluke Advanced Member

    Joined:
    21/7/09
    Messages:
    75
    Likes Received:
    97
    Location:
    Hà Nội
  23. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    Từ đầu tới giờ em chưa test SC RafaPolit này nên không rõ thế nào.

    Với Pi2, moode 4.1 thì Raspotify và Fornoth chạy ok cả trên i2s và USB.

    Trên Volumio chạy được cả 3 luôn: Balbuze, Fornoth và Raspotify.
     
    Last edited: 25/6/18
  24. luckyluke

    luckyluke Advanced Member

    Joined:
    21/7/09
    Messages:
    75
    Likes Received:
    97
    Location:
    Hà Nội
    trên volumio bản mới ra ngày 21/6 có thể cài plugin Spotify có sẵn mà ko bị lỗi ko, mình chưa thử cài volumio nên ko rõ kết quả ntn
     
    tranchung1993 likes this.
  25. tml3nr

    tml3nr Advanced Member

    Joined:
    30/4/07
    Messages:
    3.082
    Likes Received:
    3.502
    Bản Volumio mới nhất 2.413, Spotify Connect2 chạy tốt ạ.

    [​IMG]
    [​IMG]
     
    Last edited: 25/6/18
Tags:

Share This Page

Loading...