blog advertising is good for you


blog advertising is good for you
User login

Playing Live Audio on Another Mac

Getting back to our roots for a moment, here’s a nice little bit of geekery. You can use the built-in audio units AUNetSend and AUNetReceive to generate audio on one computer and have it play back on another computer. Moreover, these computers do not need to be on the same local network, and the created audio can be though any program from GarageBand to VLC to iTunes.

The short of it is that you need to capture the audio from the computer playing it and pipe that in to the AUNetSend audio unit. On the other end, you’ll need to tell AUNetReceive to use the audio from that other computer. That’s how this works. Now, getting these two audio units going is a whole other problem.

Audio units are plugins for Core Audio, and as such they’ll need a Core Audio program to play host to them so they can work their magic. AUNetReceive, in particular, is a Generator Unit and needs a program that has explicit support for it. You can use GarageBand, Logic, or even Audio Hijack to use these audio units, but all of those cost some amount of money. If you have them, you can try to use ‘em. If not, and if you’ve been a Mac Geekery reader for any amount of time, then you should have the Developer Tools installed and have a program called AU Lab at /Developer/Applications/Audio. This is going to be your new friend, and I’ll step through the process with this program since it’s the lowest-common-denominator in this arena.

Setup the Sender

You’re going to need Soundflower installed for this so that AU Lab can capture the audio from a program as the Built-In Output option does not allow for capturing. Once installed, go to your Sound preference pane and in the Output tab pick the two-channel option (unless you have a specific need for more channels, which is to say you’re doing something more than this article goes into).

200612141638

You should probably also get something playing in iTunes now so that you’ll know later on when things are working.

Create a New Document in AU Lab

Once you start AU Lab you’ll get a little new document assistant. Ensure you’ve chosen the same Soundflower device as you used earlier (probably the two-channel one).

Now click on Inputs and then click on Add Input so that your screen looks like the one below. Hit OK.

200612141643

Setup AUNetSend

200612141636

When the document comes up, you should have the two channels pictured at the right. In the left channel, Audio Device, you need to click on that triangle under Effects and pick AUNetSend from the list. Once you do this, you should get a panel like the one below.

200612141634

Go ahead and change the name so you know it’s working on the other side (more of a mental check than technical).

Back on the channels list, make sure you hit the mute button on the Master Out channel so you don’t create a feedback loop. If you don’t, you’ll regret it later.

Setup AUNetReceive

200612141637

On the receiving computer, start AU Lab and accept the defaults for a new document. In the Edit menu, pick Add Audio Unit Generator… and select AUNetReceive from the list.

200612141642

You should see the channel added to the list (as depicted in the graphic to the right) and you should get a configuration window asking which stream to use as a source. Ensure your volume is at a good level, the Master Out channel is muted on the source, and then pick the source you named last time and hit Select Host. The stream should play instantly.

200612141637

Repeating This Trick

Now for a fun trick. On both machines, save the documents somewhere on the machines and then drag the proxy icons to their respective Docks. Quit AU Lab on both machines and pause a little bit, then open up the documents again. It should automatically start the process for you. Now, add this in to the Startup Items for the receiving unit and any time the sending unit starts sending, it will start playing.

You have now turned your Mac into an expensive AirPort Express. Congratulations.

Actually, it’s even better, because this one will work with more than iTunes. It’ll work for any program you use on your Mac. It gets even better when paired with (or used within) Audio Hijack as you can then capture a select program’s audio and reroute that to another computer entirely (put iTunes on the home media server, but get error beeps locally).

Variations on This Trick

  • Select one of the lower encoding rates and then on the remote machine hit the + button when picking a host for AUNetReceive and you can pick any computer on the Internet. This is also a good time to use the password feature.
  • Use this to stream DVD audio to a computer with a better set of speakers than your portable, and then run around the house watching the video and hearing the audio. It may be a little out of sync, but at lower bit rates it shouldn’t be too much. Toy with the buffer size if you see a problem.
  • Create an audio server at home with iTunes playing Party Shuffle and then subscribe to it from anywhere, even remotely. Be sure to lower the bit rate to fit your Internet connection’s uplink speed.

About the Codecs

When you’re using this over a slow link, you’ll need to be aware of the properties of the various codecs in the AUNetSend menu. Here’s a breakdown of what the effective data rates are for these codecs. These were determined by playing the same song (in stereo) using Activity Monitor’s throughput rating while using each codec for at least five seconds to let it settle down.

Codec KB/s
32-bit floating point PCM 380
24-bit integer PCM 292
16-bit integer PCM 195
24-bit Apple Lossless 158
16-bit Apple Lossless 66
μ-Law 110
IMA 4:1 75
AAC 128 251
AAC 96 251
AAC 80 251
AAC 64 251
AAC 48 251
AAC 32 251

1 Unlikely, I know, but that’s what it is. I didn’t hear a quality difference on the other end, either.

Average rating
(1 vote)
About Adam Knight
Adam Knight's picture

Author Biography

Adam Knight is one of the founders of Mac Geekery and is a geek at heart. Programmer by day, hacker by night, his daily life revolves around the Macintosh platform, which he has been a user and programmer for since the early days of System 7 when his LCII replaced his Apple //c.

In-between tech jobs, he’s managed to learn the basics of any web hacker: PHP, MySQL, Perl, Apache, Linux, *BSD, and the intricacies of ./configure —prefix=~/bombshelter/. Today, codepoet is concentrating on blogging again, writing some software for the Mac by himself (including Notae) and for his company (such as Switchblade) and has a few other toys coming out soon.

Bug him over AIM or email [link fixed].

Thanks for the amazing tip. I was looking for a way to play music from my MBP to a yet to be bought Mac Mini. This is just the type of thing I need. In combination with the Trends Audio UD-10 (www.tnt-audio.com/sorgenti/trendsaudio_ud10_e.html) one of the best audio sources imaginable.

Thanks for this tip. Saved a whole lot of hassle trying to run Garage Band on a laptop, but stream the audio to my stereo (via my powerbook music server). Thanks!

any ideas to use a windows machine as the server part? I m trying to find a way to stream from my macbook to my windows box..

thks

Do you know any way of delaying the audio… so I can play it like 10 or 30 seconds later

thanks

Paul Galvez

Post new comment
The content of this field is kept private and will not be shown publicly.
20 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.