Tuesday, 5 May 2015

Streaming music via Airplay from Ubuntu to Pioneer VSX-922



So after numerous complaints from my wife that the music setup in our house is not user friendly for her and she can only listen to ad-hoc music from the laptop (as a iPod have a playlist synced to it) I did some research and surprisingly found that pulseaudio had a Airplay module (raop)
The Pioneer amp needed UDP and not TCP streaming as per the native module, so I had to compile and create a icon on the desktop to "click and then listen to music"
That approach is sort of user friendly (still a few clicks to swop between the two pulseaudio versions but it works) next step is to fully automate it.
Installation: 
The complete installation instructions can be found here : http://hfujita.github.io/pulseaudio-raop2/

But the steps are summarised below:


sudo apt-get install build-essential paprefs git pulseaudio-module-raop intltool
sudo apt-get build-dep pulseaudio 
git clone https://github.com/hfujita/pulseaudio-raop2.git
cd pulseaudio-raop2
 ./autogen.sh
  CFLAGS="-ggdb3 -O0" LDFLAGS="-ggdb3" ./configure --prefix=$HOME --enable-x11 --disable-hal-compat
  make  

Thenyou need to configure it to discover AirPlay devices on the network

paprefs &

In the Network Access tab, turn on Make discoverable Apple AirTunes sound devices available locally


Then I wrote a little bash script named "music on amp" with a popup instructing her what to do next.

So currently it is a "guided automation" but it works.

Desktop icon: (music_on_amp.desktop)

[Desktop Entry]
Encoding=UTF-8
Name=Airplay
Comment=Play music to Airplay enabled devices
Exec=/home/user/listen_on_Pioneer.sh
Icon=/home/user/Pictures/airplay.png
Type=Application
Name[en_GB]=Music on AMP

Bash script: (listen_on_pioneer.sh)
#!/bin/bash
# source installed from http://hfujita.github.io/pulseaudio-raop2/
# kill the running pulseaudio
pulseaudio -k
cd ~/pulseaudio-raop2
./src/pulseaudio -n -F src/default.pa -p $(pwd)/src/ &
zenity --info --text 'Dear wife, Please select VSX-922 on next box that will pop up and close' unity-control-center sound
notify-send "Now open Amarok & Enjoy your music my love ..."

I have added a icon & script to change the music back to the laptop (as the Pioneer kept on changing to media source when the laptop send a notification or played music)

Bash script: (listen_on_pc.sh)
#!/bin/bash # kill the running pulseaudio pulseaudio -k
pulseaudio -D # to list the sink # pacmd list-sinks | grep -e 'name:' -e 'index' pacmd set-default-sink 1 pulseaudio -D notify-send "Music will play on PC."

this will kill and start the original pulseaudio and set the source (sink) to the in build speakers.


No comments:

Post a Comment