Monday, December 31, 2007

A free graphic equalizer for all mac sound

Problem – you’re streaming music from some web site (i.e. Pandora) and it could use a little EQ tweaking but your browser doesn’t have an EQ and OS X lacks a system EQ…

I found a (somewhat kludgy) way to use AU Lab to create a graphic EQ or do other filtering on any sound playing on your mac. Here's it...

What you need:
  • Install soundflower – restart required
  • Install Developer Tools from your os x install disk (if you haven't already done so)
A little about soundflower:
This program creates virtual sound input and output devices that are available to any program that can choose which sound device to use. SF provides two pipes for our use, one with two channels (think stereo), and one with 16 channels and audio programs simply see these as audio devices they can play to or get input from. Essentially SF allows us to pipe sound between programs (as long as those programs can look for audio devices).

Unfortunately most software doesn’t allow us to select which sound device to output to, so in order to steal the sound output of our browser, we need to redirect the sound output of our whole computer. Luckily, using “Audio MIDI Setup” (found in /Applications/Utilities) this isn’t that hard…

Open /Application/Utilities/Audio MIDI Setup. Under the “Audio Devices” tab you’ll see various dropdown menus. These are fairly self-explanatory. Whichever device is selected under each menu is where the system will send to or receive from. You’ll notice that each menu is probably set to Built-in.

As an experiment, start some music playing from any program you’d like and leave it playing in the background… now in Audio MIDI Setup select “Soundflower (2ch)” from the Default Output menu… Your music should become silent now, but if you check, it’s still playing. The silence is because instead of being routed to your speakers, the sound is routed into the two channel pipe of Soundflower.

We’re going to need an input of sound into AU Lab and an output for our modified sound (after the equalizer) to our ordinary speakers. Strangely, as far as I can tell, AU Lab can only work with what it sees as one device at a time, luckily Audio MIDI Setup has a method of bundling devices together to create “Aggregate Devices”. This is the only step for which you need to be Admin, so for this step, switch to your Admin account (you can leave you normal account logged in, we'll be right back) and open “Audio MIDI Setup” (from the Utilities Folder). Now chose “Open Aggregate Device Editor” from the “Audio" menu.

click for larger image

We need to provide a pipe into AU Lab and a pipe from there to our speakers so we’ll check “use” for “Soundflower (2ch)” and “Built-in Output”, name this device anything you like (or leave it as the default “Aggregate Device” – this is what I’ll call it for the rest of this post). When you’ve done this, click Done, and make sure your “Aggregate Device” now appears in the dropdowns Audio MIDI Setup – don’t select it now, just make sure it appears (if you select it and forget, you might later wonder why your sound is broke in your admin account). If your new Aggregate Device exists and your Outputs are set to Built-in, it’s time to exit this program, log out of your Admin account and return to your normal user (you do have one don’t you?)

Now in your regular account with your music playing, in Audio MIDI Setup select Soundflower 2ch as your default output.
Open AU Lab – at the create new document dialog:

  • Choose “Aggregate Device” from the Audio Device dropdown menu
  • Under the output tab grab the red box (it drags back and forth) and make sure it’s on the which ever stream is not the “Soundflower…stream” probably “Stream 2” (maybe "Stream 1")
  • Click the “Inputs” tab, and then click Add Input – a red box should appear labeled “Soundflower Input Stream 1”
  • Click OK to create the document

At this point you should have an Untitled window with some controls and your music and sound should come back on. If that's the case, save the current document so you don’t have to configure it again. In the left column you’ll see the heading “Effects” and three dropdown menus – These can be used to apply all sorts of effects, but you came here for an equalizer, so choose AUGraphicEQ and play around. I recommend opening up the iTunes equalizer and copying presets from there onto the 10-band EQ - be sure to save any EQ settings you like.

Your system volume keys (F3, F4, and F5) won’t work and your volume should be the same as it was when you switched the default output in Audio MIDI Setup so you can control volume from within whatever program is making the sound and/or from the volume sliders within AU Lab. I’m no audio expert, but generally you don’t want to boost a weak signal too much so if you need louder sound I’d recommend first turning up the sound output from the program and after that you can increase your system volume by opening Audio MIDI Setup, setting the default output to “default output”, changing your system volume, and then changing the dropdown back to Soundflower 2ch and your sound will be routed back to AU Lab and it’s EQ.

Disclaimer - This works on my MacBook Core 2 Duo running 10.4.11 and I've no idea what systems it won't work on. Also be advised that if you "do it wrong" and create a feedback loop in AU Lab you can create some nasty feedback, which so far hasn't damaged my speakers, but it gets pretty loud so be careful.

p.s. I've also used this plus more to push sound out to my Airport Express speakers with great results and I'll post on that sometime when it's not 3:08 a.m. (well it might be but it wont be this 3:08)


Kevin said...

Awesome. This is exactly the sort of "duct tape and chewing gum" solution I was looking for. Why doesn't Apple put an eq in the sound prefs? SHEESH!


Josh said...

Do you have any experience mapping MIDI controls to controls in AU Lab? This doesn't seem to work as the help files indicate it should and I can't find anything online on the topic.

Your site has been really helpful in getting EQ'd and volume-adjusted signals to my desktop speakers and home theater. Thanks for taking the time to write these things up!

Josh said...

Sorry Josh, but I don't have any experience with that - it's been so long since I did this stuff that I'd really have to re-read this blog to remember the ins and outs of how to set up what I did - it's all here ;-)

I'm happy and somewhat surprised that this stuff is still helpful/working on macs (given that I set this up on osx 10.4.11 if I remember correctly).