Radio bathroom

bethroom_by_tahra

In order to learn capoeira songs, I planned to listen to them when I take my shower. And I would the system to be as simple as possible : just one click.

Speaker

First of all, buy a bluetooth speaker. I bought this one : http://fr.jbl.com/enceintes-portables/JBL+GO.html

Cheap, nice, light, quite long autonomy. Do the job.

Next step : make it connect automatically to a computer, so that sound will be player trough it.

Of course I took a Linux. As I have a Raspberry Pi always on, why not use it ?

Here come the trickiest part : make the BT speaker connect or be connected as soon as it’s on. Solution is here : https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=107144

To summerize :

Now, as soon as the speaker is powered on, it will be recognized and connected.

Next step: make sound through it.

Sound

I use Alsa, as I don’t want to install PulseAudio, which requires more configuration:

Now, my default sound output is my BT Speakers.

Next: let’s play!

Let’s play

I use MPD. MPD automatically plays when launched, continuing where it stops. I can give him parameters when it’s on (random, playlist, …) and they will be kept.

I just have to tell him to play through Alsa.

One more thing…

Ok, now power on the speaker, feed mpd with the music you want, play it. Ok, I got sound.

BUT if I switch the speaker off, mpd become crazy and switch the speaker back on doesn’t make it recover its sanity: it doesn’t play anymore.

Maybe should I use an other player, maybe should I look to dbus to see if mpd (or whatever) can react to dbus events, maybe should I use Pulseaudio, but I choosed to make a little shell script.

Run it as root whith

And you are on : power on the speaker, and music will come after few seconds. Power it off, mpd will stop.

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. Apprenez comment les données de vos commentaires sont utilisées.