Wednesday, April 22, 2009

Ustream, Soundflower, and iTunes

So, it turns out the version of Soundflower I was using has been superseded, and the newest (1.4.3 as of this writing) has some nice new features. One of these is the ability to tap the output directly, from a supplied GUI program, without the need to set up an extra bus in Logic the way I did in my previous article.

Let's say, for example, you want to send audio from your iTunes library up to Ustream. This is now easier than it was.

1. Download and install Soundflower (I'm testing with 1.4.3; look for the latest release here. You'll need to reboot, so bookmark this blog entry and come back when you're done.

2. Open up your Applications folder and look under utilities. You're looking for Audio MIDI Setup. You'll probably want to drag it to your dock.

3. While you're in the Applications folder, look for a folder called Soundflower. Open it up and drag Soundflowerbed to the dock as well.

4. Run Audio MIDI Setup. Change the Default Output (upper right in the window) to Soundflower (2ch). Think of the two-channel (stereo, left and right) Soundflower bus as a virtual set of two wires you can tap into. This setting means that everything the computer sends to the default audio output will go into these wires. You can also take a look at the properties for Soundflower (2ch) but the defaults are really already what you want: 44.1 KHz sample rate, 2ch-32bit (the only option), and
volumes all the way up (for now, at least).

5. Now launch Soundflowerbed. It doesn't appear to do much, but you will notice a little flower icon in your menu bar. Make two settings. Choose the Soundflower (2ch) submenu, go under buffer size, and set it to 64. Then change the built in routing for Soundflower (2ch) from None (OFF) to Built-in Output. What this means is that you are hooking up those two virtual "wires" to your computer's built-in output (on this laptop, the built-in speaker or headphones). By setting the buffer size the the smallest available, you are ensuring that the audio doesn't lag too much. If you hear stuttering or dropouts you will want to increase that buffer size, but assuming your system is reasonably fast and not doing a lot of other work, that size should be fine.

6. Now launch iTunes and get some music playing. Turn the output from iTunes all the way up (if it is too loud, turn down the speaker using the volume control in your menu bar). The reason for this is that you don't want the audio going into the bus to be attenuated; you want it to be full-scale.

7. Now go to ustream.tv, log in, and hit the "Broadcast Now" button to bring up the broadcast console. Of course, I'm assuming you have a show set up already; if you don't, you'll have to do that first. Set the broadcast audio source to Soundflower (2ch) and do whatever you like with the video (I'm leaving it off and turning off local monitoring). I also set the volume level on the console to 50% and tell it that I am using a mixer. I set the audio quality all the way up, to 44.1KHz. The Ustream interface has a few quirks with the way it redraws the chat room and user list, or fails to, so experiment.

And now you've got an internet radio show! Well, sort of. It's up to you to get some listeners, and up to you to provide some content. I hope this helps you get started. Let me know if you're doing it like this yourself, or if you find a better way. Note that there are other little tricks you can do -- if you use Soundflowerbed a lot, you can make it a startup item. See the README file that comes with it for more information.

UPDATE: you will need to be careful with the volume controls. Now that you have set the default audio output to the two-channel Soundflower bus, this means that your Mac's volume pop-up, in the menu bar, and the volume keys on your keyboard, if you have them, now control the SoundFlower output volume. That makes a certain amount of sense -- normally, if you are playing through an audio interface of some sort, you would want these controls to affect what you were actually listening to, not just the built-in speakers or headphone output. But unfortunately that means if you turn the volume down, your stream will become quieter. This is probably not what you want. (For something conceptually pretty simple, there are sure a lot of quirks to this process! It would be nice if this were fully configurable somewhere.)

To work around this, you can bring down your speaker or headphone monitoringvolume by using the Audio MIDI Setup application again, selecting properties for Built-in Output, and adjusting the volume down to about -24 dB (or whatever monitoring level seems reasonable to you). Make sure the input and output volumes for Soundflower (2ch) are all the way up; if not, your stream volume will be attenuated. Better to leave the digital signal at full scale, as long as you avoid digital clipping, so that you maintain your source's dynamic range, and let your audience members choose how loud they want it. Again, I think this is at about a 50% volume level on the Ustream broadcast console. At least, that is the level that seems to work well for me. But please correct me if you think there is a better way to achieve full volume without clipping.

11 comments:

teriobrien said...

Paul,
I'm trying to use Soundflower to control the audio levels of my show on Blog Talk Radio. My voice comes in through a land line, so that's not involved. Rather, it is the audio levels of the soundbites and and callers, who I control through an online switchboard. I usually use Firefox.

I'm not sure how to set it up. I have the latest version of Soundflower installed, and I get that it is a virtual audio device. So if I'm running my soundbites and calls through a web browser, do I just set the input and output in the Sound panel in Sys Prefs both to Soundflower and then be able to control the levels, sort of like it's a mixer?

Thanks for helping a poor waif.

Paul R. Potts said...

I'm not positive, but if I understand what you are doing correctly, I think you will want to control the levels using the level controls in the Audio MIDI Setup application (under Applications/Utilities).

lisa anne said...

How do you then turn this off, or do you not need to? What I mean is, when I am done broadcasting to Ustream, for instance, do I have to then change settings back? Thanks.

SnipingMizzy said...

I just tried this method and couldn't really find anything you were talking about in the Audio MIDI setup.
This is what it looks like: http://tinyurl.com/242k5po
Even after following the rest of the method, there was still no sound during the stream. =(

Paul R. Potts said...

Mizzy, the default audio setting is represented by the little speaker icon which in your image is on "built-in output." To change that put your mouse over Soundflower (2 ch) use control-click, or right click if you have a multi-button mouse, to bring up a contextual menu.

For what it is worth, though, I can't recommend using Soundflower at the moment, not until they have fixed some critical audio bugs.

Paul R. Potts said...

Or there is a iittle pop-up at the bottom of the window that will let you change it as well... huh, I didn't even know it was there : )

Paul R. Potts said...

See:

http://geeklikemetoo.blogspot.com/2009/05/soundflower-is-borked.html

Consider:

http://geeklikemetoo.blogspot.com/2009/08/deejaying-with-jack.html

Although I've also had a lot of complications using Jack (sigh). But at least the audio doesn't seem to just crash in the middle of a session.

SnipingMizzy said...

Thanks for the reply!

Yeah, I changed the Soundflower 2ch to being my default output, and I still couldn't get anything. I'll try your other recommendations though! Thanks! 8D

Jon said...

Awesome works a treat!

DoubleXeroSeven said...

I'm using traktor with soundflower and airfoil, and I was wondering if it were possible to send specific channels over airfoil so I can use channels 2 and 3 for my monitor output to another computer, and channels 0 and 1 for local audio playback through traktor.

Paul Potts said...

DoubleXeroSeven, I have not used Airfoil, so I have no idea. I have had to give up on Soundflower, too.