Multi Room Audio - Pine style
#1
Greetings,

Hopefully this will shorten the learning curve for someone.  If not, at least I can search the forum for my own post at some point if I have a disaster.

Setting up multi room audio with multiple pine devices.  Want to play internet radio, a small audio library, and Spotify through the house.

The journey starts with Volumio - distros are available for most of our devices. The Volumio forum has the latest links.  gkkpch has done a lot of work.  I need to buy him a beer.  You do too.  

Rock64:  https://volumio.org/forum/volumio-rock64-t9467.html
Pine64/LTS-SOPINE:  https://volumio.org/forum/volumio-pine64...t9465.html

Burned these onto their respective flash cards.  Decided to have a Rock64 as the server and a Pine64 as the client.  

Initial install was pretty straight foward.  There is a guided setup for the software through the web interface once you launch.  

Now you have two media boxes.  They show up together in Volumio but they play different streams.  To connect the boxes together you need a way to synch the audio.  I choose Snapcast.  You need to install both the Snapcast application and the Volumio Snapcast plugin for command and control.

At the time of writing the latest version was here:
https://github.com/badaix/snapcast/releases/tag/v0.15.0

You will need the client and the server.  The server will need to install both but for the client . . . only the client.

Grab the arm versions (armhf).  Get them to your pines in the manner you see fit.  To install:

sudo dpkg -i snapclient_0.15.0_armhf.deb
sudo dpkg -i snapserver_0.15.0_armhf.deb
sudo apt-get -f install

The Snapcast app and overview is described on Github:  https://github.com/badaix/snapcast  

Now you need the plugin.  As it is not an official Volumio plug in you need to load it manually.  Instructions are here: https://github.com/Saiyato/volumio-snapcast-plugin.  In short:

git clone https://github.com/Saiyato/volumio-snapcast-plugin.git
cd volumio-snapcast-plugin/
rm volumio-snapcast-plugin.zip

Now . . . there is currently an issue.  It may be fixed but you need to put in one more command before the plugin install.

npm i

Then:

volumio plugin install

On the server, go to the snapcast plugin.  Enable the server, pick any sample rate that you want as long as it is 44,100Hz, 16 bits, 2 channels.  For both the server and client enable the client.  Server's host should be local while client's host should be server.  (Duh)  Pick the right sound port.  Especially if it's 2am and you're pulling your hair out.  MPD choose the same sample rate, bit depth, all that everywhere.  For the server select FIFO only.  For the client select ALSA.

Spotify Integration.  (Still in the Snapcast Plugin.)  I used no dedicated stream - and the spotify web connect.  The sample rate, bit depth, channels should be the same for server and client and mpd.  Don't dinker with Librespot.

Leave the rest of the stuff alone if you value your sanity.

Reboot your devices for good measure. 

To test your masterpiece try this on the server:

sudo cat /dev/urandom > /tmp/snapfifo

Dumps white noise out your speakers.  All your stations should start and end at the same time.  If not . . . problems.  You should hear a delay.

Next see if you can play a webradio from server to client.  Does it sound good?  Nice.  Do you want Spotify too?  Probalby not working yet.

What I did that works:

On the server go to /data/plugins/music_service/volspotconnect2 and find the volspotconnect2.tmpl file.

Replace the one meaningful line in the file with the below:
./librespot -b 320  -c /tmp ${shared} ${normalvolume} --name '${devicename}' --backend pipe --device /tmp/snapfifo --disable-audio-cache --initial-volume ${initvol}

Save.  Go to the Spotify plug in, make a change, and save.  This will burn a new startconnect.sh file with your changes.  The original version had the backend as alsa and the output device as a local device.  So the music only played to the server's device.

Try Spotify.  Cross your fingers real hard.  Open your Spotify client, find your server under "connect to device" and play some nice tune.

If you have done everything right you will get beautiful music out of all your speakers.  If you have not lived life on the straight and narrow bad stuff will happen.  Now it's time to swear a bit and figure out what went wrong.


Gotchas / notes
The default sample rate of 48kHz and 16 bits works just fine for web radio.  For Spotify it sucks out loud.  The audio is higher pitched and warbles.  It's a sampling rate problem between the Spotify stream and the resampling.  (I read this somewhere, maybe I will find it again some day.)  There might be another way around it, but just be sure everything matches up and you should be fine.

If there is a volumio update and you want to upgrade - you can do it through the app but you need to go enable "test" softare.  Go to your volumio box url and add "/dev" after the address.  Push the right button.  Turning on SSH while you're there probably is smart.

The Rock64 Volumio build does not support the rtl8812au based wifi adapter sold in the Pine store.  There has been discussion on this but it still is not there.  I tried cheating a bit to build a driver but not all the bits were in the load to make that happen.  Left this for another day.

---
Bonus Round!  Making a Rock64 Ubuntu Bionic Client

This is pretty easy as well.  Grab the 64 bit version of your choice from ayufan's git.  Burn it to a memory thingie and start the silly thing up.

EvilBunny has done the WiFi driver work for you.  Grab the file, load it, be sure you've got python installed.  (sudo apt install python)

sudo dpkg -i drivernameofyourchoice.deb

sudo depmod
sudo modprobe 8812au

Configuring WiFi - you're on your own.  

There is no arm64 bit Snapcast on Git, you you need to build your own.  Luckily there are step by step instructions on the site.  
https://github.com/badaix/snapcast/blob/...nux-native

