Multi-room audio solution


42 posts   Page 2 of 2   1, 2
by benofishal » Tue Jan 15, 2013 12:39 am
Thanks for all your config tips for pulseaudio on the pi.

FYI PulseAudio 3.0 is available precompiled for the Pi and may help your sync - to upgrade follow these instructions

IMPORTANT - Make a backup of /etc/pulse/ folder as this will overwrite your configs

cd /tmp
wget http://www.mirrorservice.org/sites/rasp ... noX.tar.gz
cd /
service pulseaudio stop
tar -zvxf /tmp/pulse-3.0-noX.tar.gz

Restore your config files then restart pulseaudio.

You can check the upgrade was successful -

pulseaudio --version

You should see version 3.0

I only have a single Pi so far to experiment with but perhaps you will have better sync with 3.0 vs 2.0/2.1.

Could your let me know how you get on if you decide this upgrade.
Posts: 2
Joined: Thu Jan 03, 2013 1:05 am
by ianmacs » Fri Jan 18, 2013 8:44 pm
A source code diff
Code: Select all
wget http://freedesktop.org/software/pulseaudio/releases/pulseaudio-2.0.tar.gz
wget http://freedesktop.org/software/pulseaudio/releases/pulseaudio-3.0.tar.gz
tar xvzf pulseaudio-2.0.tar.gz
tar xvzf pulseaudio-3.0.tar.gz
diff -ur pulseaudio-[23].0/src/modules/rtp

reveals that there are no functional changes in the RTP modules between versions 2 and 3.
Posts: 30
Joined: Mon Jul 09, 2012 10:42 am
by Jonathon » Fri Jan 25, 2013 8:22 pm
After countless hours of struggling to get synchronized audio over my WiFi network, I finally managed to get my Raspberry Pi playing music in perfect sync with my laptop over WiFi. Here is how I made this seemingly impossible feat a reality:

squeezelite-armv6hf 0.9beta10 on my Raspberry Pi (running Raspbian)
squeezelite-x86-64 0.9beta10 on my laptop (running Ubuntu 12.10)
Logitech Media Server 7.7.2 on my laptop

I have ntpd running on my pi and I have my laptop syncing its time with my pi so that they match as closely as possible. I have pulseaudio running in system mode and I have src-sinc-fastest set as the resample-method in /etc/pulse/daemon.conf (Thank you very much ianmacs for this tip!)

My previous attempts (pulseaudio via RTP, pulseaudio via native protocol) resulted in audio dropouts, failed synchronization, or no playback at all. It is unfortunate that there is such a lack of decent support among free software projects for this ability. Having a free software alternative to more expensive, proprietary offerings like Sonos is of tremendous value.
Posts: 10
Joined: Wed Dec 12, 2012 2:03 am
by Gerrelt » Sat Jan 26, 2013 1:58 pm
I've been using squeezelite with a LMS server in multi room setup too.
For several weeks allready, I'm running squeezelite on a living room raspberry and squeezelite on a kitchen raspberry.
The synchronisation is very good, I am very happy with this setup!
my Raspberry Pi page: http://raspberry.gerrelt.nl
User avatar
Posts: 225
Joined: Sat Nov 10, 2012 9:01 am
by DAPL » Mon Jan 28, 2013 1:20 pm
Hi Gerrelt,

Can you tell me/everyone what you are running LMS on? On a Pi, computer, nas, or other?

I'm trying to get LMS onto my NAS. I just want to find a stable multiroom set up, so it would be really helful to know more on your proven set up.

Many thanks.
Posts: 6
Joined: Mon Jan 28, 2013 1:14 pm
by Gerrelt » Mon Jan 28, 2013 6:56 pm
I'm running LMS server version 7.7.2 on my Nas (the Qnap TS-219P+ ).
Both the Raspberries have a wired connection to the router, to which the NAS also is connected to.
I ran one of the raspberries over Wifi first, but that wasn't reliable enough.

