I Stream, UStream, We All Stream

05 Apr 2009

Original Blogger tags: Deejaying, Music, ustream.tv, Performing Live, Twitter

So, this weekend I figured out how to do a live broadcast via ustream.tv that is a little bit more sophisticated than just turning on my webcam and playing my guitar in front of it.

What I wanted was to avoid relying on the single mono microphone built in to the iSight webcam I’m using, keeping in mind that even though it is sounds pretty decent, the ideal place to put a microphone is not necessarily the same as the ideal place to put a camera. What I wanted was the ability to fully mix live audio sources, and that’s mostly what I got.

If you haven’t seen UStream, it’s a really cool site that allows you to follow live streaming audio and/or video from any of a bazillion live contributors at any given time, and makes it easy to set up you own streaming upload. It provides a very nice Java application which, on my Mac, worked very seamlessly with either my wife’s laptop with built-in iSight camera (which it considers a USB camera) or one of the discontinued iSight cameras I picked up recently. The Java application looks like this:

Let me point out a few key features. First, there is the webcam image. You can view either the local image or the one coming back down from the server. The broadcast console has some amazing features: can set set the image quality along a whole range of values, which corresponds to the level of pixelation (how grainy the image is). You can set the frame rate down as low as one frame per second. If you have a slow connection, or if as in my case you want to crank up the audio quality and don’t care much about the video quality, you can tweak it just the way you like it. The audio quality can be set from CD quality (44.1 KHz) down to phone quality or less (5 KHz).

Note also that you can choose to stream video, audio, or both. So, if you want to set up your own internet radio station, there you go.

There’s only one minor problem: the console application is designed to work with a webcam. You can tell it what audio and video source to use, but if, for example, you want to send audio from iTunes into your stream, you can’t, because iTunes, or the system audio, does not show up as a source. And what if you want to play DJ and mix the camera audio over the iTunes audio, or use a separate microphone, or, like me, play guitar into an audio interface and sing on another microphone into the audio interface? You can’t.

Note that the following instructions apply only to Macs; there are presumably similar situations for Windows or Linux on PC hardware, but I have not investigated them.

What you need to do is set up another audio bus — a virtual bus. The ticket here is a free application from Cycling ’74 called Soundflower (Google for it). This will give you two new audio devices, both of which are virtual (they have no hardware associated with them). One is a two-channel bus and one is 16-channel bus. This virtual device can be set up to 96KHz and uses 32-bit samples, so you won’t lose audio quality needlessly by passing 16-bit or 24-bit audio through it.

Now, what I really wanted to do was to allow Logic Pro to work with one big audio device. I wanted to use the audio inputs on my Apogee Ensemble for guitar, microphone, and CD player, and the audio outputs for headphones and speakers for monitoring, but I _also_ wanted to use the SoundFlower two-channel device as a way to send exactly what I wanted, all mixed together, to my audio stream. Logic and CoreAudio only work with one device at a time, so this seems impossible.

Apple’s solution is to create something called an Aggregate Device. If you run the Audio Midi Setup utility, in the Audio menu you’ll see a command called “Open Aggregate Device Editor.” You can then create a mash-up of audio devices. In this case, a real hardware device and a virtual device can all be combined. We’re using 8 inputs and outputs on the Ensemble, which include four mic preamps, two of which can be used to plug in guitars directly. The two virtual channels from Soundflower are 9 and 10. The aggregate device looks like this in the editor:

So, there’s my virtual device. Now Logic can use it; you have to do a little tweaking in Preferences/Audio, but wham, it was pretty simple. And now I can set up my devices.

The way I did it was to configure channel 1 as a guitar input, set up with virtual effects. Channel 4 is my vocal mic, configured with more virtual effects. Channels 7 and 8 are wired to the combo CD/tape player in my rack, so I wanted to be able to use that as an input source as well. Outputs 1 and 2 are the Apogee headphone outputs. Outputs 7 and 8 are the Apogee outputs to some monitor speakers, although to avoid feedback and strange delay issues I generally just listen to headphones.

Now things get a little stranger: inputs 9 and 10 correspond to the 2-channel virtual SoundFlower device, and outputs 9 and 10 represent the outgoing stream.

So, I have lots of options. In Logic, I created a virtual mixer to help me keep this all straight:

Let me try to give you a quick tour of that mixer. From left to right, channel 1 get input 1, which is my guitar, and the inserts are guitar effects. Instead of setting it up with a fixed output, I configured two aux busses, 1 and 2. Bus 1 represents my headphone monitoring. Bus 2 represents the outgoing stream. So the mixer is currently set up to feed the guitar, mic, and CD/tape deck into my headphones.

