Sunday, 30 October 2011

Audio Handling (For Technical Types)

By and large, it's been my experience that wherever someone offers an expensive software solution, some band of geek geniuses will quickly come up with a cheap (or free) alternative. Whether it's Microsoft Office (Anything from £100 up to £429) versus OpenOffice (Free), or Photoshop (£650, I think - how many versions of that tool are there?) versus GIMP (Um, free again)... Heck, you can pick up free antivirus software, free firewall software, and even (many different versions of) a free operating system.



It's no different when it comes to Media. There are free editing packages like Lightworks, which I have still to properly try out, and then there are the big four...
  • Audacity - Free Audio mastering and editing software.
  • Avisynth - A free way to treat video and audio as variables in a scripting language.
  • FFMPEG - To turn practically any format into practically any other format.
  • VirtualDub - View files, especially Avisynth scripts, in as much detail as I need.
Seriously, about sixty percent of my job would be more difficult, or much more expensive, without those four tools. But just recently, I ran into an issue with Audio that really threatened my calm. And guess what; the solution was yet more free software.

The problem, in outline, was that we were working with uncompressed audio files for the most part. That's always been the way I've done it up to now, mostly because I was usually working with uncompressed audio to begin with - WAVs from Windows capture tools, PCM Mov audio from Final Cut - so when, in the old routine, I had to work with compressed audio, I typically went to BeLight to convert it to uncompressed Wav. But the new routine is different. Consider a hundred and fifty titles a week, with up to three sountracks each, sometimes all in 5.1 audio, which necessitates 6 separate mono wavs, because a 6-track 16-bit 48,000 Hz uncompressed wav hits the 4GB "As big as most software says it's allowed to be" mark at around 2 hours and 4 minutes, meaning anything over that length gets cut off - unless you use six mono wavs and join them with, say, Avisynth.

So; that's around 10-12 GB of audio data being written per title, for 30 titles a day... It was taking too long, it was taking up too much storage space, and it was making the network go wobbly when three people were simultaneously trying to push and pull that much data to and from storage. Something had to be done.

The solution came in two parts: First, NicAudio, which is a plugin for Avisynth that handles most of the common compressed audio formats - Dolby Digital, DTS, MPEG-Audio. So with that, we could now write an Avisynth script that did not require us to decompress the audio with BeLight first.

But then we had another problem to resolve. We needed to look at the audio, to observe the audio mapping and, if necessary, normalize the peak values. Okay, VirtualDub has an audio display, but it's more for syncing than for detailed analysis. Plus, VirtualDub just can't play anything with six channels of audio, as far as I can tell; you can downmix to stereo as part of the NicAudio command, or pull out just the centre channel of a 5.1 mix, when you need to check for sync, but that won't do you much good if you need to look at all 6 channels and weigh up how much to boost the volume by. The solution to that was add an FFMPEG import/export library to Audacity. It's not perfect - While you're importing a file, the explorer window you dragged the file from will become locked - but it's way, way quicker to import and analyze audio this way than by my old method.

There were some other minor issues. DTS-HD audio is not really compatible with either tool. But with SmartLabs tsMuxeR (their crazy capitalisation, not mine, and yes, it's free) it's easy and quick to downconvert a DTS-HD stream to a regular DTS stream. And it'll do a Dolby True to Dolby conversion, too, if the Dolby True is of the Core  + Extra Info type. And the MPEG-Audio import filter from NicAudio has a really odd lag on it; hit "play" and it'll be a few seconds before playing actually occurs, while it creates a ".d2a" file. What's that file for? Holding a variable for normalization. Do we get any use out of that? No. Can we turn off the creation of the .d2a? Apparently not. But there are always aggravations with any piece of software, and at least when it's free software, you don't feel like you got ripped off when functionality is lacking...

Cough Cough Final Cut Pro X Cough.

Well, it's time to get off this topic and return to my chores for the day. I have to put laundry in the dryer, mop floors, send money to my parents, wish my sister a Happy Birthday, and play Arkham City. Some of these chores are not that unpleasant...

No comments:

Post a Comment