Friday, May 25, 2007

Editting Audio in Flash

A question that pops up pretty consistently on the Cold Hard Flash message board is how to edit audio clips in Flash. Lets say you have a 4 minute song you're making an animation for and you'd like to chop the audio into a bunch of sections so that you can split the video up between multiple Flash files.

The best way is to use an audio editing program, but if you're like me and don't own one, here's a work around.

First, and foremost, import your audio.

Find what frame where you'd like to break the audio, create a new layer, and put a blank keyframe at that point.
Go back to frame one. Copy the first frame of the audio and paste it into the new layer
As you can see on the new layer, the audio now ends where you'd like it to begin.
Select the audio in the new layer, bring up your properties panel and click Edit
This will bring up the Edit Envelope dialogue box. Click on the zoom out icon until you see a vertical gray line running through the levels.
That gray line shows you where your piece of audio ends, which just so happens to be that blank keyframe we made earlier, so that gray line is also showing you where you want your audio to begin.

In between the left and right channel levels, there is a small gray bar that you can drag around. That bar tells flash where to start playing a piece of audio. So just drag the bar to the gray line.
Hit okay. Now back on the stage grab the newly edited piece of audio and have it start at the blank key frame you created earlier.
As you can see, we are close but not quite. Here comes the annoying part. First, in order to see the audio better, right click on each layer, choose properties and under the layer height pull down, select 300.
And if you want to be really picky (which I do), select large frames under the timeline's drop down menu.
Now go back in and refine the starting point of your new audio clip. As you can see on mine, the new clip starts a bit early so I need to push back the starting point.

Since these are small adjustments you are going to want to be zoomed in pretty tight in the audio Edit Envelope. Navigating the Edit Envelopes timeline and zooming in can be really annoying. Here's how you can find your starting point and easily zoom in on it.

First zoom out wide and scroll so that the starting point is all the way to the left on the timeline's visible section, and then zoom in. While zooming in with the Edit Envelope, the frame on the left stays put.
Now adjust your staring point. You want see the edit take place on the stage's timeline until you hit okay (very annoying), so this will probably take a few tries to get it right. You won't get it perfect but with a little patience you can get really really close.
Collapse your layer heights, zoom out on the timeline and you're good to go
When you hit play it won't sound perfect, you'll get a slight tinny echo, but for timing purposes and lipsync you'll be fine. You can go and copy that new piece of audio and place it in a new document.

No comments: