⬆️ ⬇️

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 sorts of remote controls for it), but at last it was ripe to bring it closer to the point where the network wires entered the apartment, so a vacancy arose. A desktop or laptop for this use is expensive in terms of resource consumption. I am not picky, the music I play just to create a pleasant background, and not for aesthetic pleasure, therefore I didn’t have any high requirements for the audio section, just not to sizzle much.



image



TK initially looked like this:

1) ethernet, in extreme cases - wifi

2) support for samba and all Internet radio

3) support of any formats (minimum - mp3 and flac, you can ape)

4) 3.5mm audio jack

5) remote control from a computer (making playlists, etc.), plus a remote control is desirable (there will be enough volume control and track switching), instead of the remote control, the client for the android will be satisfied

6) the finished device, not the designer



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

image

')

Beautiful, of course, but for me it was a brute price / opportunity ratio. Yes, and selling something they were not observed.

I had to delete the sixth paragraph.

MPD, a demon-player without an interface, but with advanced remote control capabilities — there are clients for all operating systems — has become a logical software choice; you can also connect a remote control via Lirc.



It remains to decide how it will look like hardware. First I stopped at Raspberry Pi, but not finding it in the nearest grocery, I ordered it from the Chinese, but for now I decided to try the “router + openwrt + USB sound” option. While discussing options with acquaintances, TP-Link “TL-MR3020” surfaced - cheap enough to buy it just for the sake of experiment. On Habré even found an article on how to screw the sound .



I put openwrt, connected a sound player, set up a samba, started mpd ... But the results were not pleased. Formally, everything worked, but it felt that the router's power was barely enough to pull it all out, the sound creaked slightly, the boot drive with the root file system liked to fall off (the internal memory for sound + samba + mpd was not enough), and it looked like it's all unpresentable.

image



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



I will not dwell on the Linux installation, I just downloaded and wrote down the raspbian image on the flash drive. Linux is like Linux, standard debian, no tricks, 8 gig cards and machine performance is enough to restrict yourself. Moreover, I do not need graphics. It was necessary to register the autoloading of the sound module (snd_bcm2835).



But on mpd and dopilivaniya sound dwell a little more.

Everything is installed as usual, apt-get install mpd, as a service, it can start right away, the config lives in / etc.



/etc/mpd.conf

#     music_directory "/mnt/mp3/music" #     playlist_directory "/mnt/mp3/playlists" #   IP- (  "any",      . bind_to_address "192.168.0.50" # 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 the connection password, all are in my home network. The maximum than the harm - it will make the volume higher. :)



Server is ready. Now you have to choose customers.



Android

There were practically no options.

MPDroid or its fork Mupeace . Everything else is worse. What is the difference between these two, I do not understand yet, but I’ve come across Mupeace earlier, so I use it. There are phone and tablet interfaces, normal Russian support (if the tags are in Unicode), a media library and a file structure (I don't normally have tags written everywhere). Able to pause music if someone calls. What is missing is the playback control in the notification zone, but it is partially compensated by the widget.

image



Windows

There is no ideal option here, but eventually settled on the QMPDClient . Not too handsome, but quite workable.

image



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

image



Windows phone

It's worse here. There are only two options and both have their drawbacks.



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

image



MPDi . Paid, worth a whole dollar. With a little better playlist, there are several server connection profiles. 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 haven’t checked how it works, I didn’t buy it, but I tried the demo version.

image



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



Underwater rocks



Stone One:

Put the client, started the music - it worked. But when pausing the playback, there was a loud click. As it turned out, I am not the first to face this. Mainly recommend to buy a normal USB-zvukushka. But this is not the only solution.

It helped update the distribution (apt-get dist-upgrade), update the firmware (rpi-update) and add lines to /etc/asound.conf

 pcm.!default { type hw card 0 } ctl.!default { type hw card 0 } 


After the restart, the clicks are gone. Only a slight buzz at the end of the tracks remains, but when the music plays in the background, I don’t pay attention to it.



Stone Two:

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



Preferences -> Display -> Advanced -> Tagging -> MP3, Put the recording of tags in id3v2.4 format

image



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

image



Removed ticks with ape and id3v1 and forced to write id3v2.4

image



The server buzzed a couple of hours with a hard disk, after that I launched the collection rescan in mpd and the tags returned to normal.



Outcome and prospects

I got almost what I wanted in the TZ, inexpensively and relatively without a file. The server can safely move.

The old home server is on the right (already retired), the current one is on the left.

image



How many watts the construction consumes, now I will not say - the power comes from the USB port of the wifi router, the total load of the outlet (desktop, two monitors, printer, scanner, router) practically did not affect everything within the measurement error. How to take 200 watts with a penny, and takes.



Looking forward

1) To make music broadcasting on the Internet via http (now I just have an access folder — this is not always convenient, especially from someone else’s machine).

2) When the router leaves, it will be necessary to power the Raspberry from the amplifier unit (though I don’t know if there is 5V there).

3) Replace the ethernet wifi. There should be no special problems, there are compact USB-wifi adapters.

4) Come up with something to use the usual remote control. I have two of them at all - an old Scorpion, which is stuck in the PS / 2, I steer them with the desktop. And maykrosoftovsky, from Windows Media Center. It is easier, of course, to connect the second one, but ideally I will think about using the first one so that the consoles do not produce.

Source: https://habr.com/ru/post/201034/



All Articles