Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Thread Tools Display Modes
  #1   (View Single Post)  
Old 30th December 2013
shep shep is offline
Rc.conf Instructor
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,083
Default Music Player Daemon (MPD) OpenBSD Howto

Music Player Daemon (MPD) OpenBSD Howto

MPD /audio/mpd is one of the lightest, most responsive methods to access mp3, ogg files and internet streams. Installation entails 2 components; the daemon and one of a number of front ends. On an older i386, playback of locally stored mp3's or internet music streams uses less than 2% of the cpu.

In OpenBSD, the /audio/mpd port has two flavors, the basic port and a flavor that enables the tremor integer decorder. The tremor option enhances performance on *ogg files at the expense of network streaming.

There are multiple front ends that function as traditional clients to the music player daemon. Clients can be command line, console, embedded, or GTK+, Qt or Java based gui's. Plugin interfaces ranging from a Firefox extension, desktop specific controllers and emacs are available. The clients also can control some aspects of the daemon.

In OpenBSD, configuration is easy, just edit /etc/mpd.conf to delineate where your music is stored.
music_directory                 "/home/user/music"
The port maintainers have set defaults for local users with the libao (sndio) backend. For Gnome3 users, libao will work in parallel with pulseaudio or /etc/mpd.conf can be edited to change mpd output from libao to pulseaudio.

The music files and the chain of directories all need to be executable. In OpenBSD, the executable directory chain is there by default when using /home/user/music. On initial startup and after any additions to the music folder, an update command will need to be run. Once the music directory is in place and configured in /etc/mpd.conf, add mpd to collection of package script daemons to be started in /etc/rc.conf.local. For example:
pkg_scripts="messagebus avahi_daemon mpd"
Note that mpd does not require the messagebus or avahi_daemon to function.

Either reboot or run
/etc/rc.d/mpd -f start
as su/root to start the daemon.

I'll mention two mpd clients; audio/ncmpc and audio/sonata.

Ncmpc can be run in the console or in a terminal. With the setup described above you should see that it is connected to the localhost. Ctrl-U will start a music database update. The F1 key will show the help file, F2 the playlist and F3 will let you browse the music folder.
Internet music streams can be added in the F2 playlist panel with the 'a' key. The 'S' key will save the music stream url where it can be found in the F3 panel. Two of my favorite stream sources are:
WNCW, an NPR station out of North Carolina
Radio Paradise which is a commercial free station out of California. Ncmpc also supports lyrics but at the expense of increase bandwidth and cpu cycles.

If the station you wish to stream is a *m3u link, the mp3 stream will be embedded with the *m3u file. For example, the WNCW web page provides this web page link
Download the link to your local directory view the contents

$ less 128K.m3u provides

#extinf:99999,88.7 WNCW
Some example menu entries:
For those using xterm:
xterm -g 54x18 +sb -T "NcMpc Music" -e ncmpc
Alternative terminals that support changing title bar icons, such as /x11/rxvt-unicode can use
urxvt -g 54x18 +sb -icon /usr/local/share/pixmaps/music.png -T "NcMpc Music" -e ncmpc
after copying an icon to the file path specified. Those running a desktop environment that supports freedestop menu entries can use the following entry in /usr/local/share/applications/ncmpd.desktop
[Desktop Entry]
Comment=MPD Front end
Exec=xterm -g 54x18 +sb -T "NcMpc Music" -e ncmpc
An example music.png icon and a screenshot of ncmpc running in rxvt-unicode:
Name:  music.png
Views: 2154
Size:  1.5 KB

Name:  ncmpc.png
Views: 2170
Size:  30.4 KB

Sonata, /audio/sonata, provides the same functionality with a mouse pointer interface and a system tray icon. Internet streams are added and stored under the 'streams' tab. Album art is available in addition to lyrics for those with bandwidth and cpu cycles to burn.

Edit: 5) dbus_daemon renamed to messagebus

Last edited by shep; 23rd July 2017 at 04:53 PM. Reason: 1) Update RadioParadise to more robust server 2) Dealing with m3u links 3) Clarify pkg_scripts damons 4) Corrected WNCW link
Reply With Quote
  #2   (View Single Post)  
Old 20th October 2015
shep shep is offline
Rc.conf Instructor
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,083

This is an update/placeholder for OpenBSD release 5.8.

In OpenBSD 5.8 release, the version of audio/mpd has several errors:

flac encoder: fix crash with 32 bit playback
(upstream git commit 4e3d1821895c92d060fc3a9059e83ac58c8c79a3)

tag/ApeLoader: fix buffer overflow after unterminated key
(upstream git commit 205fba74cffffb9df985cdf928101633ffc41772)

ffmpeg decoder: avoid a double free error while decoding a stream
A patch has been committed and M:tier has provided updated i386 and amd64 binaries.

Last edited by shep; 25th October 2015 at 12:59 AM. Reason: Notification of 5.8 Release Fix/M:tier binary
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenBSD : Ripping and writing music CDs with cdio(1) J65nko Guides 5 30th November 2011 08:33 PM
New to OpenBSD: problem with music, raid? barum87 OpenBSD General 3 24th June 2010 04:04 AM
Howto Compile in OpenBSD 4.5 shep OpenBSD Packages and Ports 2 7th May 2009 11:25 PM
I'm looking for a music text based music player that can play .m4p and .m4a formats cssgalactic FreeBSD Ports and Packages 4 14th July 2008 04:16 AM
whats playing on your music player? ephemera Off-Topic 22 10th June 2008 06:57 PM

All times are GMT. The time now is 04:10 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick