Airtunes
From CLUG Wiki
Sending audio to Apple's Airtunes from Linux
Thanks to Jon Lech Johansen (better known as 'dvd jon'), one can now stream PCM audio to Apple's 'Airport Express' from any platform able to execute .Net assemblies. All you need is 'JustePort.exe' and a .Net runtime. Here's how.
For Linux, download and install mono and the various decoders.
$ sudo apt-get install mono mpg123 vorbis-tools faad
Get JustePort.exe from Jon's site
* JustePort binary
JustePort sends PCM to Airtunes, so in order to play MPEG, Ogg or AAC files, you need to decode them with an appropriate decoder, and attach it to JustePort's stdin. Here is an example for a MP3 encoded file:
$ mpg123 -s "Francoise Hardy - The Rose.mp3" | mono JustePort.exe - 10.0.1.1 0
I wrote a script that automatically choses the appropriate decoder for a given file, and attaches it to JustePort. I'm new to bash scripting, so this is probably not the best implementation, but it does work. It may be completely unecessary too, because I'm sure mplayer can decode anything to PCM and write it to stdout. Please email comments and improvements to me. Anyway, here it is. Put this in /usr/local/bin/airtunes and make it executable:
$ sudo vi /usr/local/bin/airtunes
then paste this into it:
#!/bin/bash
# airtunes
# Invokes the correct decoder for the given filetype, and streams PCM audio to Airtunes using JustePort
# Usage: airtunes [filename]
IP=10.0.1.1
VOLUME=0
JUSTEPORT=/bin/JustePort.exe
if [ `file -b "$*" | cut -c-4` = "MPEG" -o `file -b "$*" | cut -c-3` = "MP3" ] ; then
mpg123 -s "$*" | mono $JUSTEPORT - $IP $VOLUME ;
else
if [ `file -b "$*" | cut -c-3` = "Ogg" ] ; then
oggdec -Q -R -o - "$*" | mono $JUSTPORTE - $IP $VOLUME ;
else
if [ `file -b "$*" | cut -c-3` = "ISO" ] ; then
faad -q -w -f 2 "$*" | mono $JUSTEPORT - $IP $VOLUME ;
else
echo "Don't know how to handle this filetype, giving up."
exit 0 ;
fi
fi
fi
Make it executable:
$ sudo chmod +x /usr/local/bin/airtunes
Lastly, change the JUSTEPORT variable to wherever you put JustePort.exe.
