Tuesday, July 14, 2009

Technical Trials: Recording Realtime Streaming Audio On A Mac

Much as I love the BBC, like a certain other three-letter entity, it does tend to move in mysterious ways. Or more accurately, downright mystifying ways. Take for instance the unfathomable policies on (not) letting the listener hear programmes online after the initial broadcast time. Some programmes are podcast, some you can listen to for seven days afterwards, and some are just buried in the dark and backward abysm of time, also known as the BBC archive. How I wish that we, the licence-paying public, could have access to what must be the world's richest treasure chest of sound. Yes, I know the licence only comes from TV owners now, but in the good old days, wireless sets (the size of tea chests) were also included.

As it is frustrating to complain about something without offering some kind of solution, I have a small and partial suggestion: record the audio stream on your computer at the time of broadcast and put it in your own archive (for your own personal use only).

On a PC, capturing streamed audio is relatively easy, but on a Mac it is another matter. Things reached boiling point this morning when I badly wanted to listen to a programme about the number of UK politicians being paid for from the public purse, but helping my wife with her final day of preparation before the dreaded GMAT exam was more urgent. I just couldn't get my MacBook to record the audio stream and had to give up and get back to the high-priority task.

But the days of lost streams are over now, because later in the day I was able to take some time off and figure out the mystery of real-time audio capture and what is more, I'll share the secrets with you. First I sent out a desperate SOS Tweet asking for suggestions for audio capture software. Within minutes, five people came back with three suggestions, one free and two not, but having trial versions. I'll deal with the free one first.

Audacity (suggested by @UncompletedWork aka Merrel Davis)
Audacity is free but has two important blocking issues that can be fixed (for free) with some effort. 1) It won't save to MP3 format and 2) it can't capture the Mac internal sound, which is where streaming audio seems to live (commenters may tell me I am wrong).

1) can be fixed by downloading the LAME MP3 encoder library (there's nothing lame about the code - it stands for MPEG Audio Layer III (MP3) encoder). The easiest way to do this is by going to Preferences > Import/Export - MP3 Export Library and clicking the Download button. Otherwise you can download the file from here - the download link is about half way down the page. When that's done and installed (by clicking the Install icon of the downloaded package), click the Audacity Locate button (also in Preferences > Import/Export), which seems to default to the right place on the Mac hard drive, namely /usr/local/lib/audacity/libmp3lame.dylib. (This last step may not even be necessary.) If you think you might need the FFmpeg library for audio in video encoding presumably, you can download this library at the same time - the section for doing this is just to the right of MP3 section.

2) can be solved by downloading Soundflower. After it installs, you will need to set Audacity to use the Soundflower output and (I think) set the Mac audio output to Soundflower. I may have overdone the settings - the speaker seemed to stop working unless one was recording in Audacity - so if anyone has better ideas, let me know in the comments below or tweet me at @juliandarley.

With this done, I was able to able record a snatch of Beethoven's Ninth - in fact the Ode to Joy, believe it or not. Possibly rather grandiloquent for such a small achievement, but more appropriate than Tosca topping herself I suppose (much though I love the opera).

If you don't mind a bit of fiddling and tweaking, this free combination of Audacity, Lame and Soundflower seems to work.

Next I tried Audio Hijack Pro (suggested by @PaulTRussell)
Audio Hijack Pro comes from the slightly worryingly named Rogue Amoeba. However, my sense is that this software won't increase your chances of being infected by any roving pandemics or epidemics. I downloaded and installed the trial version, which apparently will add noise to your recording after ten minutes until you pay for a registered copy (US $32).

As far as I can tell, Audio Hijack also uses Soundflower to re-direct streaming audio to the recording input of this program (again, someone let me know if I have misunderstood this). The main difference from Audacity appears to be that Soundflower is included and installed with Audio Hijack Pro. The program is able to do a lot more than just capture audio streams, including adding all kinds of effects. However, I don't need any of this (I don't think). I liked the fact that if you go to Quick Record, you can select which application (eg Firefox) you want to record from. Audio Hijack Pro has a library area in which you can see your recordings, which could be useful (especially if, like me, you are not all that fond of Finder).

This program clearly does the job, but if all you want is to capture the odd raw radio stream from time to time, then paying $32 may seem like a stretch.

