ncmpcpp : ncurses based music player for Linux

tagged under   linux   apps & softwares  


One of my previous post detailed a program called "task warrior" which has made managing my todo list from the console easier. Now, another CLI program called ncmpcpp is satisfying my music needs very well. However, I had a hard time setting it up and getting it to detect any of my music files as the instructions on several forums were outdated. This article will get you up and listening using ncmpcpp in no time. Hope you enjoy using it as much as I do.

Installation

On Ubuntu/Debian

$ sudo apt-get install mpd mpc ncmpcpp

On Arch

$ sudo pacman -S mpd mpc ncmpcpp

mpd stands for music player daemon. It is a daemon(or server) running in the background and managing your music collection. ncmpcpp is a client for mpd.

Configuring Music Player Daemon (mpd)

One of the drawbacks of ncmpcpp is that it is a pain to configure and get it running correctly. However, the following instructions should hopefully make it a walk in the park.

Create the following file and directories for mpd

$ mkdir -p ~/.mpd/playlists
$ touch ~/.mpd/{database,log,mpd.conf,pid,state}

Now, you will need to populate the mpd.conf (mpd configuration file). Most installations of mpd will provide an example mpd configuration file which you can use/modify according to your needs.

On Ubuntu/Debian, the example mpd configuration file (compressed form) can be found at /usr/share/doc/mpd/examples/mpd.conf.gz. You will have to extract the file mpd.conf from mpd.conf.gz.

On Arch, the example configuration file is /usr/share/doc/mpd/mpdconf.example

Copy this example mpd configuration file to ~/.mpd and rename it to mpd.conf (if it is not already so).

# for Ubuntu/Debian
$ cp /usr/share/doc/mpd/examples/mpd.conf.gz ~/.mpd/
$ cd ~/.mpd
$ gunzip mpd.conf.gz

# for Arch
$ cp /usr/share/doc/mpd/mpdconf.example ~/.mpd/mpd.conf

Now, let us edit ~/.mpd/mpd.conf to suit our needs. Some of the most basic mpd configuration options that need to be enabled(uncomment in mpd.conf) are as below.

music_directory         "~/Music"   # path to your Music directory
playlist_directory      "~/.mpd/playlists"
db_file             "~/.mpd/database"
log_file            "~/.mpd/log"
pid_file            "~/.mpd/pid"
state_file          "~/.mpd/state"

audio_output {
    type        "alsa"
    name        "any name for your alsa device"
}

You can change "alsa" in the audio_output above to "pulse", if you are using pulse audio.

You are now done configuring the Music Player Daemon(mpd). You can use mpd to listen to your favorite music from the command line. mpd supports several options to control your music collections (man mpd). If however, you are looking for a ncurses interface via ncmpcpp, read on...

Configuring ncmpcpp

Let us now configure ncmpcpp as a mpd client. Create the following files and folders.

$ mkdir ~/.ncmpcpp
$ touch ~/.ncmpcpp/config

~/.ncmpcpp/config is the ncmpcpp configuration file (the configuration file for the ncurses music player). There are several things that can be configured here that controls the ncmpcpp music player itself, but let's keep it simple.

$ echo 'mpd_music_dir = "~/Music"' > ~/.ncmpcpp/config  # path to mpd music dir

And, that's it... You have successfully configured ncmpcpp to work with mpd.

Now, all that's left is to make mpd autostart on login. For this, you need to edit your distro specific autostart file.

Making mpd autostart on login

On Ubuntu/Debian, create a desktop file in ~/.config/autostart/. Let us name it mpd.desktop. Add the following lines to this file.

[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=Music Player Daemon
Comment=Server for playing audio files
Exec=mpd
StartupNotify=false
Terminal=false
Hidden=false

On ArchBang, edit the file ~/.config/openbox/autostart and append a single line as follows

$ echo "mpd" >> ~/.config/openbox/autostart

That's it!!! The next time you restart your computer, mpd should already be running in the background, and you can launch ncmpcpp from the terminal anytime to listen to your fav music. The first time you launch ncmpcpp, you might not know all the keyboard shortcuts to manage you music collection. You are better of pressing '1' to list all the keyboard shortcuts available. However, the following are some shortcuts you might need frequently, to get you rolling quickly.

q = quit ncmpcpp
u = update music database
1-10 = ncmpcpp screens # help, playlist, browse, search, etc
j,k = move down, move up
enter = add song to playlist and start playing the song
space = add song to playlist
d = delete song from playlist
c = clear entire playlist
s = stop playback
P = pause/continue playback
> = next track in playlist
< = previous track in playlist
f = seek forward currently playing track
b = seek backward currently playing track
+, - = increase/decrease volume
r = repeat entire playlist
y = repeat single track
z = play random song from playlist
# = toggle display of bitrate
/,? = find forward/find backward
, = find previous
. = find next
w = toggle find mode (normal search/wrapped search)
i/I = show song/artist info
L = toggle lyrics database
F = toggle fetching lyrics in the background
l = toggle display of lyrics

« older posts newer posts »



other articles you might like
  • Configuring Lenovo T440s touchpad in Linux
  • Alternatives to Truecrypt on Linux
  • Connecting to wired/wireless networks via command line
  • Android reverse USB tethering
  • Linux command line tools and tricks - Part 3
  • Basic dwm setup in (L)ubuntu
  • Basic Xmonad setup in (L)ubuntu
  • EOM a.k.a End of Mail a.k.a Emacs + offlineimap + mu4e
  • First attempt at developing a Firefox addon
  • Bash script to perform super-fast file transfer using netcat and tar
  • Jekyll : Handling Github page build failure and Jekyll plugins on Github
  • Emacs newbie cheat sheet -- from a vim convert
  • How to create a custom CWM recovery flash-able android apps zip file in Linux via command line
  • Task Warrior - The best CLI task manager for Linux
  • Custom kernel in Ubuntu (also generate .deb package)
  • Linux command line tools and tricks - Part 2
  • Superb Linux command line tools and tricks for Linux geeks
  • ROCKBOX - Breathe a new lease of life into an old mp3 player
  • RSA encryption using Tcl



  • Share this post ⇒  





    blog comments powered by Disqus