Rss

Archives for : soundtrack

New MacBook

My hated PowerBook G4’s drive inexplicably died this week… what I thought was some rogue process pounding the disk turns out to have been the death rattle of a three-year-old HDD. Not that I mind too much; the ridiculously poor wi-fi and the rapid obsolescence of the G4 CPU had me planning to replace it this year anyways.

So, thanks to the modest ADC Select discount (10% off consumer Macs, 20% off pros), and fairly speedy free shipping, my travel machine is now a 2.2 GHz Core 2 Duo MacBook.

My new MacBook

The install in this picture is Final Cut Express… with lots more hard drive space, it’ll be nice to have FCE and Soundtrack, and a machine fast enough to run them, while I’m on the road.

There must be a better way to do this (of course there is, and I discovered it after the fact)

So, with the obscure musical tastes and all, I noticed a prog rock band that I really like, Be Bop Deluxe, were featured in a 1978 vintage concert performance on XM a few months ago. I recorded it off DirecTV into my PowerBook, but I wanted to listen to it in iTunes like the rest of my music. Moreover, I wanted to split up the songs like any other album in iTunes. So, begin with the end in mind:

Be Bop Deluxe concert cut into separate iTunes tracks

How do you cut the single big AIFF into separate AIFFs, frame-accurately, since the live concert will segue one song into the next, and won’t be tolerant of sloppy edits?

I don’t think QuickTime Player Pro would be a good choice, because the scrubber doesn’t give you much accuracy in setting your in and out points, and converting your last out point into a new in point would be easily botched.

I used Soundtrack, but my technique turned out to be far less efficient than it could have been. What I did was to use the blade tool to slice the source AIFF at each song break, then put each song in its own track, like this:

Slicing a long AIFF into individual tracks in Soundtrack

I then used the mute buttons to solo each track, set the end-of-song right at the end of the track, and exported to AIFF.

This is still error prone if you don’t nicely line up the playhead right at the end of the track, or worse yet, you do so, but forget to actually do “Set end-of-song”. Being off by a pixel either way, even at high zoom levels, creates an audio glitch (either an up-cut or a tiny dropout). Fortunately, Soundtrack is non-destructive, so botched edits are easily remedied. But it would be nice if it weren’t so easy to botch the edits in the first place.

So, here’s a better practice. Blade the edit points, but don’t move them to separate tracks. Instead, select each segment, right click, and do “Save Clip As…”:

Cutting up a long AIFF and exporting the segments in place

Provided you don’t move any of the segments, this should eliminate any problem with bad cut-offs.

With either approach, you then take the resulting AIFFs, import them into iTunes, tag with the album title, artist, track X of Y values, and whatever art you can scrounge, and convert to AAC or MP3.

Well, right way or wrong, it worked, and it’ll go into my iPod with the next sync. And yes, I know this is technically illegal, and as soon as the King Biscuit rights-holders care to release this concert on CD (I have their 10cc in Concert CD), I’ll be happy to trash my version and buy theirs. All the work to capture, cut up, and tag this concert is a good reminder of the fact that piracy is actually a hassle, and most of us will gladly pay for someone else to do the work for us.

Developers should be content experts too

I spent much of the weekend at Anime Weekend Atlanta, which is more or less my annual holiday. I love the enthusiastic crowd, the smart panels, the excitement of the new and novel, etc. It’s also nice being in a crowd that’s mostly young and has gotten thoroughly gender-balanced over the years.

It’s also interesting as a dive into the content side, as the whole point of the exercise is a massive indulgence in media viewing and production. I attended a podcasting panel that was supposed to feature the Anime World Order podcast, but they were simultaneously scheduled to record another session, so they had the Ninja Consultants fill in. Which is fine, because I like Erin and Noah from the NC better anyways. Afterwards, we had a good chat, and I mentioned that I had un-podfaded by resuming the Fullmetal Alchemist podcast that I’ve done off and on for a year and a half.

It’s not like I have tons of time for the podcast, mind you, but as I’ve been reorganizing my thinking around putting more of my cycles into media development, I realized something: being a media content developer makes me a better media software developer.

In doing the podcast, I’ve used a couple different tools: for the first episode, I used Final Cut Express because it and iMovie were the only apps I had that supported multitrack audio (even though they were clearly inappropriate for audio-only production). I then moved on to GarageBand for a long time, and then moved up to Soundtrack (which came with FCE HD), which is what I use now.

And in using GB and Soundtrack, I started seriously leaning on segment-level editing and volume envelopes… which of course led me to think about how those features are implemented in software. The volume envelope — the little “connect the dots” line under a track’s wave form, which can be used to raise or lower volume over a period of time — can be accomplished with tweening, and that’s what got me interested enough to dig into tweens and port Apple’s QuickTime volume tween example to QuickTime For Java.