The living room Raspberry is attached to a Behringer UCA 202 USB sound card, which is attached to a Powered Sony network speaker (not using the network functionality of that one, it's connected through 2,5 mm audio jack).
The kitchen Raspberry has a LogiLink USB Soundcard, which is connected to an USB powered amplifier I took out of some PC speakers (Speedlink Snappy USB powered speakers). That amplifier is connected to two small ceiling speakers.

Both the raspberries have a powered USB hub, the D-Link DUB H4. The USB devices are connected to the hub. I spliced the wire coming from the USB hub's power adapter. That extra wire is connected to the raspberry. So the raspberry is powered directly from the power adapter, and not through the hub.

Crackles in the sound were solved by switching the USB soundcard around on the USB hub. The USB port that was the last in line proved to sound the best.
I also set squeezelite to use the USB soundcard front speakers setting for best quality.

The LMS server is remote controlled by an app on my (and my wifes) android phone. The app is called "Squeezer" and works pretty good.

See this thread for a small tutorial on how to install the raspberry: Squeezelite up and running on Raspian Wheezy Hard Float. If you want an easier install, then use Squeezeplug.

I also have a portable radio cassette player which I turned into a squeezebox player: Radio Raspberry
It's also my research and development raspberry. 8-) It's currently running the linux OS tinyCore, this OS can withstand pulling the power plug without shutting the OS down.
my Raspberry Pi page: http://raspberry.gerrelt.nl
User avatar
Posts: 225
Joined: Sat Nov 10, 2012 9:01 am
by DAPL » Wed Jan 30, 2013 1:23 pm
Thanks so much for all that detail. Really, really, really helpful.

Think I might buy a reel of cat6 cable to make it all rock solid (fortunately I can do cable runs easily - dormer bungalow!). I especially like the way you powered the rpi from the hub adaptor. Ah so that's you - had seen your radio raspberry previously - yep, very impressive!

Can you play different music in your two zones(living room & kitchen) at the same time? And if you can, I presume you can also play same music in both zones at the same time, i.e. party mode? Does 'Squeezer' have this functionality to play different devices/zones? Actually, I just looked at 'Squeezer' which I forgot I had downloaded previously onto my android, and I can see a 'Players' button, but I can't test as I haven't set everything up yet!

Your suggestion on Squeezelite and Squeezeplug. Leaving aside how hard/easy it is to install either, which is better and what are the differences? I'm familiar with Squeezplug and being able to install LMS or other server onto the same rpi along with player, but Squeezelite must be similar to Squeezeslave, and if so why did you choose Squeezelite? Actually this has probably been answered many times elsewhere, so I should probably just do a quick search and I'll find out fairly quickly, but if you've any personal findings / preferences, I'd love to know, or just post a related link.

Many thanks again. I really appreciate it,
David.
Posts: 6
Joined: Mon Jan 28, 2013 1:14 pm
by Gerrelt » Wed Jan 30, 2013 7:56 pm
DAPL wrote:Can you play different music in your two zones(living room & kitchen) at the same time?

Yes, you can. With Squeezer, or through the LMS web interface, you can choose a player and then use that player to play something. If hey are not synchronized.

DAPL wrote:And if you can, I presume you can also play same music in both zones at the same time, i.e. party mode?

Yes, in the LMS web interface, you can synchronize two or more players. Everything that's started on one of the synchronised players will be played on the other ones too.
Synchronisation can NOT be done or undone through Squeezer.
Volume is adjuster per player, allthough there is also a setting to synchronize the volume too.

DAPL wrote:Does 'Squeezer' have this functionality to play different devices/zones? Actually, I just looked at 'Squeezer' which I forgot I had downloaded previously onto my android, and I can see a 'Players' button, but I can't test as I haven't set everything up yet!

Yes, as said before you can synchronise players. With the players button you can choose a player.
Or do you mean clusters of players...I don't know, I've only used it with three players.

DAPL wrote:Your suggestion on Squeezelite and Squeezeplug. Leaving aside how hard/easy it is to install either, which is better and what are the differences?

Squeezeplug is a lot more then just a squeezebox player. But it also got two (or three?) squeezebox players included. It's got squeezeslave and squeezelite. It's meant to make installing something like this easy. So, that would be the best choice when you're not familiar with Linux, or when you just want an easy install. :)

DAPL wrote:I'm familiar with Squeezplug and being able to install LMS or other server onto the same rpi along with player, but Squeezelite must be similar to Squeezeslave, and if so why did you choose Squeezelite?

I've used squeezeslave first. But Squeezeslave had problems playing internet radio streams that are not in 44.1 Khz. An internet radio stream that broadcasts at 48 Khz sounds too slow. Streams in lower then 44.1 Khz sound too fast (chipmunks.. :) ) .
Another difference is that Squeezeslave has got a character based interface, and squeezelite doesn't. But I use my raspberries headless, so I cannot use an interface anyway. I only use Squeezer to control the players (and sometimes the LMS web interface).

DAPL wrote:Many thanks again. I really appreciate it,

No problem! 8-)
my Raspberry Pi page: http://raspberry.gerrelt.nl
User avatar
Posts: 225
Joined: Sat Nov 10, 2012 9:01 am
by ssl303 » Tue Feb 12, 2013 12:25 pm
benofishal wrote:Thanks for all your config tips for pulseaudio on the pi.

