Music Player Daemon(MPD) is an efficient, effective and powerful server side music player application for linux distros such as Ubuntu and Mint. It plays audio files, organizes playlists and maintains music database. MPD cannot be accessed directly. There must be a client side application which enables you to access it. For our case we will use ncmpcpp as our client app.

In this tutorial am going to show you how to install and configure mpd with ncmcpp as a client side app to enable you play and enjoy music on your Linux mint 20. So let’s get started.

Before running any installation command always update your servers packages using the below command:

sudo apt-get update

Step 1: Install mpd on Linux Mint 20

Next we will now start install our music server. Enter the command below and press ENTER to begin installation.

sudo apt-get install mpd

Step 2: Configure mpd on Linux Mint 20

At this point mpd has been installed on your machine. It is time to set up a configuration file for proper functioning. We are going to create directories to be used by mpd. Create the default directory and a playlist directory.

mkdir -p ~/.mpd/playlists/

Create a configuration file mpd.conf inside ~/.mpd directory.

vim ~/.mpd/mpd.conf

Add the below content. Remember the configuration can be modified to your liking.

bind_to_address "127.0.0.1" 
#bind_to_address "~/.mpd/socket" 
music_directory "~/Music" 
playlist_directory "~/.mpd/playlists" 
db_file      "~/.mpd/mpd.db"   
log_file      "~/.mpd/mpd.log" 
pid_file      "~/.mpd/mpd.pid"  
state_file     "~/.mpd/mpdstate"   
audio_output {   

    type  "pulse" 
    name  "pulse audio" 
    device         "pulse" 
    mixer_type      "hardware"  
} 

audio_output { 
   type                    "fifo" 
   name                    "my_fifo" 
   path                    "/tmp/mpd.fifo" 
   format                  "44100:16:2" 
}

If you prefer to use alsa instead of pulse audio then the first audio_output parameters would look like below:

audio_output { 
       type            "alsa" 
       name            "Alsa for audio sound card" 
       mixer_type      "software"      # optional 
}

Now add mpd username to login and audio groups

sudo gpasswd -a mpd <your login group> 
chmod 710 ~/ 
sudo gpasswd -a mpd audio

Check if the configuration is valid by starting mpd as root user and check if listening on port 6600

$ mpd
$ ss -tunelp | grep 6600

For autostart, mpd.service systemd unit is found on /usr/lib/systemd/system/mpd.service.

Step 3: Install and Configure ncmpcpp on Linux Mint 20

This application will serve as CLI for playing music from mpd server. Type the command below in terminal and run to begin your installation.

sudo apt-get update
sudo apt-get install ncmpcpp

Lets now run configuration file to match settings with ones in mpd server. Create the following directory in the home directory by entering the following command in your terminal.

mkdir ~/.ncmpcpp

Change to the created directory

cd ~/.ncmpcpp

Create ncmpcpp configuration file as below:

vim config

Add the below content

# Files
 mpd_music_dir = "~/Music"  
 lyrics_directory  = ~/.ncmpcpp/lyrics
 ncmpcpp_directory  = ~/.ncmpcpp
 mpd_host = "localhost"
 mpd_port = "6600"  
 mpd_connection_timeout = "5"  
 mpd_crossfade_time = "5"  

 # Playlist
 playlist_disable_highlight_delay = "0"
 playlist_display_mode = "columns"  
 playlist_show_remaining_time = "yes"
 browser_display_mode = "columns"  
 autocenter_mode = "yes"  
 fancy_scrolling = "yes"  
 follow_now_playing_lyrics = "yes"  
 display_screens_numbers_on_start = "yes"  
 ignore_leading_the = "yes"  
 lyrics_database = "1"  
 song_columns_list_format = "(10)[blue]{l} (30)[green]{a} (30)[magenta]{b} (50)[yellow]{t}"  
 colors_enabled = "yes"  
 main_window_color = "white"
 main_window_highlight_color =  "blue"
 header_window_color = "cyan"  
 volume_color = "red"  
 progressbar_color = "cyan"  
 statusbar_color = "white"  
 active_column_color = "cyan"  
 active_window_border = "blue"
 alternative_header_first_line_format = "$0$aqqu$/a {$7%a - $9}{$5%t$9}|{$8%f$9} $0$atqq$/a$9"
 alternative_header_second_line_format = "{{$6%b$9}{ [$6%y$9]}}|{%D}"
 song_list_format = "{$3%n │ $9}{$7%a - $9}{$5%t$9}|{$8%f$9}$R{$6 │ %b$9}{$3 │ %l$9}"
 user_interface = "alternative"
 default_place_to_search_in = "database"

