Setting up mpd locally
Music Player Daemon (MPD) allows remote access for playing music (MP3, Ogg Vorbis, FLAC, AAC, Mod, and wave files) and managing playlists. MPD is designed for integrating a computer into a stereo system that provides control for music playback over a local network. It also makes a great desktop music player, especially if you are a console junkie, like frontend options, or restart X often.
This “how-to” will only handle on installing mpd for desktop use.
The “how-to” for playing over the network is coming later.
This is written for Ubuntu 8.04.
Open up a terminal and copy/paste this:
sudo apt-get install mpd mpc
Open up your file browser and make a new folder in your home directory called “.mpd”.
Don’t forget the point before mpd.
In that folder create a new folder called “playlists”.
Then make the following files in the .mpd folder:
mpd.db
mpd.log
mpd.error
Then again in a terminal:
sudo gedit /etc/mpd.conf
Change the first relevant block of text so it looks like this:
port “6600”
music_directory ~/Music
playlist_directory ~/.mpd/playlists
db_file ~/.mpd/mpd.db
log_file ~/.mpd/mpd.log
error_file ~/.mpd/mpd.error
pid_file /var/run/mpd/pid
Then look for this line
user “mpd”
Change mpd with your username.
Then in a terminal:
mpd –create-db
mpc update
mpc add /
mpc play
Note: it’s mpd – -create-db without the space between the two -.
Mpc is the command line music player for mpd.
How do you use Music Player Command?
mpc <command> [command args]…
mpc Displays status
mpc add <file> Add a song to the current playlist
mpc crop Remove all but the currently playing song
mpc del <position> Remove a song from the current playlist
mpc play [<position>] Start playing at <position> (default: 1)
mpc next Play the next song in the current playlist
mpc prev Play the previous song in the current playlist
mpc pause Pauses the currently playing song
mpc toggle Toggles Play/Pause, plays if stopped
mpc stop Stop the currently playing playlists
mpc seek [+-][HH:MM:SS]|<0-100>% Seeks to the specified position
mpc clear Clear the current playlist
mpc outputs Show the current outputs
mpc enable <output #> Enable a output
mpc disable <output #> Disable a output
mpc shuffle Shuffle the current playlist
mpc move <from> <to> Move song in playlist
mpc playlist Print the current playlist
mpc listall [<file>] List all songs in the music dir
mpc ls [<directory>] List the contents of <directory>
mpc lsplaylists Lists currently available playlists
mpc load <file> Load <file> as a playlist
mpc save <file> Saves a playlist as <file>
mpc rm <file> Removes a playlist
mpc volume [+-]<num> Sets volume to <num> or adjusts by [+-]<num>
mpc repeat <on|off> Toggle repeat mode, or specify state
mpc random <on|off> Toggle random mode, or specify state
mpc search <type> <query> Search for a song
mpc crossfade [<seconds>] Set and display crossfade settings
mpc update [<path>] Scans music directory for updates
mpc stats Displays statistics about MPD
mpc version Reports version of MPD
If you want a nice gui for mpd, I suggest using sonata.
sudo apt-get install sonata
Stop the mpd deamon by running
sudo mpd –kill
(that’s – -kill)
Get more info about mpd
man mpd
This is totally unrelated to MPD but it is related to Linux.
You should really try something other than Ubuntu because it seems from your posts that Ubuntu is what you use. Ubuntu is great for beginners but it doesn’t really teach you a lot how the system works. I would suggest trying Arch, I ahve just started using it and It was the fastest Linux Distro I’ve worked with and I’ve worked with quite a few (Slackware (12.0 & 12.1) Ubuntu (Gutsy/Hardy) Debian (Lenny, Sidux and Sid) Gentoo (2007 and 2008) OpenSUSE (10.3) Fedora and probaly a few more that I cannot remember at this time)
Although, What I like about linux distro’s might be a little different from what you like,
Here’s What I like:
Speed
Customizability
Decent Package Management
Decent Install Time
Gnome
Arch fits all of those categories (Customizability is both System and Desktop Enviroment)
I’ve tried some other distro’s. But in the end I kept coming back to Ubuntu, for different reasons.
I have two computers in my home.
My laptop, that’s running plain old Ubuntu 8.04.1 with compiz fusion. It’s running good and stable.
And on my more powerfull desktop, I’m running Ubuntu, tweaked to perfection running fluxbox as WM.
So I’ve got all the things you mentioned.
—
That being said, Arch is a great distro. I’ve tried it out a few times and like it.
I was thinking about switching to it, but I didn’t because I’m pretty active in the ubuntu forums and this ubuntu based website.
After installing mpd, I had an error saying that, in a nutshell, it couldn’t connect to pulseaudio. I had to add these extra lines to /etc/mpd.conf:
audio_output {
type “pulse”
name “My MPD PulseAudio Output”
server “localhost” # optional
sink “alsa_output” # optional
}
I hope this will help people that encounter the same problem.
Following this guide, I had to do some extra things to make mpd work with my pulseaudio setup. I got an error in the log file saying it had problems opening the audio device while playing a song (Yup, the famous pulseaudio problem). I hope this will help those that encountered the same problem.
Add the following lines to /etc/mpd.conf:
audio_output {
type “pulse”
name “My MPD PulseAudio Output”
}
Afterwards install paprefs:
sudo aptitude install paprefs
Run it:
paprefs
Make sure these two options are enabled:
* Enable network access to local sound devices
* Don’t require authentication
You don’t have to check the latter one, but then you’ll have to set a password for accessing mpd (which I ended up doing anyways).
Now restart mpd:
sudo /etc/init.d/mpd restart
I had to do some extra things to make mpd work with my pulseaudio setup. I got an error in the log file saying it had problems opening the audio device while playing a song (Yup, the famous pulseaudio problem). I hope this will help those that encountered the same problem.
Add the following lines to /etc/mpd.conf:
audio_output {
type “pulse”
name “My MPD PulseAudio Output”
}
Afterwards install paprefs:
sudo aptitude install paprefs
Run it:
paprefs
Make sure these two options are enabled:
* Enable network access to local sound devices
* Don’t require authentication
You don’t have to check the latter one, but then you’ll have to set a password for accessing mpd (which I ended up doing anyways).
Now restart mpd:
sudo /etc/init.d/mpd restart
I’m sorry, I should have mentioned I use ALSA instead of PulseAudio.
I didn’t like the idea of just making my PulseAudio instance accept everything from everywhere, but I still managed to get MPD working seamlessly with PulseAudio under Ubuntu Intrepid, by using a system-wide instance. The steps I took can be found at: http://www.alanbriolat.co.uk/2009/03/mpd-pulseaudio-ubuntu-intrepid-810/
I like the helpful info you provide in your articles.
I will bookmark your blog and check again here frequently.
I’m quite certain I will learn a lot of new stuff right here!
Good luck for the next!
I loved as much as you’ll receive carried out right here.
The sketch is attractive, your authored material stylish.
nonetheless, you command get bought an edginess over that you wish be delivering the following.
unwell unquestionably come further formerly again since exactly the same nearly very often inside case you shield this increase.
I’d like to find out more? I’d like to find
out more details.