The fourth channel strip from the left is interesting. Its purpose in life is to allow me to feed the output of iTunes into Logic and mix it in to my headphones as well. For this purpose it has as its input channels 9 and 10, which is the Soundflower virtual bus. It has a send to the headphone bus, but no send to the Soundflower output. The reason for this is that I don’t want iTunes audio to be going into the stream twice, with different latencies. I am not sure what might happen there but it looked like it could get ugly, so I thought it best to avoid that situation.

One last thing: iTunes does not have a configurable output; I can’t tell it to play on a particular audio device and channel. Instead, it always plays on the default output. So if I want it to feed audio to SoundFlower, that means I have to set the default output to Soundflower, using the Audio MIDI Setup application. I left the system output to 1 and 2 on the Ensemble so that any beeps or what-not produced by my Mac did not wind up on the stream.

If you decide to play audio from iTunes into your UStream show, keep in mind that the 50% mark on the volume control on the Ustream console seems to be digital full scale or 0 dB, when the iTunes volume control is all the way up. This seems to give you the fullest range of volumes. If you go any higher than that you will likely get digital clipping, which sounds very nasty. Experiment with boosting the sources you feed into Soundflower up by adding gain or compression, rather than pushing the final volume past 50%.

Note that you don’t have to use Logic; you could use MainStage, or if you want a lighter-weight setup, I think you could probably do most or all of what I’m doing using the wonderful Audio Hijack Pro. And you don’t need an Apogee Ensemble; I have one for doing recording with its nice-sounding preamps and low noise, but for live use a much less expensive audio interface would be nearly indistinguishable. You could try the Duet, also by Apogee, or something like an Edirol FA-66, or something like a MOTU traveler. I can’t recommend any USB audio interfaces, but this Firewire combination seems to work very well for me.

A word on processing power: I’m doing this all live on a Mac Mini with a G4 processor. However, when I turn on guitar and vocal effects, it starts to bog down. The effects use quite a bit of CPU time. Handling live video also makes the G4 work. If you have anything faster than this — a G5 or something with an Intel processor — it should be plenty fast enough to do what I’m doing. You may hear the fan ramp up. One way that I could save some processor power is by moving all the guitar effects to outboard pedals. I don’t have an outboard compressor or voice channel strip so the voice processing will have to stay in the computer for now. It does make me want to trade in my G4 Mac Mini for a newer Intel version, which would be able to run MainStage and which would presumably have quite a bit more CPU horsepower to handle audio effects. Oh, and if you are using a laptop, make sure to set it so it doesn’t go to sleep or try to cycle down the processor. This might make it get hot, so be sure you have adequate airflow and your studio environment is not too warm.

Here is a picture showing pretty much my entire live setup, minus the guitars and pedals:

Looks impressive, right? Well, except that everything on the rack shelf was very dusty from disuse, and I had not cleaned it all up yet. Also, when you see a shot from the other side, taken while I was setting it all up, and notice the dirty socks on the floor… and the beer… maybe not so much!

And, yes, I did play harmonica on my punk version of Jewel’s song “I’m Sensitive.” (If this were Twitter, I would then type LOLZ.)

You might be saying “wow, this is very complicated,” and you wouldn’t be wrong. However, I am very impressed, and almost amazed, that it worked. Apple really has their system software together now, and these tools are incredibly flexible. It’s particularly nice to be able to do all this mixing and routing right inside the box. And you don’t need a setup this elaborate; I know folks using a cheap webcam and microphone and their live streams sound fine for casual listening. We aren’t producing a professional-quality video for Blu-Ray here. If I were setting up something from scratch, I’d consider a laptop, an iSight, and an Edirol FA-66, and a mic; the FA-66 can be had for under $300, and a Shure SM-58 microphone for under $100. Add a few cables and spend some time on the setup and you have near-broadcast audio quality (although, of course, not video quality, but with the proper lighting the iSight can produce some impressive results).

Finally, if you would like to listen to one of my shows, my Ustream channel can be found here. I post notes on Twitter and Facebook, or on my chat, indicating when I expect to be on. So far I have done two kinds of shows — live music with video, and canned playlists from iTunes. But as you can see, just about anything is possible!

Creative Commons Licence
This work by Paul R. Potts is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. The CSS framework is stylize.css, Copyright © 2014 by Jack Crawford.

Year IndexAll Years IndexWriting Archive