Setting up mpd + ncmpcpp + others on Windows & OSX

Recently I had been playing around with MPD (Music Player Daemon) on my two separate box (Windows + OSX) and they both work wonderfully. I am very impressed with how lightweight mpd is. In case if you are wondering, the entire concept of mpd is based on server and client architecture. So you can be assured that there is a bunch of flexibility. Imagine that all the music is controlled by mpd and you can use any client as the frontend for communicating with mpd. I, for one, had adopted ncmpcpp as my front end. The best part of mpd is that you can stream it into multiple outputs, including http stream thanks to the httpd output!

Here is the basic flow on how mpd and mpd client works:
  1. 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.
  2. 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 mpd

1) 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 mpd

1) 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.

music_directory "c:/music"
* 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.

playlist_directory "c:/mpd/playlists"
* The playlist that you created via mpd client will be saved here.

db_file "c:/mpd/db"
* This will store your music database. You can view it using any text editor as it is stored in plain text.

log_file "c:/mpd/log"
* The log file that keep the events logged.

pid_file "c:/mpd/pid"

state_file "c:/mpd/state"

sticker_file "c:/mpd/sticker"

Optional

3) 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.

port "6666"

Step 3 - Configuring audio output

1) 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:
audio_output {
  type "winmm"
  name "Speakers"
  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.
}

Optional

2) 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.


audio_output {
    type        "httpd"
    name        "My HTTP Stream"
    encoder        "vorbis"        # optional, vorbis or lame
    port        "8000"
    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
    format        "44100:16:1"
    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:

audio_output {
    type        "pulse"
    name        "My Pulse Output"
#    server        "remote_server"        # optional
#    sink        "remote_server_sink"    # optional
}


Save the file.

Step 3 - Running mpd.exe

1) Now open up the command prompt and launch the mpd!

cd c:\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:

mpd mpd.conf

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 ncmpcpp

1) 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.

mkdir ~/.ncmpcpp
cp /opt/local/share/doc/ncmpcpp ~/.ncmpcpp

4) Go to ~/.ncmpcpp and open it with your text editor.

nano ~/.ncmpcpp/config

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.

6) Save.

Step 2 - Running ncmpcpp

1) To run ncmpcpp, simply type ncmpcpp into your terminal.

ncmpcpp




Optional

Part 3 - Installing mpc

1) Just like ncmpcpp, mpc is available on Mac Ports as well.

sudo port install mpc

2) Run it by typing mpc into the terminal.

mpc


Part 4 - HTTP Streaming

1) 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 mpd

There 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


Reference

MPD Wikia

6 comments

Great tutorial! Thanks a lot

Reply

Thank you for share!
I installed the server as you show so I could use MPDroid in my mobile to play sounds. I try to use winamp but it does not work.

Reply

When running mpd.exe with the conf file, it says the database didn't exist, so i made an empty one, but now it says its corrupted.
i can't use "mpd update" because i cant specify the file, and "mpd mpd.conf update" won't work because it has "to many arguments"

Reply

Surprised the windows mpd server worked the first time I tried it. Thanks for the guide!

Reply

Hiv disease for the last 3 years and had pain hard to eat and cough are nightmares,especially the first year At this stage, the immune system is severely weakened, and the risk of contracting opportunistic infections is much greater. However, not everyone with HIV will go on to develop AIDS. The earlier you receive treatment, the better your outcome will be.I started taking ARV to avoid early death but I had faith in God that i would be healed someday.As a Hiv patent we are advise to be taking antiretroviral treatments to reduce our chance of transmitting the virus to others , few weeks ago i came on search on the internet if i could get any information on Hiv treatment with herbal medicine, on my search i saw a testimony of someone who has been healed from Hiv her name was Achima Abelard and other Herpes Virus patent Tasha Moore also giving testimony about this same man,Called Dr Itua Herbal Center.I was moved by the testimony and i contacted him by his Email.drituaherbalcenter@gmail.com We chatted and he send me a bottle of herbal medicine I drank it as he instructed me to.After drinking it he ask me to go for a test that how i ended my suffering life of Hiv patent,I'm cured and free of Arv Pills.I'm forever grateful to him Drituaherbalcenter.Here his contact Number +2348149277967...He assure me he can cure the following disease..Hiv,Cancer,Herpes Virus,Epilepsy, fibromyalgia ,ALS,Hepatitis,Copd,Parkinson disease.Diabetes,Fibroid...

Reply

Why is my Canon printer not printing color correctly?

If your Canon IP110 printer is not printing colors correctly, it may be due to several possible causes. It is important to check that you are using the right type of ink cartridge in your printer. Make sure to use only original Canon cartridges and avoid using third-party compatible cartridges, as they may contain ink that is not properly mixed or not compatible with the printer. Also, check the cartridge levels by checking the printer is not running low on ink. Check the color settings in the printer settings to better understand and fix the issue, why is my Canon printer not printing color correctly. If the settings are incorrect, colors may appear distorted or inaccurate. It is best to adjust the color settings to match the type of document or image you are printing.

How to enable Java on Chrome?

If you need to enable Java in Chrome, it’s a relatively simple process. First, open the Chrome browser and click on the three vertical dots in the top right corner. From the drop-down menu, select Settings. Scroll down to the bottom of the page and click Advanced. In the Privacy and security section, click Content Settings. Select Java from the list of available options. Once Java is enabled, you will see a warning message letting you know your changes will take effect when you reload the page. Click Reload to confirm. Java will now be enabled in Chrome. You can check this by clicking on any Java webpage applets to ensure they work as expected. This is how to enable Java on Chrome.

Is Facebook Profile Lock Available in USA?

Yes definitely, Facebook profile lock available in USA. If you have query about it then open Facebook app on your Android device. On home page, click on profile picture. Choose on three dots menu. Select the lock profile options from the available options on the page. Here, choose lock your profile option at the end of the page on lock profile page. Lastly, you will be successful locking your Facebook profile.

Why would a video won't post to Facebook?

There are several reasons why video won't post to Facebook. These reasons may include having too large of a file size, a slow internet connection, or issues with the video format itself. When it comes to file size, Facebook has a limit of 4GB for videos that are uploaded from a phone. If you're trying to upload a video that is larger than 4GB, then it's likely that your video won't upload to Facebook. If you're experiencing an issue with the internet connection, then this could also be causing your video won't post to Facebook. A slow connection can prevent your video from successfully uploading to the platform.

Why is HP printer color not printing correctly?

There can be several reasons your HP printer color not printing correctly after refilling the ink. Firstly, you should check if the ink level is low. If it is, you will need to refill the ink cartridge or replace it altogether. You should also check if the printhead needs to be cleaned. A clogged printhead can cause issues with printing, so you may need to clean it with a damp cloth or cotton swab. Lastly, you may need to update your printer software. This could be necessary if any new features are available that will improve the performance of your printer. It is also possible that there could be a problem with the printer driver, so updating it could help fix the issue.

Reply

Post a Comment

If you found this article or post helpful to you, feel free to enter your comments below ;)