Playing audio in the living room with no fuss
I have an old iPhone connected to my home stereo. On this I have installed Airfoil speakers to be able to stream sound to my stereo wirelessly from anywhere in the apartment.
It is quite the nuisance to open Airfoil, select the program, select the living room speakers and if playing video making sure its sound is being output 2 seconds in advance to achieve audio sync.
Wouldn’t it be nice to just launch a script that does everything for you? It would need to be flexible to account for all different applications I might want to connect.
I decided to make a backbone library with common functions and then add a front end script for each application that might want to connect.
For me these app were:
Contains functionality to open and select target and source.
Please do comment if you spot something that can be made better/more fool proof.
This works every time on my machine, this might not be so on all systems.
When connecting an application that handles video there is a need to make sure that audio is ahead by 2 seconds since there is a 2 second buffer delay built into Airfoil.
This is, for me, done when hooking up VLC or MPlayerX. XBMC is preconfigured to always delay -2 seconds. This is how I did that for VLC.
After starting the movie I launch this script, in my case with the best tool in the world i.e Quicksilver. It connects to all my available speakers and activates VLC. After that it sends the keystroke “f” to VLC 40 times in order to make the audio delay -2 seconds.
Thoughts on this is appreciated, especially the first two lines. That could be prettier.
The library now also contains routines to connect to password protected speakers this is reflected in the PDF of the library above.
Here it is at work. Quick, painless.
It gets to be even more of a time saver in MPlayerX where I can’t use keyboard to introduce the delay because I use a Swedish keyboard layout.
I would then have to go through menus 20 times… not fun! With the script… it clicks the menues the 20 times needed in about 1 second. Ahhhh….