FYI PulseAudio 3.0 is available precompiled for the Pi and may help your sync - to upgrade follow these instructions

IMPORTANT - Make a backup of /etc/pulse/ folder as this will overwrite your configs

cd /tmp
wget http://www.mirrorservice.org/sites/rasp ... noX.tar.gz
cd /
service pulseaudio stop
tar -zvxf /tmp/pulse-3.0-noX.tar.gz

Restore your config files then restart pulseaudio.

You can check the upgrade was successful -

pulseaudio --version

You should see version 3.0

I only have a single Pi so far to experiment with but perhaps you will have better sync with 3.0 vs 2.0/2.1.

Could your let me know how you get on if you decide this upgrade.


I followed the direction, and pulseaudio --version says 3.0.
If I paplay hello.wav, it hangs.
It worked before upgrading though. Any solution?
-
Pi B Rv 2.0 512MB
raspbian wheezy 2013-02-09
Posts: 5
Joined: Tue Feb 12, 2013 12:03 pm
by Aizenko » Thu Feb 14, 2013 10:46 am
Hi,

I have a RPi with mpd configured to stream rtp and to output localy as well but there is at least one second delay between the stream and what's played localy.

Code: Select all
audio_output {
    type            "pulse"
    name            "Pulsaudio RTP"
    sink            "rtp"
}

audio_output {
    type            "pulse"
    name            "Pulseaudio sound card"
    sink            "alsa_output.platform-bcm2835_AUD0.0.analog-stereo"
}


I think that what is played in the alsa sink is not rtp synchronised, is there a way to play locally the rtp stream?
Posts: 16
Joined: Thu Aug 02, 2012 10:18 am
by perplu » Sun Feb 24, 2013 4:37 am
Have put all the test information below only as additional context. TEST 3 below is a working solution for synchronised music play-back to multiple audio devices running Squeezelite.

The only issue noted is that the volume is much quieter in TEST 3 than in TEST 2. Don't quite know why this was. Will need to investigate. But - the solution seems to be use Squeezelite, Raspberry PI stuck on the back of powered speakers in each room of the house. The ony down-side is the Squeeze Server interface could do with a refresh - its a bit tired. Useful also is that there are two android apps that are OK for use as a remote control.

SETUP:
DS 109+
All music FLAC.

AIRPLAY TEST:
Three airplay receivers setup:
- Android 2.3 with AirBubble
- Shairport on Raspberry PI - http://jordanburgess.com/post/389864343 ... pi-airplay
- Windows 7 Laptop with Shairport4W

TEST 1:
Played to all from DS Audio.
No music played; Raspberry crashes.

TEST 2:
Played simultaneously to all from MusicBee with Remote Speakers Out add-in installed and all three airplay receivers selected.
Music played OK, but not in sync.

SQUEEZE-SERVER TEST:
Two squeeze receivers setup:
Squeezelite on Windows 7 Laptop.
Squeezelite on Raspberry PI viewtopic.php?f=38&t=25778 . Audio was out via Raspberry HDMI port to Onkyo receiver.

TEST 3:
Played same track simultaneously from DS NAS Squeeze and all in sync to both Squeeze receivers. Could also play to multiple audio devices the same track synchronised using either of two android apps on my smartphone running android 2.3.
Posts: 11
Joined: Sun Feb 24, 2013 4:30 am
by perplu » Sun Feb 24, 2013 8:05 am
Meant to also way in previous post:

At the moment my test was from RPi to HDMI on Onkyo receiver. I found these speakers which have a digital in - http://www.vanatoo.com/ I'm pretty sure you can get a connector that does HDMI to TOSLINK but I think these speakers also have a USB in as they have an internal DAC.
Posts: 11
Joined: Sun Feb 24, 2013 4:30 am
by MeMike » Thu Feb 28, 2013 10:57 pm
perplu, thanx for the comments on LMS/Squeezebox.
I abandoned my previous setup (MPD/PulseAudio) as rtp flooded the network. Your posts made me re-examine the project. With assistance from Gerrelt (squeezelite) http://www.raspberrypi.org/phpBB3/viewtopic.php?f=38&t=25778

I now have a working wireless system.

Thanx, and thanx to all the posters on this Forum.

