Here is the basic flow on how mpd and mpd client works:
- mpd runs on the server (local) with the server ip and using the default port 6600. By default it will listen and accept for any connection that attempts to communicate with that port.
- On the remote client, a mpd client such as ncmpcpp is run to communicate with mpd. ncmpcpp is essentially a front-end that present a graphical user interface in the terminal. Any actions (such as creating playlist, playing song, stopping song, searching song, etc.) is sent to mpd via commands. By using ncmpcpp, this routine is simplified as ncmpcpp will automatically create the command for you. If you were to use mpc, you will have to type command such as mpc play to play a song.
Just a setting example of mine. I have mpd running on my Window 7 box and my OSX box running ncmpcpp to control mpd.
Part 1 - Setting up MPD on Windows
Step 1 - Installing mpd1) Let get the balls rolling by installing mpd on Windows. Download the file mpd-0.16.8-win32.zip at Sourceforge here.
2) Extract it to a convenient path, such as "C:\mpd". This path is used for the config file.
Step 2 - Setting up the file path and basic attribute for mpd1) You should see a config file with the name "mpdconf.example". Copy and paste it under the same folder, name it as "mpd.conf".
2) Open it (mpd.conf) up with your favorite text editor (mine is Notepad++) and change the following lines according to your setup. I am using the path c:/mpd. This will take care of the file that is used by mpd.
NOTE: Make sure you use the forward slash '/' instead of '\' when inserting the path.
* This is your music directory. It is possible to include multiple music directory, but it is only achievable by using symlink. I'm not sure how to achieve it with Windows.
* The playlist that you created via mpd client will be saved here.
* This will store your music database. You can view it using any text editor as it is stored in plain text.
* The log file that keep the events logged.
Optional3) You can change the default port on which mpd is running (6600). Do this by uncommenting the port line and change the number to a number other than 6600.
Step 3 - Configuring audio output1) Don't close that text editor just yet. In case if you are wondering, we haven't configure the audio output yet. Go to the Audio Output section (by searching for the term 'audio output'), it is at the mid section.
Copy and paste the following code:
device "Speakers (Realtek High Definition Audio)" # You might need to change this if you are using another type of sound card. I am using the built-in soundcard of Asus Sabertooth x58. You can check this by right clicking at the Volume icon at your taskbar, and select Playback devices.
Optional2) Uncomment the following code if you plan to output the stream via http. By doing so you can open any media player such as VLC or iTunes to playback the stream.
name "My HTTP Stream"
encoder "vorbis" # optional, vorbis or lame
bind_to_address "0.0.0.0" # optional, IPv4 or IPv6
#quality "5.0" # do not define if bitrate is defined
bitrate "128" # do not define if quality is defined
max_clients "0" # optional 0=no limit
NOTE: If you are behind a firewall, make sure you allow port 8000 (the default port).
3) If you are using PulseAudio server, uncomment the following lines:
name "My Pulse Output"
# server "remote_server" # optional
# sink "remote_server_sink" # optional
Save the file.
Step 3 - Running mpd.exe1) Now open up the command prompt and launch the mpd!
You will need to supply a parameter for the config file to mpd.exe. Since we placed it under the same folder as mpd.exe, we simply enter:
2) Just leave the window running and you should see a process name mpd.exe spawn under the Processes in your Windows Task Manager.
Part 2 - Installing ncmpcpp on OSX
Step 1 - Installing and configuring ncmpcpp1) If you are using any port such as Mac Ports, you can simply install ncmpcpp by entering the following line into the terminal:
sudo port install ncmpcpp
2) By default, the binary is located at /opt/local/bin/ncmpcpp.
3) Go to /opt/local/share/doc/ncmpcpp and copy the config file into a folder called .ncmpcpp under your home directory.
cp /opt/local/share/doc/ncmpcpp ~/.ncmpcpp
4) Go to ~/.ncmpcpp and open it with your text editor.
5) Uncomment the line mpd_host and change it into the IP address of the host running mpd.
mpd_host = "192.168.1.100"
Change the mpd_port if you configure your mpd to run on a different port other than the default 6600.
Step 2 - Running ncmpcpp1) To run ncmpcpp, simply type ncmpcpp into your terminal.
Part 3 - Installing mpc1) Just like ncmpcpp, mpc is available on Mac Ports as well.
sudo port install mpc
2) Run it by typing mpc into the terminal.
Part 4 - HTTP Streaming1) Since we had already setup our mpd for http streaming output, just open any of your favorite music player such as VLC and open the network stream.
Cmd + N > http://192.168.1.100:8000
Troubleshooting mpdThere are some commands that you can sent to mpd to probe its status such as:
# Checking the list of output that mpd is currently using
mpc -h [server ip] -outputs