Finally, I tried out the two WireTap products from Ambrosia Software (suggested by @PhilipSheppard, @IrfanHabib and @byrnegreen aka Chris Byrne). The main difficulty here is the price of WireTap Studio ($69) relative to the single, simple task desired and understanding the relationship with its earlier cousin WireTap Pro. My understanding is the following: WireTap was once free, then it became WireTap Pro, which will work in free mode, but will only capture in the AIFF format (which is similar to WAV in size - ie. it's very large). If you want to save in MP3 (as I do) you have to get the licensed version for US $19 or listen to a lady with a very miserable voice telling you every 12 seconds that your recording was made with an unregistered version.

However, to complicate the picture further, Ambrosia no longer supports WireTap Pro, though it did release a last final version for OS 10.5. I managed to track down this official URL and downloaded a trial copy from here. But with the same insistence of their lady announcer, Ambrosia make it pretty clear that they would much rather you bought WireTap Studio. When you install WireTap Pro you get a message and link that says there is a new version - but there isn't. The link takes you to ... WireTap Studio. I think this kind of message is misleading, especially if you have bought the registered version (for $19).

For completeness and following the beseaching of the sad siren voice, I decided to download and install WireTap Studio. Whilst doing this, I noticed that WireTap also seems to use the LAME MP3 library, but it's included and installed without user intervention (which is easier than with Audacity).

I prefer the new interface of Studio to Pro, and it also offers the chance to organise your library of recordings. The trial version of Studio lasts for 30 days, but appears to be a full working version. I like the fact that you can select two inputs at once, though I am not sure you can change the volume of either. A really nice feature of both WireTap Pro and Studio is that you can set the software to record in advance and for a definite time, which could be extremely useful if you have to go out hours in advance of a much desired programme and don't want to record everything before that (which I suppose in the worst case could cause your computer to crash). You will still have to leave your computer on and streaming - I have not seen a sleep state that automatically wakes itself up at a certain time and fires up requisite programs and streams. Maybe it's out there - do let me know, if it is.

Whether the extra horsepower of WireTap Studio is necessary for you will be a personal decision.

To sum up: for just the most basic job of recording live audio streams, Audacity (with Soundflower and LAME MP3) seems perfectly adequate. If you want the extras provided by Audio Hijack or WireTap or don't want the slight hassle of installing Soundflower and LAME MP3, then parting with somewhere between $19 and $69 will be the way to go. I hope all this helps you to listen to what you want or need to when you want to or are able to. It has certainly helped me mitigate (to some extent) the mysterious (though often wonderful) ways of the BBC.

@juliandarley

4 comments:

Paul Russell said...

If you want to record streaming radio programmes at the time that they air then Rogue Amoeba also produce a program called RadioShift. It's like a VCR or PVR for streaming radio and it has a built-in programme guide. You can set it to record a specific programme at a given time each week, e.g. 18:30 BBC Radio 4 every Friday. I don't use it so much now that more stuff is available in podcast format but it's still occasionally useful for stuff that won't end up as a podcast. Oh and it will even wake your Mac up to record a programme if you've let it go to sleep, which is quite cool. http://rogueamoeba.com/radioshift/ @PaulTRussell

MagnusApollo said...

You can actually schedule events on your computer using WireTap Studio, with no need to leave the machine running to do so. The first step is to set up a session using the desired time and information there. But, in order for it to work you have to enable a specific option in your general preferences. Just make sure that the "Automate startup/wakeup computer for scheduled sessions" box is checked. Without this, the scheduled recordings will not occur when your computer is shutdown or asleep.

As for the volume levels in WireTap studio, once you capture the two tracks you can see the volume controls for each track in the edit window. These are located at the far left and far right of the waveformat in the editor window. Moving them up or down will control the volume for each.

Smith Mill Creek Notes said...

I paid for Wiretap Pro in 2004, and it worked well at first, but then went buggy. Looking online, I could see that others had similar problems; but were getting condescending responses from Ambrosia, which seemed to blame users rather than take responsibility.

When it worked it was a good product, but it often didn't work. And to record something, and have it CRASH midway through, thus destrying the radio program recording was a bit of a trust killer. I don't want an elaborate program that works well 60% of the time, I want a simpler program that is ultra-reliable.

It would be great to hear from folks that Ambrosia is now more reliable.

Anonymous said...

Two things:
1. While not offering a blanket absolution to the BBC for the occasional oddities and awkwardness of its interactivity - in fairness to those within it trying to offer downloads, some of the contracts for the original programmes preclude offering them as unlimited downloads. A shame, but there it is.
2. I hear you're doing a talk soon - live streaming of audio from your actual mouth. Can you please post some details, just incase a little meatspace interaction is possible?