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

tml3nr

Moderator
.... mạng lag post trùng. Nhờ các anh mod xóa dùm ạ. Em xin cảm ơn nhiều!
 

do_long_khach

Well-Known Member
@tml3nr cho hỏi giờ tôi lắp riêng 1 con Pi cài Moode làm Openhome Tidal Server cũng ok đúng ko? Nhạc phát sang bộ Pi hiẹn có?

Cuối cùng nhớ ra BubbleUpnp Server cũng có Openhome, cài vào pc chứa nhạc, vậy là xong
 
Chỉnh sửa lần cuối:

tml3nr

Moderator
Nhờ anh tây dynobot chỉ đường. Em mò ra được thêm một cách tạo SC rất đơn giản. Âm thanh theo em là hay nhất trong tất cả các loại SC từ trước đến giờ. Đồng bộ được với volume của alsa.

Em chỉ mới test trên Rune. Chắc là sẽ OK trên các OS khác.

Bước 1:

https://github.com/Spotifyd/spotifyd/releases/

Download file spotifyd-2019-xx-xx-armv6.zip. Extract file spotifyd vào /usr/bin. Rồi set:

chmod +x /usr/bin/spotifyd

Bước 2 - Tạo file config:

nano /etc/spotifyd.conf

Mã:
[global]
username = your_account
password = your_password
backend = alsa
device = xxx # Given by `aplay -L`
mixer = xxx
volume-control = alsa # or alsa_linear, or softvol
#onevent = command_run_on_playback_event
device_name = RuneAudio
bitrate = 320
#cache_path = /tmp/spotifyd
volume-normalisation = false
#normalisation-pregain = -10

Ghi chú:

device = xxx # Lấy theo device của alsa. Thí dụ: hw:0
mixer = xxx # Lấy theo PCM, hay Digital của alsa
device_name = Tùy chọn. Không được có khoảng trắng.

Bước 3 - Tạo file service:

- Rune:

nano /usr/lib/systemd/system/spotifyd.service

- moode / volumio:

nano /lib/systemd/system/spotifyd.service

Mã:
[Unit]
Description=A spotify playing daemon
Documentation=https://github.com/Spotifyd/spotifyd
Wants=sound.target
After=sound.target
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/bin/spotifyd --no-daemon
Restart=always
RestartSec=12

[Install]
WantedBy=default.target

Bước 4:

Mã:
systemctl start spotifyd

Mã:
systemctl enable spotifyd

Xem thông tin hoạt động của Spotifyd:

Mã:
systemctl status spotifyd

Ghi chú: Trước khi edit ta cần phải stop service:

Mã:
systemctl stop spotifyd

Vậy là xong ạ!

More information:

https://github.com/Spotifyd/spotifyd/wiki/Installing-on-a-Raspberry-Pi
 
Chỉnh sửa lần cuối:

vominhchi

Well-Known Member
upload_2019-4-23_19-17-59.png
upload_2019-4-23_19-17-59.png
 

tml3nr

Moderator
- Anh nhớ chạy systemctl stop spotifyd trước khi edit spotifyd.conf. Và stop trước mỗi lần start.

- Anh xem trong file /etc/mpd.conf chổ device "xx:y,y" nó ghi cái gì ạ?

Anh có thể chạy lệnh sau để nó xuất log ra file cho mình dễ xem:

systemctl status -l spotifyd > /home/root/spotifyd.log

Của em khi chạy OK nó như vầy:

@@@ File spotifyd.conf:

Mã:
[global]
username = xxx
password = xxx
backend = alsa
device = hw:0 # Given by `aplay -L`
mixer = Digital
volume-control = alsa # or alsa_linear, or softvol
#onevent = command_run_on_playback_event
device_name = RuneAudio
bitrate = 320
#cache_path = /tmp/spotifyd
volume-normalisation = false
#normalisation-pregain = -10

@@@ file mpd.conf:

