How to: AirTunes without AirPort
This how-to describes how to set up a linux (or mac or even windows) machine to serve as a sound client for your mac so that it will play any sound from your mac over network. For example you can sit on the couch with your MacBook on your lap and don’t have to shredder your music with these tiny internal speakers. Or, you could play music in your living room from the mac in your office. Apple calls this functionality AirTunes and sells it with its AirPort or TimeCapsule products.
Wonderful world? Almost. What you will need:
- Joy on fixing computers
- A linux box or a mac that is connected to the speakers. E.g. your stereo.
It should potentially be able to run forever so you don’t have to turn it on every time you want to use your speakers. If you already have an existing set-top-box for your TV running linux (e.g. the Reelbox or any other VDR) you can of course use this! I’m using an VIA EPIA Mini-ITX board with fanless cooling. You could also use a windows machine with cygwin on it.
No matter how this machine is shaped, I will reference to it as the client from now on (because it receives the sound stream).
- Some kind of network connection between the mac (we call it the server here) and the client.
Most likely this connection is wireless through your router.
If you would have to buy an extra router for this purpose anyways, think about spending the money on an Apple AirPort and have it working out of the box. But, on the other hand if you already meet the four prerequisites, then you can save at least a hundret bucks!
0. Before you start:
- Have an OS running on the client. Installing Linux or cywing is a chapter that cannot be covered here.
- Make sure you have a working network connection between server and client. This too, is another chapter for itself.
- Connect the stereo or other speakers to the client. (this is important for testing)
A. Setting up the client-side (receives sound)
We need to get sound out of it and the Enlightment Sound Deamon (esd) working.
Important: I assume a debian system here. If you use another distro, you should know what to do there.
- See if you have it already installed. Type
# esd -tcp -publicin the promt. If it starts and makes a funky sound, you’re half way there! Continue with B. Setting up the server side
If not, install it with
# apt-get install esoundand try the above again. If it still doesn’t work, do the following.
- To get your soundcard working, it’s easiest to use ALSA (established and works with most cards). To do so, install alsa-base and alsa-utils with
# apt-get install alsa-base and
# apt-get install alsa-utilsresepctively. Restart. Then configure your soundcard with
# alsaconf. This assistant should find your soundcard and configure it for you. Then try 1 again.
If not, see section C. for Troubleshooting.
- Download Soundflower 1.3.1 from my webspace soundflower-131 or from MacUpdate
The developers homepage (cycling74) only has an older version.
After installation, go to your System Preferences and choose the Soundflower driver as your default output device and as your default input(!) device (and if you like, as default system sound device). What it does is to forward the sound (from the output) to the Soundflower driver (to the input) so we can access it with ESD.
- Next, we have to install ESD. For this, we need MacPorts. If you already have it installed, jump to the next step. If not, don’t hesitate to install it! You might need it for other purposes in future anyways. You can get it from here: macports.org.
Optional: After installing, you might want to add
/opt/local/binto your PATH. See my other post how to do this properly.
- Now install the esd via macports by typing
# sudo /opt/local/bin/port install esound
- Almost done! Run the esd and stream it’s input to the client by doing (not as root):
# esd -tcp -bind ::1 &(makes it listen to your computers ipv6 stream, “&” starts it in background)
Hit return twice to get the promt (Apple Terminal specific thing…) and pipe the input to the streamer with
# (esdrec -s ::1 | esdcat -s <client-ip>) &
- When trying to start esd you get
error /dev/dsp not found.
? Have you installed alsa-base? Run alsa-conf again. It’s neccessary to restart afterwards!
- alsaconf doesn’t find your soundcard.
? If it’s an onboard soundcard, make sure it’s enabled in the BIOS!
- Both ESDs run but no sound.
? Stereo on? Stereo’s volume up? iTunes’ volume up? Song is not playing its last seconds?
? Does the client make a funky sound when starting ESD? This is essential. If not, make your soundcard work with ALSA.
? Can you ping the client IP?
? Is there a firewall somewhere inbetween? Make sure you can send on TCP port 16001
? Make sure you have started esd on the client first and then on the mac.
? Do not start esd as root! Do it as the user you’re logged in as (default).
? I had some trouble with background processes before. Try
# esd -tcp -bind ::1then open another Terminal window and type
# esdrec -s ::1 | esdcat -s <client-ip>
? Both processes on the mac and the process on the client should not quit. Test this by not appending the & sign to the command. If one of them quits immediately you found the problem. Try restarting the client and deleting the ~/.esd_auth files on the client and do it all again in the right order.
- Some useful links
Similar tutorial: Mac OS X hints
ALSA official WIKI: alsa-project.org
S.o. who had ALSA trouble: nicktips.blogspot.org
ALSA sound mini How-To: ALSA sound howto
Official EsounD Manual: http://www.tux.org/~ricdude
Debian Packages. You might find something useful for tests here: packages.debian.org
- Startup script on client. Again, I assume a debian system here.
/etc/esound/esd.confto look like this esd.conf. Important is to set the
Warning: This config makes esd listen for any incoming stream. Replace
-bind <server-ip>to make it listen only to your mac!
Then extract this startup script Esound (for init) to
/etc/init.d/and make proper symlinks by running
update-rc.d Esound defaults. That’s it. On next boot, esd should start automatically. If you ever need to start it by hand you can simply do
- Startup script on the server. This is still beta and not working 100% reliable. If you made any progress here, I would be thankful to hear from you.
Download this startup script: Esound for mac and extract it to
/Users/SharedThen set it to be executed at login by typing:
sudo defaults write com.apple.loginwindow LoginHook /Users/Shared/Esound
Hint: Give the ESD some time to respawn after waking up your mac from sleep.
If the whole machinery doesn’t work after wakeup or reastart, you probably have to restart the deamon on the client. To do this, find out it’s PID with
ps aux | grep esdand
killit. Then restart it with
esd &. Next, on the server side kill it the same way and restart streaming by doubleclicking on the
/Users/Shares/Esoundscript. Any suggestions are welcome!