The instructions work. Start at the top then follow the Debian instructions.  The build runs on one core so it takes a bit.

Repeat the dpkg stuff from above and . . .

Craft the command for the snapcast client.  Check the plug names with aplay -l and choose which one you want to use.  (You should be able to have more than one client running but my testing has ended poorly on that front.  More work to be done there.) 

The client command documentation is a little light.  "snapclient --help" gives you the basics.  I used the following with a static internal IP address as the server.

sudo snapclient -s I2S -h 192.qq.yy.xx -d --user snapclient:audio

This will automagically run at startup.  I haven't figured out how to kill it actually . . . but that's for another day (and more edits).

---

Yeah I should still do some more experimenting and close the loop with some folks.  But for now I'm going to take a break from pulling my hair out and enjoy the sweet sound of success.  

I will maintain this post based upon learnings, feedback is appreciated and welcomed.  

Best Regards,


Matthew
#2
(09-05-2018, 10:38 AM)mjgoode Wrote: The Rock64 Volumio build does not support the rtl8812au based wifi adapter sold in the Pine store.  There has been discussion on this but it still is not there.  I tried cheating a bit to build a driver but not all the bits were in the load to make that happen.  Left this for another day.



I made a dkms deb package for this driver, basically there is only 1 802.11ac drivers in the kernel, for the ath10k.

https://files.evilbunny.org/rtl8812au-dk...-4_all.deb
#3
(09-05-2018, 04:59 PM)evilbunny Wrote:
(09-05-2018, 10:38 AM)mjgoode Wrote: The Rock64 Volumio build does not support the rtl8812au based wifi adapter sold in the Pine store.  There has been discussion on this but it still is not there.  I tried cheating a bit to build a driver but not all the bits were in the load to make that happen.  Left this for another day.



I made a dkms deb package for this driver, basically there is only 1 802.11ac drivers in the kernel, for the ath10k.

https://files.evilbunny.org/rtl8812au-dk...-4_all.deb

Indeed.  I saw the repository in this thread.

https://forum.pine64.org/showthread.php?...&pid=35780

Tried to make it work with volumio but the kernel source is not present in the image. 

However I'm building a bionic based client.  And I was able to successfully use the driver above to make wireless magic happen.  So thank you for that!

But . . . there is always a but . . . I still need to get Snapcast built on bionic.  The available server and client are for 32 bit.  So it seems I'm building something from scratch . . . the question is merely what software.

Back to cussing.  Once I get this working will update the above.

Thanks again,


Matthew
#4
(09-05-2018, 04:59 PM)evilbunny Wrote:
(09-05-2018, 10:38 AM)mjgoode Wrote: The Rock64 Volumio build does not support the rtl8812au based wifi adapter sold in the Pine store.  There has been discussion on this but it still is not there.  I tried cheating a bit to build a driver but not all the bits were in the load to make that happen.  Left this for another day.



I made a dkms deb package for this driver, basically there is only 1 802.11ac drivers in the kernel, for the ath10k.

https://files.evilbunny.org/rtl8812au-dk...-4_all.deb

I made a note of this and will add it when I build the next version.

Cheers - Gé
#5
(09-13-2018, 04:46 AM)gkkpch Wrote:
(09-05-2018, 04:59 PM)evilbunny Wrote:
(09-05-2018, 10:38 AM)mjgoode Wrote: The Rock64 Volumio build does not support the rtl8812au based wifi adapter sold in the Pine store.  There has been discussion on this but it still is not there.  I tried cheating a bit to build a driver but not all the bits were in the load to make that happen.  Left this for another day.



I made a dkms deb package for this driver, basically there is only 1 802.11ac drivers in the kernel, for the ath10k.

https://files.evilbunny.org/rtl8812au-dk...-4_all.deb

I made a note of this and will add it when I build the next version.

Cheers - Gé

Sweet.  Thank you.


Possibly Related Threads…
Thread Author Replies Views Last Post
  pine store paulhide 1 3,115 09-17-2020, 04:13 AM
Last Post: bcnaz
  My optimal software configuration for pine A64(+) 2Gb Alkemyboy 3 4,508 03-18-2020, 08:41 AM
Last Post: tophneal
  Pine HDMI -> DVI monitor Pineapple 4 7,641 09-10-2019, 11:28 AM
Last Post: Pineapple
  PINE A64+ 4K Media Computer RWL 4 6,779 11-08-2018, 04:20 PM
Last Post: mindwave
  Pine 64 LTS Schematic And R18 Reference Manual Akash Gajjar 2 5,176 12-26-2017, 07:01 PM
Last Post: tllim
  [PINE A64+ 2GB] Ubuntu - Losing Signal Arlanps 4 6,068 02-12-2017, 05:12 PM
Last Post: Arlanps
  Applying a fan for the Pine 64+? Maximum 5 9,391 01-20-2017, 03:34 PM
Last Post: Shad0wSt4R
  Using Pine cluster for Docker Swarm jpnh 1 3,748 11-22-2016, 07:11 AM
Last Post: jpnh
  Which command line only OS? For streaming audio zirconx 5 6,181 09-27-2016, 06:53 AM
Last Post: zirconx
  Pine 64 IR Receiver not working rajatgarg21 1 3,140 08-31-2016, 12:47 AM
Last Post: MarkHaysHarris777

Forum Jump:


Users browsing this thread: 1 Guest(s)