Another mp3 box from mpd and raspberry

    I wanted to build a network audio player. Not “media”, but exclusively to the music. Previously, this was done by the home server (foobar2000 + all kinds of remote controls for it), but it was finally ripe to take it closer to the entry point of the network wires to the apartment, so a vacancy arose. A desktop or laptop for this use is expensive in terms of resource consumption. I’m not picky, the music I play is just to create a pleasant background, and not for aesthetic pleasure, because I didn’t have any high requirements for the audio path, if only I didn’t hiss a lot.


    TK initially looked like this:
    1) ethernet, in extreme cases - wifi
    2) support for samba and all kinds of Internet radio
    3) support for any format (minimum - mp3 and flac, you can ape)
    4) 3.5mm audio jack
    5) remote control from a computer (compiling playlists, etc.), plus a remote control is desirable (volume control and switching tracks are enough), instead of a remote control a client for android will work
    6) a ready-made device, not a constructor

    Having rummaged through Google and forums, it turned out that if not a constructor, then something like Denon DNP-F109 or Philips Streamium , etc.

    Beautiful, of course, but for me it was a bust in terms of price / performance ratio. Yes, and on sale something was not observed.
    I had to delete the sixth paragraph.
    The logical choice was MPD - a demon player without an interface, but with advanced remote control capabilities - there are clients for all OSs, you can connect the remote control via Lirc.

    It remains to decide how it will look in hardware. At first I stopped at the Raspberry Pi, but not finding it in the nearest grocery, I ordered it from the Chinese, but for now I decided to try the option “router + openwrt + USB sound”. In the process of discussing options with friends, TP-Link "TL-MR3020" surfaced - cheap enough to buy it just for the sake of experiment. On a habr even there was an article on how to fasten a sound .

    I installed openwrt, connected a sound recorder, set up a samba, started mpd ... But the results were not pleasant. Formally, everything worked, but it felt like the power of the router was barely enough to pull it all off, the sound wheezed slightly, when loading, the flash drive with the root file system liked to fall off (there is not enough internal memory for sound + samba + mpd), and it looked it's all unpresentable.

    I had to go after the raspberries. The Chinese did not send on time, apologized, said that their mail had wrapped the parcel, offered to send via Singapore. But I decided not to wait another month, but bought it in Moscow, albeit 30 bucks more than in China.

    I will not dwell on installing Linux, I just downloaded it and wrote a raspbian image on a flash drive. Linux as Linux, standard Debian, no tricks, an 8 gig card and machine performance is enough to not limit yourself much. Moreover, I do not need graphics. It only needed to register the startup of the sound module (snd_bcm2835).

    But on mpd and dopilivaniya sound dwell a little more.
    Everything is set as usual, apt-get install mpd, as a service it can start immediately, the config lives in / etc.

    #Путь к папке с музыкой
    music_directory "/mnt/mp3/music"
    # путь к хранилищу плейлистов
    playlist_directory "/mnt/mp3/playlists"
    #привязка к определенному IP-адресу (можно поставить "any", но я люблю указывать конкретные настройки.
    bind_to_address ""
    port "6600"
    #следить за изменениями в каталоге с музыкой
    auto_update "yes"
    audio_output {
    type "alsa"
    name "AudioCardName"
    device "hw:0,0"
    #регулировка громкости средствами mpd. Если не указывать, то громкость регулируется через alsamixer, по экспоненте - до 50% практически молчит, а потом довольно резко растет. А так ближе к линейному распределение.
    mixer_type "software"

    I did not specify a password for the connection, all of my own on the home network. The maximum than harm - this will make the volume higher. :)

    Server is ready. Now you need to choose customers.

    There were practically no options.
    MPDroid or its fork of Mupeace . Everything else is worse. I do not understand how these two are seriously different, but I came across Mupeace earlier, so I use it. There are telephone and tablet interfaces, normal Russian support (if the tags are in Unicode), a media library and file structure (not everywhere, my tags are normally spelled). Able to pause music if someone calls. The only thing missing is the playback control in the notification area, but partially offset by the widget.

    There is no ideal option, but in the end I settled on QMPDClient . Not too handsome, but quite functional.

    Although GMPC is also not bad and generally seems more complete. Although I will still stay with QMPDClient.

    Windows Phone is
    worse here. There are only two options and both have their own drawbacks.

    sevenMPC . Free, can display a playlist, adjust the volume and switch tracks. And that’s all, perhaps. It does not even display what is currently being played. Well, you can still look at the file structure of the collection, just do nothing with it, even add to the playlist.

    MPDi. Paid, it costs a whole dollar. With a playlist a little better, there are several profiles for connecting to servers. But there are no buttons for switching tracks, and with the collection it works the same way as sevenMPC - only displays. Although there is still a search, I didn’t check how it works, I didn’t buy it, but I tried the demo version.

    About clients other OS will not say anything. With Linux, Linuxsoids already know what they have there :), I don’t have devices from Apple, I didn’t get my hands on Windows Mobile, although I should - maybe an old HTC will register as a permanent control panel for the player. Web interfaces do not interest me - independent clients are more convenient.


    Stone One:
    Delivered the client, launched the music - it worked. But when pausing playback, there was a loud click. As it turned out, I'm not the first to face this. Mostly recommend buying a normal USB sound card. But this is not the only solution.
    The distribution update (apt-get dist-upgrade), firmware update (rpi-update) and the addition of lines to /etc/asound.conf helped
    pcm.!default {
            type hw
            card 0
    ctl.!default {
            type hw
            card 0

    After the reboot, the clicks went away. There was only a slight buzz at the end of the tracks, but when the music plays in the background, I do not pay attention to it.

    Stone Two:
    Tags. Although I seem to have been using id3v2 for a long time, I left id3v1 in 1251 for compatibility. And for mpd, as it turned out, v1 is a priority. So I had to cut v1. Well, for the sake of order, still completely switch to v2.4. Foobar2000 came to the rescue.

    Preferences -> Display -> Advanced -> Tagging -> MP3, I put the tag record in id3v2.4 format. I selected

    all mp3s in the collection and clicked Tagging -> MP3 tag types

    Unchecked ape and id3v1 and forced to write id3v2.4

    Server buzzed a couple of hours with a hard drive, after that I ran rescan collections in mpd and the tags returned to normal.

    Outcome and prospects
    I got almost what I wanted in the statement of work, inexpensively and relatively without a file. The server can safely move.
    The old home server on the right (already retired), the current one on the left.

    How many watts the design consumes, I won’t say right now - the power comes from the USB port of the wifi router, the total load of the socket (desktop, two monitors, printer, scanner, router) was practically not affected, everything is within the measurement error. As it took 200 watts with a penny, so it takes.

    In the future, I want to
    1) Make music broadcast to the Internet via http (now I just have a folder open for access - this is not always convenient, especially from someone else's machine).
    2) When the router leaves, power up the Raspberry from the amplifier unit (though I don’t know if there is 5V there, I’ll have to see it).
    3) Replace ethernet with wifi. There should not be any special problems, there are compact USB-wifi adapters.
    4) Come up with something about using a conventional remote control. I have two of them at all - an old Scorpio, which sticks into PS / 2, I drive them with the desktop. And Microsoft, from Windows Media Center. It’s easier, of course, to connect the second, but ideally I will think about using the first, so that the remotes do not produce.

    Also popular now: