This method allows you to stream your iTunes audio from within iTunes to another computer on your network, preferably hooked up to your stereo. In my case, it´s an old laptop running Linux, hidden behind my stereo. Any flavour of *nix should do.
Here´s what you need:
First off, create a new session in Audio Hijack Pro named iTunes stream. Set the input to Application, and then iTunes. The format under the Recording tab should be AIFF(auto). Name the recordings with stream in their names. Make a note of the folder you plan to save your recordings to; I used a subfolder of my home folder named wifistream. To make this hint as useful as possible, you should also install Instant Hijack Session when prompted, to avoid restarting iTunes every time AHP starts the hijack session.
Then install the esound package. I used Fink and the accompanying Fink Commander; search for guides on how to use this if you are unfamiliar with it. There are tons of useful and free apps there!
Then for the actual scripts. We´ll start with the two AppleScripts. Name them as you like; mine are called Stream audio and Stop streaming. These scripts can just be pasted into Script Editor. Change the folder names so that they point to where you told AHP to save the recording.
This is the Stream audio script:
tell application "Finder"
delete every item of folder "wifistream" of folder ¬
"st" of folder "Users" of disk "Harddisk"
end tell
tell application "Audio Hijack Pro"
set visible of window 1 to false
start hijacking session named "iTunes stream"
start recording session named "iTunes stream"
end tell
tell application "iTunes"
play
end tell
set volume with output muted
do shell script "streamon &> /dev/null&"
And this is the Stop streaming script; again change the folder to the one you´re using.
tell application "Audio Hijack Pro"
set visible of window 1 to false
stop hijacking session named "iTunes stream"
stop recording session named "iTunes stream"
end tell
tell application "Finder"
delete every item of folder "wifistream" of folder ¬
"st" of folder "Users" of disk "Harddisk"
end tell
set volume without output muted
do shell script "streamoff &>/dev/null &"
Save these in your iTunes Scripts folder. If it´s not there, just create it. Next, on to the shell scripts. I´ve called them streamon and streamoff. If you change the names, be sure to change the AppleScripts accordingly.
#!/bin/bash
PATH=$PATH:/sw/bin
sleep 2
tail -f -b 500 /Users/st/wifistream/stream.aiff | esdcat -s 10.0.2.100:54546 &
Again, change the folder to point to your recording, and the IP address to the one of the remote machine. Take a note of the port number (the one after the IP address; in this case, 54546.#!/bin/bash
killall tail
killall esdcat
Paste these two into your favorite text editor, and save them as plain text in your home directory. Then, open up Terminal and issue this command:
sudo cp streamon streamoff /usr/bin
and then
sudo chmod +x /usr/bin/streamon /usr/bin/streamoff
OK, now we´re finished setting up your Mac. The only thing that´s left for us to do is to set up the remote machine. Assuming this already has esound installed (if it hasn´t, install it according to your Linux distribution), just issue theis command:
esd -tcp -public -port 54546 &
Replace the port with the one you used in the streamon script. The esound daemon can, of course, be started at boot up; refer do your Linux distribution's documentation on how to to this.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20061225104948547