Mã:
audio_output {
   name      "BossDAC"
   type      "alsa"
   device      "hw:0,0"

Mã:
root@runeaudio(rw):~# systemctl status -l spotifyd
● spotifyd.service - A spotify playing daemon
   Loaded: loaded (/usr/lib/systemd/system/spotifyd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-04-22 20:19:32 ICT; 2min 3s ago
     Docs: https://github.com/Spotifyd/spotifyd
Main PID: 4691 (spotifyd)
    Tasks: 3 (limit: 512)
   CGroup: /system.slice/spotifyd.service
           └─4691 /usr/bin/spotifyd --no-daemon

Apr 22 20:19:32 runeaudio systemd[1]: Started A spotify playing daemon.
Apr 22 20:19:32 runeaudio spotifyd[4691]: 20:19:32 [INFO] Using alsa volume controller.
Apr 22 20:19:32 runeaudio spotifyd[4691]: 20:19:32 [WARN] Failed to register IPv6 receiver: Os { code: 97, kind: Other, message: "Address family not supported by protocol" }
Apr 22 20:19:32 runeaudio spotifyd[4691]: 20:19:32 [INFO] Connecting to AP "gae2-accesspoint-a-26lh.ap.spotify.com:443"
Apr 22 20:19:33 runeaudio spotifyd[4691]: 20:19:33 [INFO] Authenticated as "xxxxxxx" !
Apr 22 20:19:33 runeaudio spotifyd[4691]: 20:19:33 [INFO] Using alsa sink
Apr 22 20:19:33 runeaudio spotifyd[4691]: 20:19:33 [INFO] Country: "VN"
 
Chỉnh sửa lần cuối:

tml3nr

Moderator
Bác @tml3nr cho hỏi cách Extract file spotifyd vào /usr/bin với
Có 2 cách ạ:

1. Down về PC giải nén ra file spotifyd. Rồi dùng WinSCP chép vào /usr/bin. Em thích cách này hơn vì nó dễ thao tác hơn là dùng lệnh

2. Dùng lệnh:

wget https://github.com/Spotifyd/spotifyd/releases/download/v0.2.5/spotifyd-2019-02-25-armv6.zip

Rồi sau đó dùng unzip để extract ra /usr/bin. Trên rune không có cài sẵn unzip nên em không test được o_O

Anh dùng WinSCP cho dễ :rolleyes:
 

Thangbandia69

New Member
Tiện thể cho em hỏi luôn là digione thì:
device = xxx # Given by `aplay -L`
mixer = xxx

thì đặt như thế nào cho đúng
 

tml3nr

Moderator
Tiện thể cho em hỏi luôn là digione thì:
device = xxx # Given by `aplay -L`
mixer = xxx

thì đặt như thế nào cho đúng
1. device = xxx

Theo em thì nên lấy theo device trong /etc/mpd.conf

2. mixer = xxx

Anh chạy lệnh aplay -L xem nó ra gì ạ?

Digione không có harware volume. Nên chắc là mình sẽ bỏ tham số đó bằng cách thêm dấu # vào phía trước:

#mixer = xxx
 
Chỉnh sửa lần cuối:

Thangbandia69

New Member
Aplay -L nó ra nhw này anh:
default:CARD=sndallodigione
snd_allo_digione,
Default Audio Device
sysdefault:CARD=sndallodigione
snd_allo_digione,
Default Audio Device
dmix:CARD=sndallodigione,DEV=0
snd_allo_digione,
Direct sample mixing device
dsnoop:CARD=sndallodigione,DEV=0
snd_allo_digione,
Direct sample snooping device
hw:CARD=sndallodigione,DEV=0
snd_allo_digione,
Direct hardware device without any conversions
plughw:CARD=sndallodigione,DEV=0
snd_allo_digione,
Hardware device with all software conversions

CÓ phải là chọn dòng nay: hw:CARD=sndallodigione,DEV=0 đúng không anh.
 

tml3nr

Moderator
Aplay -L nó ra nhw này anh:
default:CARD=sndallodigione
snd_allo_digione,
Default Audio Device
sysdefault:CARD=sndallodigione
snd_allo_digione,
Default Audio Device
dmix:CARD=sndallodigione,DEV=0
snd_allo_digione,
Direct sample mixing device
dsnoop:CARD=sndallodigione,DEV=0
snd_allo_digione,
Direct sample snooping device
hw:CARD=sndallodigione,DEV=0
snd_allo_digione,
Direct hardware device without any conversions
plughw:CARD=sndallodigione,DEV=0
snd_allo_digione,
Hardware device with all software conversions

CÓ phải là chọn dòng nay: hw:CARD=sndallodigione,DEV=0 đúng không anh.
Anh xem mục device trong mpd.conf. Nếu nó là hw:0,0 thì trong spotifyd.conf sẽ là hw:0

Hôm qua em cũng xà quần cả buổi chổ này :confused:
 
Bên trên