Ubuntu / Linux news and application reviews.

A lot of people are praising MPD (Music Player Daemon) + Sonata so an article on this was probably expected.

But what is MPD and what is Sonata?

Music Player Daemon (MPD) is a flexible, powerful, server-side application for playing music. Through plugins and libraries it can play a variety of sound files while being controlled by its network protocol.

Sonata is a GTK+ music client for the Music Player Daemon (MPD).

Basically, Sonata is a GUI for MPD. I don't mind having a CLI tool for listening to music, but MPD never really seemed like the perfect chioce for me (for a CLI music player, I prefer CMus). But the MPD + Sonata combination is another deal. Try it and you will surely love it!

Sonata features:

- Expanded and collapsed views
- Automatic remote and local album art
- Library browsing by folders, or by genre/artist/album
- User-configurable columns
- Automatic fetching of lyrics
- Playlist and stream support
- Support for editing song tags
- Drag and drop to copy files
- Popup notification
- Library and playlist searching, filter as you type
- Audioscrobbler (last.fm) 1.2 support
- Multiple MPD profiles
- Keyboard friendly
- Support for multimedia keys
- Commandline control
- Available in 24 languages

Sonata screenshots:

mpd sonata linuxsonata mpdsonata

Installing MPD + Sonata

Firstly, you need to install MPD which should be available in your Linux distribution repositories.

For Ubuntu:
sudo apt-get install mpd mpc

Sonata should also be available in your distro repositories. For Ubuntu, if you want the latest version, you can downloaded the Debian version which works just fine (I've tested it in Ubuntu 9.10 Karmic Koala)

For getting the latest version for your Linux distribution, see Sonata download page.

Ubuntu: if you want to use the version available in the repo:
sudo apt-get install sonata

If you want to edit tags, also install:
sudo apt-get install python-tagpy libtaglib2.0-cil

Configuring Sonata + MPD

To configure MPD for your user, see HERE. The steps below will configure MPD for system-wide use.

For me, it didn't work right out of the box but it should just take a few seconds for configuring Sonata + MPD.

Update: To add you music to the MPD database you can simply run the following command (where "YOUR_MUSIC_FOLDER" is the exact path to your music folder):
sudo ln -s YOUR_MUSIC_FOLDER /var/lib/mpd/music/

Alternatively you could enter directly the path to your music folder in the MPD config file but there are some strange permisison errors reported by the users when doing this. Anywhow, to do this, press Alt + F2 and paste (for Gnome, if you use KDE, replace gedit with kate, etc):
gksu gedit /etc/mpd.conf

And on line 8, you should see "music_directory". Next to it, enter the path to your music folder. Basically, this is how it should look:
music_directory "/home/Muzica"

If you have more than 1 music folder, you have to create symbolic links to the other music folders, in your main music folder. This can be easily done in Gnome / Nautilus: right click a folder, select "Create link" and copy the newly created link to your main music folder.

Replacing /path/to/music with the path to your music folder (which you've set in the mpd.conf file also). Alternatively, you can also comment out the "user" and "group" lines in the mpd.conf file (Press Alt + F2, enter this: gksu gedit /etc/mpd.conf, search for "user" and put a "#" in front of it and then do the same for the "group" line) - this solves some permission errors.

After you have completed all this, save the file and run this in a terminal:
sudo mpd --create-db 

To create your music database. Leave MPD to finish adding all your songs.

NOTE: the sudo mpd --createdb command doesn't work with the latest MPD (available through a PPA for Ubuntu). Instead, after installing Sonata, go to the Library tav, right click and Update database or use:
sudo /etc/init.d/mpd start-create-db
mpc update

If your sound doesn't work, set mpd to use Pulseaudio:
gksu gedit /etc/mpd.conf

And paste this at the end of the file:
audio_output {
type "pulse"
name "mpd-pulse"

Just one last thing for getting MPD + Sonata to work with pulseaudio: press Alt + F2, type:
gedit /etc/pulse/default.pa

And paste this at the end of the file:
load-module module-native-protocol-tcp auth-anonymous=1

Now you need to restart your system and then finally, you can start Sonata from Applications > Sound and Video.

If Sonata cannot connect, try running MPD first (in a terminal, type: sudo mpd).

More about MPD and Pulseaidio.

Update: you might also want to take a look at the latest Gnome Music Player Client (GMPC), another amazing client for MPD.