Page 1 of 1

MPD serving up to 14 devices at a time

Posted: October 29th, 2019, 5:04 pm
by ramsamba
Hi everyone
i am new to MPD.
we are trying to setup an MPD service on an audio server, headless running Debian 10, that can stream to 14 different rooms in a building. the building is a school that teaches music and dance. At each room, the user will use an android phone to connect to the wifi and stream music of his/her choice.

our server will serve the music from a very fast SSD rather than a hard disk, so that slow HDD access will not cause interruptions in any of the 14 rooms. we cannot afford for delays or gaps in the music in the 14 rooms since the music and dancing practices will be interrupted.

our server will be using a 2nd generation Ryzen 5 2600, that has 6 cores and 12 threads, and 4GB DDR4 pc2666 RAM. the network will be a gigabit network running fast tplink eap 225 ceiling mounted access points, totally 5 in number

will we be able to pull this off using MPD and the above hardware?

is there anything we should know?
we appreciate all the help you can give, and if you have any questions, please ask.

thank you,
ram

Re: MPD serving up to 14 devices at a time

Posted: October 29th, 2019, 6:13 pm
by max
MPD is not a music distribution system - it is a remotely controllable music player. Do not use it for streaming; it can provide streams, but streaming music is full of severe problems (no matter which software you use).

My suggestion: make that central server a NFS file server, and run MPD on it (with only a "null" output, i.e. it will never actually play).

Then in every of those 14 rooms, put a Raspberry Pi (or any other computer) running MPD, which uses music files via NFS, and uses MPD's database using the "proxy" database plugin (see https://www.musicpd.org/doc/html/user.html#satellite). That way, all rooms always have the latest music database without having to scan all the music (because the central server does that).

Your Ryzen server is heavily overpowered. And you don't need a SSD. There will be no interruptions only because you have a "slow" HDD. You could even use a cheap NAS as file server, and use that Ryzen box for something else...
15 years ago, I used to run MPD on a Pentium-60. (just one core with 60 MHz, can you imagine that?)

Re: MPD serving up to 14 devices at a time

Posted: October 31st, 2019, 1:35 pm
by ramsamba
hi max,

thank you for your most enlightening answer and suggestions.

