Introduction
My previous post described the steps to set-up an RPi to use a bluetooth speaker and initial setup of an MPD music server to play music from the RPi through the bluetooth speaker.
This post deals with configuration to make the setup more useable.
Multi-room capability
Pure Jongos have a capability called caskeid which allows a set of them to play the same music. The Pure Connect app, which runs on IoS or Android allows you in settings to specify which Jongo devices will use caskeid to work together. They use wifi to pass music to each other so they need to be on the same wifi network. When you attach to one Jongo using bluetooth the sound is streamed to the others using wifi and they play in sync. Pure connect is also used to set the relative volume of each device. In my setup JON is the Jongo near the RPi and distributes music to the other devices.
Bluetooth Connection
A bluetooth connection from PI3 to a Jongo device is key to making the system work. Unfortunately in the past bluetooth has been a real pain on RPi. I used the PI3 which has integral bluetooth and made sure that software and drivers were up to date. As noted in the previous blog I used the RPi GUI for initial testing. I have tried to list the key points for a happy bluetooth experience.
Initial device connection
Make sure the device you are using is paired and trusted - this only needs to be done once.
You can check device status with info <device addr>.
Other bluetooth tech can steal/hog a device so make sure that phones/ipads/headphones have wifi switched off when near the jongo to be setup.
The jongo should be showing solid orange meaning it is ready to connect.
The jongo should be showing solid orange meaning it is ready to connect.
Make sure that pulseaudio is started before connecting.
bluetoothctl connect command should now work and after flashing green the jongo should show a solid green light.
You can use mpg123 or mpd/mpc to play some music. If no sound comes out the jongo connect a speaker to RPi audio jack and see if the sounds are coming out there instead. If so it is a pulseaudio problem, use pactl commands to check whether pulseaudio can see the bluetooth sink.
If mpd appears not to be working, use mpc playlist command to see whether anything is waiting to play.
Device Reconnection
After a few minutes without playing bluetooth automatically disconnects and the jongo light reverts to orange. Running the bluetooth connect command again should reinstate the connection. If playing a readio-station the bluetooth connection can stay active for many hours.
MultiRoom sound
Other jongos don't always sync as you would hope. Sometimes they are bit slow so it is worth waiting a couple of minutes before investigating.
Make sure that they show an amber or green-flashing light before running the connection command. If the device is showing solid green it is connected to something else.
Make sure that they show an amber or green-flashing light before running the connection command. If the device is showing solid green it is connected to something else.
If the device is showing red it has an error. In either of these two cases power off / on the jongo.
RPi Startup
When RPi is started up bluetooth, pulseaudio and mpd should all be working.
You need to mount the rpip share with /home/pi/scripts/rpipmount
You need to start the ympd web server with /home/pi/scripts/ympd.sh
You need to start the ympd web server with /home/pi/scripts/ympd.sh
MPD Clients
MPC is very useful for checking what is happening on the server and is the best trouble-shooting tool but it is not convenient for managing playlists. I want to control the server from a variety of devices so all of the clients below are useful. MPD communicates with clients on port 6600 so it is only necessary to configure a client for IP:port to establish communication.
ncmpcpp (linux command)
This is an ncurses program which does a good job of using text screens to control mpd. It is much more convenient for browsing folders and controlling playlists.
Auremo (Windows)
A very nice, easy to use client which allows streams to be setup.
MPDluxe (iPad)
The app costs £2.99 and is the only MPD client for the iPad since the demise of mPod.
It works well and includes the ability to switch repeat/consume etc on/off
It works well and includes the ability to switch repeat/consume etc on/off
M.A.L.P and MPDroid (Android)
M.A.L.P. only allows selection of songs or albums so is a bit limited.
MPDroid is better and allows playlists or streams to be selected.
ympd (Chrome on Windows, iPad, Android)
ympd is a very nice little python application which runs on the RPi with a small webserver on port 6800 (my choice) and its own connection to MPD on port 6600. It shows what is playing and allows MPD to be controlled well.
Clearly it helps avoid the need to install other apps.
Streaming
mpd can also stream music directly to a device although it doesn't really fit in with the multi-room sound. MPD allows you to send output to multiple devices so you can enable streaming on port 8000 in /etc/mpd.conf. You can then go to a browser and enter //PI3:8000 which will play the music for you. Note that it is not synchronised with bluetooth outputs so it cannot be played at the same time as others.Music
NAS (samba/cifs)
As mentioned in the previous post most music is stored on my home NAS, usually known as RPIP. In general music is stored as //rpip/rpipmusic/<artist>/<album>/<song>.mp3 or //rpip/rpipmusic/<artist+album>/<song>.mp3.
The NAS has a mount point /var/lib/mpd/music/rpipmusic so all albums are easily found with the mpd structure.
Web (http)
MPD accepts urls as valid filenames so anything which is stored on a webserver can be played. For example rpip webserver is at /var/www/html/music/<artist>..... and music can be played as http://rpip.helliwell.org:8024/music/<artist>......
Playlists
MPD only allows playlists with suffix .m3u but it isn't very choosy what goes in them. Terminology is somewhat confusing. The playlist is the list of songs that mpc is currently playing or waiting to play. A set of songs can be saved in a playlist file which can then be loaded and played together. It is easy to use Auremo or MPDluxe to put an the tracks in an album on the playlist and then save them as a playlist file with the album name. The names of tracks can be local files, remote NAS files or web urls.
Radio
Most radio stations are now available for internet streaming. A url for a radio stream can be downloaded to Windows from radiofeeds.co.uk. This can then be stored as a single entry in a playlist file and played by mpd. For example capital_radio.m3u contains the line
http://media-sov.musicradio.com:80/CapitalMP3
When this playlist is loaded or run from a client the station starts playing. In most cases clients are able to display what track is playing and update it as the song changes.
Rplay
rpip hosts my Rplay application which saves music streams and cuts out the adverts.
As files are stored in //rpip/var/www/html/music/Radiostream they are available to MPD.
However I will change this.