Mike G.
Posts: 11
Joined: Sat Dec 15, 2012 3:13 am
by perplu » Mon Mar 11, 2013 7:25 am
The other thing I've just realised is that there are dozens of speakers out there with an HDMI-in. All the soundbars from Sony, Phillips, Panasonic etc. Some have wireless subs and some have not sub. The setup I plan to end up with is PC upstairs with SqueezeLite which is connected to upstairs amp and speakers; downstairs amp and speakers connected to RPI via HDMI, soundbar in kitchen above cupboards where you won't see it connected to PRI via HDMI and then somehow put a soundbar in the bathroom connected to RPI via HDMI. All in sync. Yay.

I have a Synology diskstation which has the latest DMS on it which while it plays the same track to multiple airplay devices the output is not always in sync. The only options to get them in sync is either Porthole software or Airfoil speakers - both of which means I'd either need to find a way to install them on the Synology NAS (linux) which I don't know how to port and do; or I need to set up a separate intel box alongside the NAS running Airfoil or Porthole - which I'm tempted to do and then I can just buy any airplay speakers and forget the whole rapsberry thing. Food for thought.
Posts: 11
Joined: Sun Feb 24, 2013 4:30 am
by billhelm » Thu Mar 28, 2013 11:11 pm
Hello all,

I'm pretty new to Linux, but I've managed to stumble my way through several tutorials in an attempt to get a multi-room audio system up an running. So far I'm running a Debian VM on ESXi. I followed the server tutorial here: http://fruit.je/mpd-rtp, and have an RTP stream up and running. I'm able to receive the stream with VLC on Windows PCs, which works great, and VLC on a pair of Pi's (using onboard sound and the latest version of Raspbian), which doesn't work terribly well. I'm hoping to get the Pi's to join the RTP stream using PulseAudio as the client. I've followed the steps listed by ianmacs, but have not been successful. When I reboot the Pi, I hear the speakers pop, and that's it. I've looked at the logs, but I'm not sure what to look for, and nothing really caught my eye other than. "raspberrypi pulseaudio[1792]: [pulseaudio] main.c: Daemon startup failed.". Does anyone have any suggestions regarding what I should be looking for?

Edit:
Problem: NTP had not yet fully synchronized
Solution: Added
Code: Select all
sleep 10

to the first line of /etc/default/pulseaudio

When using VLC as a client, I have to explicitly define a port on the receiver. Because of this, I have to either define a port on the server, or run a packet capture every time I want to listen to music. Is there no need to define a port when using PulseAudio as a client, and/or would having a port explicitly defined on the server cause a problem when using PulseAudio as a client?

Edit: Apparently no port has to be defined on the client.

Also, when I run

Code: Select all
alsamixer -c 0


I see:

Card: bcm2835 ALSA
Chip: Broadcom Mixer

When I press F6, enter device name, and type, "pulse", I see:

Cannot open mixer device 'pulse'.
Connection refused

I'm not sure if this is normal/expected behavior, or if it indicates part of my problem.

Edit:

This no longer happens. I suspect that it was happening because the pulseaudio service wasn't running before and I was too silly to check to see if it was.

I feel like I'm close to getting the Pi's to cooperate, but I'm clearly overlooking something, and I'm not sure what to check next. I'd appreciate any advice that anyone has to give.
Posts: 1
Joined: Thu Mar 28, 2013 10:30 pm
by ethernode » Mon Jan 20, 2014 3:00 pm
Hi Guys,

It seems that synced / synchronous audio playback is quite a hard problem; i suggest you take a look at the following gst based project called aurena: https://github.com/thaytan/aurena

In the following he explains why it's quite hard to have synchronous playback
http://gstconf.ubicast.tv/videos/my-gst ... bled-home/
Posts: 1
Joined: Mon Jan 20, 2014 2:56 pm
by gubbinz » Wed May 07, 2014 9:37 pm
Hi,

Thanks for the most informative posts you have got me a long way towards my goal. In my setup I am using a Pi as the audio server. My first attempt was to use the HTTP server built into MPD but after an initial test it seemed this would overload the server when I added more clients resulting in drop-outs. As such multicast seems the right solution.

I've followed your instructions but looking at the mpd logs in /var/log/mpd/mpd.log it seems pulseaudio is denying permission to the mpd application. I'm not get anything meaningful from pulseaudio is /var/log/syslog.

I have made sure that mpd is a member of the same groups pulse, audio.

What have I overlooked?

Gubbinz
Posts: 1
Joined: Wed May 07, 2014 9:21 pm