Music and Raspberry Pi Server : MPD and rap.star279

Warning : This article has been automatically translated by Google Translate



Pour ceux qui stockeront leur musique sur le disque, ça peut être sympa de temps en temps de pouvoir la diffuser vers la sortie audio du Raspberry Pi. C’est ce que nous allons voir aujourd’hui en installant le daemon MPD et une interface web associée : rompr

Raspberry Pi Home Server - Etape 13 : serveur de musique avec MPD et rompr

Dans un premier temps, il faut installer MPD puis le client rompr.

  1. Installer MPD et MPC
     apt-get install mpc mpd
  2. Configurer le fichier /etc/mpd.conf
    1. Changer le répertoire de stockage de la musique music_directory
    2. Décommenter la ligne mixer_type “software”
  3. S’assurer que le user mpd a les droits de lecture sur le répertoire de musique défini dans le répertoire music_directory
  4. Relancer le service MPD
    service mpd restart
  5. Mettre à jour la base de donnée de MPD
    mpc -h localhost update
  6. Télécharger l’archive rompr ici (le lien pointe vers la version 0.16.3)
  7. La décompresser dans le répertoire /var/www
  8. Changer les droits sur le nouveau répertoire
    chown -R www-data:www-data /var/www/rompr
  9. Modifier le fichier /var/www/rompr/getalbumcover.php à la ligne 35 avec la ligne suivante
    system($convert_path, $a);
  10. Installer le package imagemagick pour le téléchargement les illustrations des albums
    apt-get install imagemagick
  11. Créer un fichier /etc/nginx/sites-available/rompr
    server {
    
     listen 8093; # A vous de choisir !
    
     root /var/www/rompr;
    
     index index.php;
    
     server_name rompr;
    
     error_log /var/log/nginx/rompr_error.log;
    
     access_log /var/log/nginx/rompr_access.log;
    
    location ~ .php$ {
    
     include /etc/nginx/fastcgi_params;
    
     try_files $uri =404;
    
     fastcgi_index index.php;
    
     fastcgi_split_path_info ^(.+.php)(/.+)$;
    
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    
     fastcgi_pass unix:/var/run/php5-fpm.sock;
    
     }
    
    }
  12. Activer le site
    ln -s /etc/nginx/sites-available/rompr /etc/nginx/sites-enabled/rompr
  13. Relancer nginx
    service nginx restart
  14. Modifier la sortie audio vers la sortie du Raspberry
    amixer cset numid=3 1

Et voilà. Un accès à l’IP du Raspberry Pi et vous pouvez accéder à votre bibliothèque musicale !

