I'm trying to create a raspberry pi which streams spotify music to a bluetooth speaker. I have a raspberry pi zero w with the latest version of raspbian stretch lite. I have my bluetooth connection and my raspotify set up. The only thing i can't figure out is how to redirect the output of raspotify to the bluetooth speaker. Is there a way to tell the pi to redirect all the audio to a bluetooth speaker?
1 Answers
You will want to pair your bluetooth speaker to the raspberry pi. I dont know if this is possible for all bluetooth speakers; from a quick google it does look possible.
Next you will want to find what hardware device that the bluetooth speaker is set to, so that we can tell raspotify to use this device. Do this by running
aplay -l
and you'll get something that looks like
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 7/8
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
Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
Then you will take whatever number device is the bluetooth speaker, and put that in the raspotify settings file
sudo nano /etc/default/raspotify
then adding the below line to your settings with correct hw number - ('hw:0,1' which I believe means card 0, device 1. obviously put the x,x that is the same as your bluetooth speaker)
OPTIONS="--device hw:0,1"
save this file and restart your raspotify service
sudo systemctl restart raspotify
If you're lucky everything should work, if not then even the raspotify file tells you ymmv for changing the hw device and you may need to figure out an alternate plan to use this speaker.
Good luck, hopefully this helps
- 11
- 1