# visualizer
visualizer_fifo_path = "/tmp/mpd.fifo"
visualizer_output_name = "my_fifo"
visualizer_sync_interval = "12"
#visualizer_type = "wave" (spectrum/wave)
visualizer_type = "spectrum" (spectrum/wave)
visualizer_in_stereo = "yes"
visualizer_look = "+|"  

## Navigation ##
cyclic_scrolling = "yes"
header_text_scrolling = "yes"
jump_to_now_playing_song_at_start = "yes"
lines_scrolled = "2"

## Other ##
system_encoding = "utf-8"
regular_expressions = "extended"

## Selected tracks ##
selected_item_prefix = "* "
discard_colors_if_item_is_selected = "no"

## Seeking ##
incremental_seeking = "yes"
seek_time = "1"

## Visivility ##
header_visibility = "yes"
statusbar_visibility = "yes"
titles_visibility = "yes"
progressbar_look =  "=>-"
progressbar_boldness = "yes"
progressbar_elapsed_color = "white"

now_playing_prefix = "> "
song_status_format = " $2%a $4⟫$3⟫ $8%t $4⟫$3⟫ $5%b "
autocenter_mode = "yes"
centered_cursor = "yes"

# Misc
display_bitrate = "yes"
# enable_window_title = "no"
follow_now_playing_lyrics = "yes"
ignore_leading_the = "yes"
empty_tag_marker = ""

Restart mpd server

sudo systemctl restart mpd

Now start ncmpcpp in terminal by typing ncmpcpp.

$ ncmpcpp

The player should open and loads music present in the music directory as below:

Use F3 or 3 to browse your music. Use U to update your database. For help press F1 for more options. You can exit the application by pressing letter q.

Shortcuts list:

     Down j   : Move Cursor down  
     Page Up   : Page up  
     Page Down  : Page down  
     Home    : Home  
     End     : End  
     Tab     : Switch between playlist and browser  
     1 F1    : Help screen  
     2 F2    : Playlist screen  
     3 F3    : Browse screen  
     4 F4    : Search engine  
     5 F5    : Media library  
     6 F6    : Playlist editor  
     7 F7    : Tag editor  
     0 F10    : Clock screen  
   Keys - Global  
  -----------------------------------------  
     s      : Stop  
     P      : Pause  
     >      : Next track  
     <      : Previous track  
     f      : Seek forward  
     b      : Seek backward  
     Left -   : Decrease volume  
     Right +   : Increase volume  
     t      : Toggle space mode (select/add)  
     T      : Toggle add mode  
     |      : Toggle mouse support  
     v      : Reverse selection  
     V      : Deselect all items  
     A      : Add selected items to playlist/m3u file  
     r      : Toggle repeat mode  
     Z      : Shuffle playlist  
     i      : Show song's info  
     I      : Show artist's info  
     L      : Toggle lyrics database  
     l      : Show/hide song's lyrics  
     q Q     : Quit  

+ - Increase volume 2%
- - Decrease volume 2%
# - Display bitrate of file
= - Clock
F1 - Help

z - random mode [-z----]
y - single mode [--s---] (Repeats the current track after reaching the end.)
R - consume mode [---c--] (Removes the current track from playlist after reaching the end.)
x - crossfade mode [----x-]
u - Database update

Enjoy your music!! More informative Linux Guides below:

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

nine + 13 =