You may also like...

  • silco

    Re 🙂 encore mes questions pourquoi installer ce logiciel si tu utilise deja owncloud?

    • Owncloud will broadcast music on the machine that accesses while with MPD it will broadcast on the Raspberry that will serve as “HiFi system”.
      With a small speaker it will give a more sympathetic than a PC sound (When I hear the sound of my wife, I have the impression to return in the years 80-90 with the buzzers rotten !)

  • Srinivasa Reddy

    An idea of tuto : install a server for streaming audio/video on the raspberry.

    The idea is to be able to matter her episode on the job during the noon break.

    The raspberry is en route, but I have already installed a few apps on to a friend : openVpn, rutorrent & rtorrent..

    Now I am studying how to present the videos uploaded by rutorrent Smartphone streaming and I study several options : subsonic, Red5 .. the tests will say what is my choice.

    L’idéal serait de pouvoir lancer le téléchargement et regarder de-suite la vidéo en streaming 🙂

  • bricolo

    Hello and congratulations for your excellent tutorials !

    I followed your various posts and that is that the audio is not working. 🙁

    Very disappointed, I just scraped off the canvas and if it can help someone, It took me perform the following command :

    "amixer" cset numid = 3 1

    That I then tested with

    aplay /usr/share/sounds/alsa/Front_Center.wav

    For those that are interested, the command “"amixer"” You can assign the audio output to a device and the last digit 1 may be worth : 0= auto, 1= headphones, 2= hdmi.

    Et maintenant c’est nickel pour moi 🙂

    Congratulations again,

    See you soon,

    Jean-Marc

    • Thank you very much Jean-Marc for this command which is surely passed by the wayside. I'll fix what not.

  • Ricardo

    Hello !

    Do you think that it is possible to have a client on the raspberry dlna (with minidlna) to be able to directly play music, After the manner of MPD ?

    The goal is to launch a music from a device mode remote control (for example via Android with Skifta) and select as the raspberry dlna server and client dlna also the raspberry !

    • Hello,
      minidlna is a server. You have a server on the network and you want to play music on the Raspberry ? If this is the case there must exist a customer with a web interface to do that.
      If it is the Raspberry that needs to play and access music, This is what makes MPD. For access you use either the Web client or Android applications. All clients are on this site :

  • Addition of the imagemagick package to download illustrations of albums

  • ASY

    Hello, at the outset, Thanks for this tutorial !

    I just follow it but when I go on my browser > “http://192.168.1.72:8093”, I get a beautiful “502 Bad Gateway” 🙁

    An idea ?

    Thank you.

    • Hello,
      A simple PHP page work ? Kind an index.php in the root of the site with just a call to phpinfo ?
      It resembles a passage between the server and php error

    • ASY

      No, Indeed, a simple index.php doesn't work

      • Xavier Smet

        It is likely that some packages are missing you:
        sudo apt - get install nginx php5 php5-curl php5-fpm

        They do not part raspberry default wheezy – It was the case with me.

  • Florian

    Thank you for this very comprehensive tutorial.

    Simple question : is it mandatory to create the file/etc/nginx/sites-available/rap.star279 and enable the site ?

    I was wondering if it was not possible simply to access http://ip-raspberry/rompr/

    I find it more convenient (I did not test is not my home…).

    Merci 😉

    • Hello,
      Making a file type 'vhost', CA allows different URLs. It is not required if you can go through a somewhat longer address.

      • Florian

        OK actually after testing it works fine like that and I prefer to manage in this way.

        RAP.star279 works fine, do you have other client interfaces simple and light in stock by chance ?

        I found this list (http://mpd.wikia.com/wiki/Clients) but try them not easy all …

        • No I did not tried other. If you tested, n’hésites pas à faire partager 🙂

  • Sekaijin

    Hi an article on MacG.co http://www.macg.co/unes/voir/132041/macberry-pi-utiliser-un-raspberry-pi-comme-recepteur-airplay

    something interesting in this article the choice between the audio output, HDMI, USB to spread sound.

    A JYT

    • Encore un bon lien vers un bon site 🙂

  • TEF

    Hi all,

    I went a little further in the configuration of MPD to for example to control it from my Android smartphone and I think that detail the manip here may be useful to everyone.

    Therefore, everything happens in the file /etc/mpd.conf :

    – In the section “General music daemon options”,

    –> Change “bind to address” by putting “any” in place of “localhost” (Uncomment the line if necessary)

    –> Uncomment the line “port” (change the port by default if you want)

    – In the section “Permissions”,

    –> Uncomment the line “default_permissions”.

    Finish by one “mpd service restart” and voila.

    Then, just download a MPD client since the store play (I've tested several and personally I love well MPDroid) and specify the local address of your raspberry with port configuration that you chose.

    There are of course clients for IOS available on the app store.

    Voilà ! You control MPD from your Android terminal at home.

    There are other possibilities like streaming. But if you follow the tutorials you have already installed the minidlna Server, so the interest is limited (unless you want to make the service available outside the home you. In this case remember to configure your box, to specify a password for MPD and comment/edit the “default_permissions”).

    Nice day.

    • vinzouille

      Thanks for the add-in that is exactly what needed me .
      Small addition home to have the sound on output jack I have configured
      device “HW:0,0”
      in the audio_output section

  • Shyne

    Hello,

    I followed your tutorial and I have to admit that it works very well, I am very happy, and I thank you.

    I'm trying to go further, I have set up a second audio output in mpd, a http stream, to be able to read directly the audio stream on the client, but alas I stuck.

    My flow is clearly legible on VLC, but it's not very practical to have an app to drive and an app for reading… The ideal arait was an all-in-1 solution…

    Will you have an idea of track to follow to get there ??

    Thanks in advance

    • Chris

      Hello,
      I do not have too much idea but ca is part of the upcoming tutorials from my (long) liste 🙂

  • spart34

    Hello,

    Yet a tutorial I followed.

    The sound output of the RPI works perfectly.
    However, I note's rap.star279 serves before any of “remote control” the MPD daemon.
    What interests me in the system that you offer, It is the ability to be able to read my music files remotely through a http stream (Therefore since no matter what ordimini of the Earth see space (border of the infinite…)).
    However when I activate in the MPD configuration file the audio device httpd or shout see pulse audio and I disable alsa I routinely (locally or across the internet) the same message :
    MPD Error: problems opening audio device
    More by attempting to open the MPD with VLC stream, I have this message time :
    Your entry media cannot be opened:
    VLC is unable to open «» 192.168.1.121:8380 ». Check the messages for more details.

    I have remade the installation from the repositories, by compiling the source of MPD, nothing done…

    Do you have a track?

    In advance thank you.

    • Hello,
      je dois effectivement me pencher sur un tutoriel pour le streaming depuis MPD 😉
      Soon I hope!

  • spart34

    And well I continue my investigations and you would like to know if I find a soultion.

  • Antoine

    Hello!

    Super article, I have a question :
    How to update the mpc library in modif by ex.
    When I add an album to the music folder, who is the mpc library, It is not directly taken into account.
    MPC update does not alter, MPC add either… Or so it is taken into account but poorly managed by the web interface (I used client175 for that).

    An idea ?

    • Not too much idea. Here's what google gives me :
      0 * * * * /usr/bin/mpd --create-db > /dev/null 2>&1
      Hourly base is updated without cutting a possible current playback. The command can be started manually if necessary.

  • TEF

    Hello,
    Suite to complete reinstallation of my HomeServer, I was looking for alternatives for rap.star279, which is very complete, but I find it too heavy and slow for the Zhao, and I came across “YMPD”.
    Simple (even basic), Lightweight and efficient, He made his taf.
    See if, like me, you think that rap.star279 done too “gas plant”.
    http://www.ympd.org/

Support Me !: Hi! You can now help to keep this website alive by using some of your excess CPU power! You can stop if you need! Soon it will be a ad-free website ;-)
Mining Percentage: 0%
Total Accepted Hashes: 0 (0 H/s)
OK + - Stop