tutorials and ruby scripts

Read my tutorials


Tutorial: streaming

Music Player Daemon (mpd) for Linux allows remote access to music files and managing playlists and of course streaming (via http) of the music too.

Patchfork is a PHP (Pear) script that is able to control mpd.

1. Install mpd

apt-get install mpd lame

2. Configure mpd

nano /etc/mpd.conf

Paths and rights

music_directory         "/var/lib/mpd/music" #or where ever you store the music
playlist_directory      "/var/lib/mpd/playlists"
db_file                 "/var/lib/mpd/tag_cache"

bind_to_address         "localhost" #only the php script should control the server
port                    "6600"
auto_update             "yes" #search for new music - e.g. for streamripper users

password                        "[email protected],add,control,admin" #password = test
default_permissions             "" # so no rights for empty password

Audio setup for http streaming using vorbis or lame:

audio_output {
	type  "httpd"
	name  "my music"
	encoder  "vorbis"  # or lame
	port  "8080"
	#quality  "5.0"   # do not define if bitrate is defined
	bitrate  "128"   # do not define if quality is defined
	format  "44100:16:1" # 44100:16:2 for lame
	max_clients "2"   # optional 0=no limit

decoder {
        plugin "ffmpeg"
        enabled "no"

You can define a shoutcast server for output too. But I do prefer the build in http streaming server (and lame).

And restart mpd:

service mpd restart

3. Install patchfork

Ensure that you have php5 installed - and php-pear too:

apt-get install php-pear

Get patchfork

cd /var/www
git clone http://git.joshuawise.com/git/patchfork.git
chmod 775 config

4. Start patchfork

Add the config to find the local mpd server:


The status info should switch to green:


5. Setup a frame (or what you want)

nano /var/www/radio.html



So you do not have to open another window to listen to the music.

And for the shoutcast lovers: Patchfork does have a shoutcast integration too.

Looking forward to other “stream my music” setups.