Playing music without any user interface

Honestly, my goal is not to get rid of any user interface. But my home automation system has a very small screen, which would not allow to display much information. That’s why I need something able to play my music without watching at any screen.

The obvious choice for someone who knows many music players on Linux is MPD (Music Player Daemon). This tool is a daemon running in the background and playing whatever we want it to play. Perfect for my needs. But it needs a client to tell it which tracks to play. There are many clients which are able to control a MPD server (on computers, phones, tablets…) but I don’t see « power up a computer and tell the mediacenter to play some files » as an option.

The perfect solution here is Autoplay! This program, which runs continuously too, automatically adds random tracks to the playlist when it is nearly empty. If you skip a track, it remembers that you don’t like it and lowers its « score ». And if you want to listen to a specific track or album, you just have to connect to MPD with any client and queue them…

Next, there should be a way to control the music playing… That will be the object of a new Hejmo resource!

So, how should I do?

First, install MPD:

$ sudo apt-get install mpd

Then configure it in the /etc/mpd.conf file; important settings are:

  • _musicdirectory: where the audio files are stored
  • _bind_toaddress: on which addresses to listen (localhost for local clients only, to allow remote control over the networ)
  • password: if MPD listens on a network interface other than localhost, setting a password is highly recommended
  • _mixertype: to set the volume control type within MPD ( »disabled » is preferred in a home automation system, where sound control is in another system)
  • _audiooutput: you may need to change the audio output, for example if you are using PulseAudio instead of Alsa (the default)

MPD can now be (re)started…

$ sudo /etc/init.d/mpd restart

Once MPD is running, it is time to install Autoplay.

After downloading it (see the « Downloads » link on its webpage), install it with the following commands:

$ sudo apt-get install python-mpd
$ tar zxf codl-autoplay-stable-*.tar.gz
$ cd codl-autoplay-*
$ sudo ./

The installation procedure asks if you want to run autoplay right now. You should answer no and update the autoplay database:

$ autoplay -u

Autoplay can now be started…

$ sudo /etc/init.d/autoplay start
comments powered by Disqus