{"id":39,"date":"2013-03-07T21:09:00","date_gmt":"2013-03-07T21:09:00","guid":{"rendered":"https:\/\/www.root42.de\/blog\/?p=39"},"modified":"2013-03-07T21:09:00","modified_gmt":"2013-03-07T21:09:00","slug":"how-to-turn-the-raspberry-pi-into-a-music-server","status":"publish","type":"post","link":"https:\/\/www.root42.de\/blog\/?p=39","title":{"rendered":"How to turn the Raspberry Pi into a music server"},"content":{"rendered":"<p>I have set up my <a href=\"http:\/\/www.raspberrypi.org\/\">Raspberry Pi<\/a> as a music and file server. My requirements were:<\/p>\n<ul><a href=\"http:\/\/2.bp.blogspot.com\/-oBje8F8eIzs\/UTkB2guab7I\/AAAAAAAADAM\/4UHT8P9KftU\/s1600\/IMG_3165.jpeg\" style=\"clear: right; float: right; margin-bottom: 1em; margin-left: 1em;\"><img loading=\"lazy\" border=\"0\" src=\"http:\/\/2.bp.blogspot.com\/-oBje8F8eIzs\/UTkB2guab7I\/AAAAAAAADAM\/4UHT8P9KftU\/s320\/IMG_3165.jpeg\" height=\"320\" width=\"240\" \/><\/a><\/p>\n<li>Big local storage (HD), shared over WiFi<\/li>\n<li>Local music playing capability, remotely controllable<\/li>\n<li>AirPlay speaker capability<\/li>\n<\/ul>\n<div>The means by which I fulfilled the requirements were:<\/div>\n<div>\n<ul>\n<li>Platinum 1TB MyDrive and Edimax EW-7711UTn USB wireless adapter<\/li>\n<li>mpd Music Player Daemon<\/li>\n<li>shairport AirPort emulator<\/li>\n<\/ul>\n<\/div>\n<div>For the first part, I bought a WiFi adapter, the Edimax EW-7711UTn. This one works out of the box with Raspbian, using WPA encryption (Note: <a href=\"http:\/\/root42.blogspot.com\/2013\/04\/the-raspberry-pi-and-ralink-rt2800.html\">I switched to a RTL8188<\/a> based dongle by now). It identifies itself with <span style=\"font-family: Courier New, Courier, monospace;\">lsusb<\/span> as:<\/div>\n<div><\/div>\n<div>\n<div><span style=\"font-family: Courier New, Courier, monospace;\">Bus 001 Device 004: ID 7392:7711 Edimax Technology Co., Ltd EW-7711UTn nLite Wireless Adapter [Ralink RT2870]<\/span><\/div>\n<\/div>\n<div><\/div>\n<div>This can be easily configured using the wpa_gui tool that comes with the default Raspbian installation. Settings will be saved and restored upon reboot.<\/div>\n<div><\/div>\n<div>Second, I installed <span style=\"font-family: Courier New, Courier, monospace;\">samba<\/span>, <span style=\"font-family: Courier New, Courier, monospace;\">samba-common<\/span> and <span style=\"font-family: Courier New, Courier, monospace;\">samba-common-bin<\/span> for sharing my USB drive. The latter one is a Platinum MyDrive, which is attached to a powered Belkin 7-port USB hub, so that I only need two power supplies. One for the Raspberry Py, and one for the Hub and its attached devices. The MyDrive has been formatted with NTFS, so as to be easily mountable under Linux, OS X and Windows. I mount it using the standard \/etc\/fstab mechanism. Just added one line to the file:<\/div>\n<div><\/div>\n<div>\n<div><span style=\"font-family: Courier New, Courier, monospace;\">\/dev\/sda1 &nbsp; &nbsp; &nbsp; \/media\/MyDrive &nbsp;ntfs-3g defaults &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; 0<\/span><\/div>\n<\/div>\n<div><\/div>\n<div>The \/etc\/samba\/smb.conf gets in its first iteration only one additional share, a write-for-all public share, as a big file dump:&nbsp;<\/div>\n<div><\/div>\n<div>\n<div><span style=\"font-family: Courier New, Courier, monospace;\">[BigDump]<\/span><\/div>\n<div><span style=\"font-family: Courier New, Courier, monospace;\">&nbsp; &nbsp; comment = Free for all<\/span><\/div>\n<div><span style=\"font-family: Courier New, Courier, monospace;\">&nbsp; &nbsp; read only = no<\/span><\/div>\n<div><span style=\"font-family: Courier New, Courier, monospace;\">&nbsp; &nbsp; path = \/media\/MyDrive\/FreeForAll<\/span><\/div>\n<div><span style=\"font-family: Courier New, Courier, monospace;\">&nbsp; &nbsp; guest ok = yes<\/span><\/div>\n<\/div>\n<div><\/div>\n<div>Note that literally everybody in your LAN can access this and write to it! You may want to fine tune this&#8230;<\/div>\n<div><\/div>\n<div>Now to the <a href=\"http:\/\/mpd.wikia.com\/\">mpd<\/a>. It is easily installed by doing <span style=\"font-family: Courier New, Courier, monospace;\">apt-get install mpd<\/span>. When configuring it via \/etc\/mpd.conf make sure to change the following lines:<\/div>\n<div><\/div>\n<div>\n<div><span style=\"font-family: Courier New, Courier, monospace;\">music_directory &nbsp; &nbsp; &nbsp; &nbsp; &#8220;\/media\/MyDrive\/Music\/&#8221;<\/span><\/div>\n<\/div>\n<div><span style=\"font-family: Courier New, Courier, monospace;\">password &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8220;MyVeryOwnPassword@<\/span><span style=\"font-family: 'Courier New', Courier, monospace;\">read,add,control,admin&#8221;<\/span><br \/><span style=\"font-family: 'Courier New', Courier, monospace;\">bind_to_address &nbsp; &nbsp; &nbsp; &nbsp; &#8220;any&#8221;<\/span><\/p>\n<div><\/div>\n<\/div>\n<div>Change the directory and password to your liking. Then restart the service or reboot you device. You can control the mpd using a magnitude of clients. For example <a href=\"https:\/\/github.com\/TheStalwart\/Theremin\">Theremin<\/a> for OS X or <a href=\"http:\/\/www.katoemba.net\/makesnosenseatall\/mpod\/\">Mpod<\/a> for iOS.<\/div>\n<div><\/div>\n<div>Finally, I would like to be able to use the RasPi as an AirPlay target for my Mac and my iOS devices. This can be done via <a href=\"https:\/\/github.com\/albertz\/shairport\">shairport<\/a>. There are already a lot of <a href=\"http:\/\/trouch.com\/2012\/08\/03\/airpi-airplay-audio-with-raspberry\/\">good howtos<\/a> for shairport on the Raspberry Pi. So I refer you to one of those. Two things come to my mind, though:<\/div>\n<div>\n<ol>\n<li>The Net::SDP library, required by shairport, is not available on Raspbian by default. It is best to clone the <a href=\"https:\/\/github.com\/njh\/perl-net-sdp\">github mirror<\/a>, and go by its installation instructions. Installation via CPAN fails, plus CPAN needs huge amounts of RAM.<\/li>\n<li>The configuration needs to be tweaked a bit. The \/etc\/init.d\/shairport script should be tuned to a sensible name for your RasPi.&nbsp;<\/li>\n<\/ol>\n<div>This way, you will be able to see the RasPi in your AirPlay speakers list and it will be happily churning along.<\/div>\n<\/div>\n<p><\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"http:\/\/3.bp.blogspot.com\/-Ucoe-K3uQYw\/UTkB1CXTDnI\/AAAAAAAADAE\/Hb9vSuvEoKk\/s1600\/IMG_3171.jpeg\" style=\"margin-left: 1em; margin-right: 1em;\"><img loading=\"lazy\" border=\"0\" src=\"http:\/\/3.bp.blogspot.com\/-Ucoe-K3uQYw\/UTkB1CXTDnI\/AAAAAAAADAE\/Hb9vSuvEoKk\/s320\/IMG_3171.jpeg\" height=\"320\" width=\"213\" \/><\/a><\/div>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I have set up my Raspberry Pi as a music and file server. My requirements were: Big local storage (HD), shared over WiFi Local music playing capability, remotely controllable AirPlay speaker capability The means by which I fulfilled the requirements were: Platinum 1TB MyDrive and Edimax EW-7711UTn USB wireless adapter mpd Music Player Daemon shairport &hellip; <a href=\"https:\/\/www.root42.de\/blog\/?p=39\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to turn the Raspberry Pi into a music server&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2,31,24,3,10],"tags":[],"_links":{"self":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/39"}],"collection":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=39"}],"version-history":[{"count":0,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/39\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=39"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=39"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=39"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}