I spend a lot of time listening to the radio or to my music, and I used to use Radio Tray
for streaming radio off the
internet but it kept dropping the connection and wasn’t very satisfactory. And then I heard about MPD
and started
reading about it and learning how I can use it for myself. So here we go.
MPD, or to give it its proper name 'Music Player Daemon', is a very versatile programme that can play your local music collection, your podcasts, your old time radio comedy classics, and also stream internet radio over the web into your home and ultimately your ears!
Installation
But first we need to install it, so using apt-get write in a terminal
sudo apt-get install mpd mpc ncmpcpp sonata ario xfmpc
When these are installed you will have the actual music programme, the server or back-end of mpd, and several clients or front-ends which are the interface for you to play your music or streaming radio.
Configuration
Now, lets get mpd configured for you to use. Open a terminal and enter
the following
mkdir ~/.mpd
and mkdir ~/.mpd/playlists
This should create two directories, .mpd which will hold all the
config files and set-up files, and in that directory another one called
.mpd/playlists which will hold all your playlists and the urls of your
streaming radio.
Then open in your favourite text editor, I like leafpad, but choose
your own,
leafpad /etc/mpd.conf
then SaveAs
to your .mpd directory.
Close your text editor and then open up the new saved version into your text editor again, and we then start editing it to fit our own configuration. These are the commands you need to edit and change, and substituting your $USER name where necessary -
music_directory "/home/$USER/Music"
playlist_directory "/home/$USER/.mpd/playlists"
db_file "/home/$USER/.mpd/tag_cache"
log_file "/home/$USER/.mpd/mpd.log"
pid_file "/home/$USER/.mpd/pid"
state_file "/home/$USER/.mpd/state"
sticker_file "/home/$USER/.mpd/sticker.sql"
# General music daemon options
################################################
bind_to_address "localhost" # some people say this should be commented out, but I've always find it works better as shown.
save_absolute_paths_in_playlists "yes"
auto_update "yes"
# Audio Output
################################################################
audio_output {
type "alsa"
name "My ALSA Device"
device "hw:1,0"
# mixer_type "software"
# mixer_device "default"
# mixer_control "PCM"
}
NB - this may need some tweaking for your own individual soundcard situation. This is what works on my computer.
Next to get it able to run as you, the user. Enter leafpad /etc/default/mpd
START_MPD=true
MPDCONF=/home/foo/.mpd/mpd.conf
Then enter in a root terminal, service mpd restart
which should show -
service mpd restart
[ ok ] Stopping Music Player Daemon: mpd
[ ok ] Starting Music Player Daemon: mpd
Now you need to check in 'top' or 'atop' to see who the user of the daemon mpd is. It should show it as $USER, but if not, then you may have to reboot for it to start as you, the user. If this is the case, when you get your desktop back again, enter 'mpd' in a terminal and it should start as $USER. Then enter 'ncmpcpp' which is a mpd ncurses player and a very good player too, I run mine in a 'xterm' terminal, where the text shows up very well against a black background.
If you want a graphical frontend to mpd then navigate to your 'menu > Sound & Video > sonata/ario/xfmpc' which are three graphical frontends that we installed earlier.
If 'mpd' is still owned by root, open a terminal and enter
sudo service mpd stop
and it should show in top/atop as being owned by $USER.
I've changed my mpd.conf and recovered the ability to control the volume from within 'ncmpcpp'. Here’s the relevant section;-
audio_output {
type "alsa"
name "MPD ALSA"
mixer_type "software"
mixer_device "default"
mixer_control "PCM"
}
More about 'ncmpcpp later in a follow-up.
Comments
comments powered by Disqus