Similarly, as I moved segments around the tracks, I wondered how these were being managed within their container. After some thinking, I realized that it could all be done with track edits, but the QuickTime API doesn’t seem to provide straightforward access to a track’s edit list (short of touring the atoms yourself, with a copy of the QuickTime File Format documentation by your side). But as part of a consulting gig to help a company that wanted to some server-side editing, and wanting to prove that managing your movies in memory is a good approach, I finally dug in enough to find a good way to tour the edit list: you call GetTrackNextInterestingTime, with the behavior flag nextTimeMediaEdit to indicate that what you’re looking for are edits.

Here’s a QuickTime for Java routine that exposes all the edits you’ve made in a track, presumably after a number of calls to Track.insertSegment():

// simple routine to count the number of edits in the
// target video track.
private int countTargetEdits () throws QTException {
    if (! targetMovieDirty)
        return 0;
    int edits = 0;
    int currentTime = 0;
    TimeInfo ti;
    ti = targetVideoTrack.getNextInterestingTime 
        (StdQTConstants.nextTimeTrackEdit, 
             currentTime,
         1);
    while (ti.time != -1) {
        System.out.println ("adding edit. time = " + ti.time +
                            ", duration = " + ti.duration);
        edits++;
        currentTime = ti.time;

        // get the next edit
        ti = targetVideoTrack.getNextInterestingTime 
            (StdQTConstants.nextTimeTrackEdit, 
             currentTime,
             1);
    }
    return edits;
}

In my QTJ book, I conclude the chapter on editing by showing how to do a low-level edit (ie, a segment insert), but I really don’t show the point of it, and I think I leave the impression that copy-and-paste is more valuable. But having used the pro apps at a deeper level, I’ve got a greater appreciation for the value of the low-level editing API.

And that’s the lesson I take away from this: there’s only so much you can learn from reading others’ documentation. I see this in the Java media world, when so many people write the same things over and over again about using Java Sound to load and play a Clip, and never getting into how to handle audio that’s too big to load entirely into memory (because Java Sound makes that really fricking hard, and few people have actually done it). Similarly, people who write about JMF and its lovely state machine of prefetched-fetched-realized-started are probably working from the docs, and haven’t done enough actual development with JMF to realize that it doesn’t do anything useful.

Reading the docs only gets you so far. If you’re going to write serious code, and write about coding, I think it really helps to be a content matter expert, and that means using the same kinds of apps that you intend to write. It gives you a deep affinity for your customers’ likely needs. And that’s why I’m podcasting again.

Oh, and I just found a nice technique for cross-fading my ambient room noise to hide the audio edits in the parts where I’m talking for like five minutes straight…

Thinking in QuickTime, 1

So, one of the things I find over and over again in my consulting work and in working with developer peers is what I would call a certain literalism in thinking about media, particularly at edit-time. For example, if we talk about copy-and-pasting some part of a source movie into a target, many assume that means (and can only mean) doing a big ol’ disk copy right there and then of source samples into a target container.

It ain’t necessarily so.

Here’s an exercise that you can do with Mac audio editing apps that should get you thinking about different approaches. I used Soundtrack, but the same concept works in GarageBand and other track oriented editors.

Start with a clip of audio. This is me counting “1 2 3 4 5 6 7 8 9 10” on an iSight. I hit the 5 a little louder so it stands out.

Soundtrack grow demo 1

Use the blade and cut this into two segments

Soundtrack grow demo 2

And put them on different tracks

Soundtrack grow demo 3

Mouse to the left side of the lower segment (6 through 10) and your pointer becomes the “left grow” cursor:Soundtrack grow demo left. Click and drag left to expose some of the audio you cut (namely, 1 through 5)

Soundtrack grow demo 4

Same thing with the right side of the top track, which is currently just 1-5. Get the right grow cursor Soundtrack grow demo right and you can undelete 6-10:

Soundtrack grow demo 5

Pull them both all the way to reveal the full original segment in both tracks:

Soundtrack grow demo 6

So what does this prove? Well, non-destructive editing for one. Some GB and Soundtrack users are blown away the first time they realize they can “get stuff back” after an edit.

But moreover, the point to take away is to understand how this is really being implemented. A media app doing this kind of editing neither wants nor needs to make copies from the original AIFF when performing edits. Pointers will do just fine. Each segment is basically just a reference to some source media, and pointers as to what parts of that media are to be used.

So, when I recorded my audio, I had a segment that referred to one AIFF and had in and out points at the beginning and end of it (ie, before “1” and after “10”). When I split it in two, I got two segments, both referring to the same source AIFF, but with different pointers. And to grow the segment, all I had to do was move the pointers.

In QuickTime, this is done with the default “import in place” behavior, and the pointers are maintained at the track’s “edit list”. I’ll have more about the specifics of moving around the edit list in another post. For now, I just wanted to get the thought out there: use references and pointers, it’s faster and it’ll give you more flexibility later. Like, say, if you plan on implementing Undo.