1.
Then in every of those 14 rooms, put a Raspberry Pi (or any other computer) running MPD
Can we use an Android MPD app instead of the raspi, such as M.A.L.P. - MPD Client (https://play.google.com/store/apps/deta ... malp&hl=en), or MPDroid (https://play.google.com/store/apps/deta ... roid&hl=en)?

2. If your answer will be a yes, then would the cellphone/tablet also need to be able to mount the NFS shares on the server ?

thank you,
ram

Re: MPD serving up to 14 devices at a time

Posted: October 31st, 2019, 2:54 pm
by max
Neither MALP or MPDroid is a music player - they are MPD clients, which means they control MPD playback (i.e. like remote controls), but it's MPD who plays, not the client on your phone/tablet.

But you can install MPD on your Android device: https://play.google.com/store/apps/deta ... rg.musicpd (Additionally, you need a MPD client, which can also be installed on that same Android device. And additionally, any phone/computer/whatever on the network can control any MPD, so a central administrator can control them all.)
And yes, this MPD build can use NFS shares on the file server.

Though I wouldn't recommend using Android for a music player - Android isn't a good choice of operating system for reliable services. A Raspberry Pi is cheap and reliable enough, and it can do bit-perfect digital playback over HDMI (you don't need the crappy headphone connectors, which are just as crappy on Android devices).

Re: MPD serving up to 14 devices at a time

Posted: November 1st, 2019, 6:27 am
by ramsamba
Thanks for the clarification, I think I now understand MPD better in the way it all links up between server and client.

FYI, we are now looking at the possibility of using a Pi Zero -W instead of the Pi 4 because of costs involved.

If you know of people using a Pi0W as a client MPD, please let us know.

On another note, purely academic:
1. Is it not possible to make MPD listen on many ports, and allow multiple clients to connect through various ports to the same daemon?
2. Or, is it possible to spawn multiple instances of MPD to be able to serve multiple clients? (from what I understand thus far, the current incarnation of MPD can only serve a single client)

Re: MPD serving up to 14 devices at a time

Posted: November 1st, 2019, 7:41 am
by max
MPD can "serve" an arbitrary number of clients, where "serve" means "many clients control one MPD instance at the same time". All clients can send commands to MPD, and all clients can poll for MPD's status and display it.
Yes, MPD can listen to many ports, but how would that be helpful?
And yes, you can spawn an arbitrary number of instances of MPD, but why would you want to do that?

Re: MPD serving up to 14 devices at a time

Posted: November 1st, 2019, 8:00 am
by max
Btw. I wouldn't use a Pi Zero. It has just Wifi, no ethernet.

You worry if your extremely overpowered server is fast enough to feed 14 rooms, but then you connect those 14 rooms via Wifi. Wifi is the biggest problem you have - it is slow and unreliable, and will cause flaky playback.

Any ancient Raspberry Pi 1 will do better than a Pi4 connected via Wifi. The venerable Pi 1 is fast enough for MPD, by a large margin. But it's the network connection that counts, it must be reliable.

Re: MPD serving up to 14 devices at a time

Posted: November 2nd, 2019, 6:30 am
by bern
ramsamba wrote:
October 29th, 2019, 5:04 pm
Hi everyone
i am new to MPD.
we are trying to setup an MPD service on an audio server, headless running Debian 10, that can stream to 14 different rooms in a building. the building is a school that teaches music and dance. At each room, the user will use an android phone to connect to the wifi and stream music of his/her choice.

our server will serve the music from a very fast SSD rather than a hard disk, so that slow HDD access will not cause interruptions in any of the 14 rooms. we cannot afford for delays or gaps in the music in the 14 rooms since the music and dancing practices will be interrupted.

our server will be using a 2nd generation Ryzen 5 2600, that has 6 cores and 12 threads, and 4GB DDR4 pc2666 RAM. the network will be a gigabit network running fast tplink eap 225 ceiling mounted access points, totally 5 in number

will we be able to pull this off using MPD and the above hardware?

is there anything we should know?
we appreciate all the help you can give, and if you have any questions, please ask.

thank you,
ram
You can also try/use LMS (Logitech Media Server) and squeezelite as a clients/players controlled remotely by Orange squeeze or other android or iOS apps.

Cliens/player (squeezelite) can be easy installed on RPI together with Linux + GUI using piCorePlayer system.

Re: MPD serving up to 14 devices at a time

Posted: November 4th, 2019, 2:08 pm
by skidoo
Powered speakers or passive? Cabeling? Raspberry Pis are wonderful toys but not suitable for productive environment. Search the Internet for flash card wear or power supply related issues and multiply by 14.

Better use PA equiment. Less trouble and costs in the long run.

Re: MPD serving up to 14 devices at a time

Posted: November 4th, 2019, 2:17 pm
by max
skidoo wrote:
November 4th, 2019, 2:08 pm
Raspberry Pis are wonderful toys but not suitable for productive environment.
Don't exaggerate the problems with Raspberry Pis. This guy wanted to use Android instead, and this is your base line for reliability.
Can you imagine how unreliable Android is, compared to a Raspberry Pi?
A Raspberry Pi is pretty good for most tasks - not perfect, but certainly better than any Android-based solution.

Re: MPD serving up to 14 devices at a time

Posted: November 4th, 2019, 5:31 pm
by ramsamba
@skidoo
Powered speakers or passive
Powered
Raspberry Pis are wonderful toys but not suitable for productive environment
I beg to differ, they are not toys.
we have been running 6 raspi servers for the last two years and haven't had a single issue.
we run digital signage, using a raspi for server and raspies for clients. not a single issue with microSD corruption in the last two years
we've been running an SMS server for the last year, also with no issues
we run file servers, main and backup, on raspies as well. still no problems in the last two years.

the only time we had a problem was when there was a power cut, and our UPS ran out of juice. that was our problem because we hadn't implemented signalling from the UPS to all connected devices to go into graceful shutdown.

at home, i've been running a raspi for the last 3.5 years as a torrent device, and until now, there has been no corruption of the microSD. the torrents are written to an attached hard disk.
Search the Internet for flash card wear or power supply related issues
i don't need to search the internet, i have enough direct experience of it.

thanks anyway for your reply.

Re: MPD serving up to 14 devices at a time

Posted: November 4th, 2019, 5:50 pm
by ramsamba
bern wrote:
November 2nd, 2019, 6:30 am
You can also try/use LMS (Logitech Media Server) and squeezelite as a clients/players controlled remotely by Orange squeeze or other android or iOS apps.

Cliens/player (squeezelite) can be easy installed on RPI together with Linux + GUI using piCorePlayer system.
Thanks bern, we shall check it out. FYI, we are planning to use Logitech powered speakers, of course that has nothing to do with LMS.

We are actually a non-profit organization involved in Indian classical music and classical dance, and an approved charitable org by the government of Malaysia. We are always short of funds and so we have to keep costs down but yet provide an excellent experience. So all your suggestions are most welcome.

Re: MPD serving up to 14 devices at a time

Posted: November 5th, 2019, 4:41 am
by bern
ramsamba wrote:
November 4th, 2019, 5:50 pm
we are planning to use Logitech powered speakers
If you used RPIs as players how would you connect RPI to the speakers (using RPI's HDMI output, USB DAC, RPI I2S hat GPIO DAC board, analog onboard headphone output etc)?

To use wifi to connect players with server you could try to set up/install wifi access point AP (hostapd) on your debian server/machine. You would need good Atheros/Qualcomm pcie wifi card, three antennas for AP and cheap USB antenas/stick for each RPI (if you would use cheap USD10 RPI2).
Of course it would need tests (I would start from 2.4GHz and 'N' band). As max wrote wifi could be the bottleneck of your system.

Re: MPD serving up to 14 devices at a time

Posted: November 5th, 2019, 5:51 pm
by ramsamba
bern wrote:
November 5th, 2019, 4:41 am
If you used RPIs as players how would you connect RPI to the speakers (using RPI's HDMI output, USB DAC, RPI I2S hat GPIO DAC board, analog onboard headphone output etc)?
Based on Max's suggestion of using the RPi, and to keep costs down, we will purchase an RPi Zero-W for testing to see if we can pull it off successfully.
There seems to be two issues:
1. Audio out: there is no audio port on the RPi0W, so we'll use an USB audio dongle (is that what you meant by "USB DAC"?). Here's something cheap which we shall avail for testing and if it works well we will buy more:
- https://encrypted-tbn3.gstatic.com/shop ... g&usqp=CAc
or
- https://encrypted-tbn3.gstatic.com/shop ... w&usqp=CAc

2. The wifi receptivity of the RPi0W may be weak, so the idea is to use an external antenna, and soldering the wires to the board. We've found a case for the RPi0W that has a hole in it for an antenna to be inserted.
- https://hackaday.com/2017/03/07/adding- ... pi-zero-w/
- https://www.recantha.co.uk/blog/?p=16553

We will need to try out everything before we make the final purchase for all the studios.
bern wrote:
November 5th, 2019, 4:41 am
To use wifi to connect players with server you could try to set up/install wifi access point AP (hostapd) on your debian server/machine. You would need good Atheros/Qualcomm pcie wifi card, three antennas for AP and cheap USB antenas/stick for each RPI (if you would use cheap USD10 RPI2).
Of course it would need tests (I would start from 2.4GHz and 'N' band). As max wrote wifi could be the bottleneck of your system.
For testing purposes, we will purchase a TPLink EAP225 that will be mounted on the ceiling along the corridor between the studios. We will be having more than one of these APs. They are MU-MIMO and we expect them to be powerful enough, and to be able to serve multiple wifi clients simultaneously. They come with POE injectors as well.
https://www.tp-link.com/us/business-net ... nt/eap225/
https://blogs.umass.edu/Techbytes/2017/ ... s-mu-mimo/

The APs will connect to a gigabit switch that will have our media server connected.
To load the AP we will use 5-10 android phones, apart from our test RPi0W, to connect to the AP and stream audio. Like Max said, the android phones are not reliable enough, and if we can get them all streaming at the same time, then we are good to go buying the remaining RPies, and the EAP225. Those Android phones will only be for testing purposes; once proven we will use RPies per Max's suggestion

Because we will be using the USB port for audio out, we won't be able to use the USB antenna stick per your suggestion.

Thanks for your suggestions. We are a small team of 3 volunteer techies working on this project, having our own day jobs as well; none of us has any prior experience with this type of implementation, so we appreciate all the suggestions that you and Max have given.

Re: MPD serving up to 14 devices at a time

Posted: November 5th, 2019, 8:21 pm
by bern
Audio out: there is no audio port on the RPi0W, so we'll use an USB audio dongle (is that what you meant by "USB DAC"?). Here's something cheap which we shall avail for testing and if it works well we will buy more
You will probably be disappointed in the sound quality from such USB DACs.
Far better solution is to use I2S signal from RPI's GPIO and feed external DAC directly.
See example:
https://shop.pimoroni.com/products/phat-dac

Re: MPD serving up to 14 devices at a time

Posted: November 6th, 2019, 1:13 am
by ramsamba
bern wrote:
November 5th, 2019, 8:21 pm
You will probably be disappointed in the sound quality from such USB DACs.
Far better solution is to use I2S signal from RPI's GPIO and feed external DAC directly.
See example:
https://shop.pimoroni.com/products/phat-dac
Sounds great. We shall try that out. Do you think something like the item below will do?
https://shopee.com.my/NEW-GY-PCM5102-I2 ... 6403184724

Any ideas how we would fit that onto an RPi0W?

Re: MPD serving up to 14 devices at a time

Posted: November 6th, 2019, 4:23 am
by bern
ramsamba wrote:
November 6th, 2019, 1:13 am
Sounds great. We shall try that out. Do you think something like the item below will do?
https://shopee.com.my/NEW-GY-PCM5102-I2 ... 6403184724
The DAC chip PCM5102 is good. Applied in many RPI sound hat boards.
You can have an issue with wiring and probably grounding since the boards would be connected with cables. The shorter the cables, the better.
For wiring see the bottom of the page and comments:
https://raspberrypi.stackexchange.com/q ... y-pi-zerow
ramsamba wrote:
November 6th, 2019, 1:13 am
Any ideas how we would fit that onto an RPi0W?
See example how could be done (RPI0 + PCM5142 DAC + 3D printed case)
https://github.com/PolyVection/RPI-ZERO-case
You can print the case but before it need adjustment since DAC board you consider is a litte bit wider. You can make a hole for screwing an antenna but be aware that close placement of wifi antenna and DAC chip could distort the sound.

Re: MPD serving up to 14 devices at a time

Posted: November 6th, 2019, 6:58 pm
by skidoo
FYI, we are planning to use Logitech powered speakers, of course that has nothing to do with LMS.
Again a toy. How big are the rooms? What volume is required?