Commission Music

Commission Music
Bespoke Noise!!

Thursday, 26 August 2010

Ardour: Copying Gain Envelopes

Ok, let's say you've got a project in Ardour and you've carefully drawn a bunch of gain changes using the Draw Gain Automation tool - which is one of the buttons on the upper left. You listen to your project and are forced to conclude that one of your tracks needs to be re-recorded or re-rendered. Alas and woe! However, there is a way to get your automation points onto the new track. Alas, it's a bit tricky.

One of the great advantages of Ardour over other DAWs is that you can actually figure out what's going on with the data files. If you open up a ProTools project in a text editor, you get gibberish, but if you open up a .ardour file, you get a human-readable XML file. I bring this up because you cannot select your gain change points in the Ardour GUI and move them to a new track. But you can move them if you're willing to modify your .ardour file. Here's how:

  1. Make a backup of the file in case something goes wrong.
  2. Open the file in the text editor of your choice - ideally one that you might use to write code
  3. Your tracks have names. Let's say the track you want to copy is called "SourceTrack." Search in the .ardour file for "SourceTrack." You'll find it many times, but one of those times, will have an XML node called <Envelope> a couple of lines below.
  4. Copy everything starting at <Envelope> and ending at </Envelope>, including those two lines.
  5. Ok, let's say the track you want to copy to is called "DestinationTrack." Search for that. If you drew some gain automation points on it already, look for the <Envelope> below it. If you have not drawn any gain automation, then look for <Envelope default="yes"/>
  6. Blow away the <Envelope default="yes"/> or the pre-existing envelope with the code you copied.
  7. The length of the envelope must match the length of the region. You can find the region's length 2 or 3 lines above the envelope. It will say "length=" and then a number. Get that number and copy it.
  8. The envelope values are pairs of durations and amplitudes. If the length of DestinationTrack is longer than SoureTrack, then add a point at the end with the length you just copied. If it's shorter, remove points with durations past the length you just copied. Then add a point with the length you copied.
  9. Scroll up to the very top of the file. The second line will end with "id-counter=" and then a number. Copy that number.
  10. Now replace the the number at id-counter with the number you copied +1. If you copied "123," then replace it with "124."
  11. Scroll back down to the envelop your just added to DestinationTrack. It has a property "id=" and then a number. Replace the number there with the one you copied from the top of the file. If the one at the top of the file was "123," then you should have "id=123" in the Envelope of DestinationTrack and "id-counter=124" at the top of the file.
  12. Save the file and then open it with Ardour to see if it worked.

Well, it's easier than re-drawing every point, but it's still a bit of a pain. If you think you might end up wanting to cut and paste automations, then you can start by using tha gain automation track instead of drawing gain enveloped directly on top of the audio. Click the 'a' button to show automation tracks. I prefer to draw directly over the waveform so I can really see what's going on, but I must admit that transferring the points is a real pain.

Thanks to las, who was in the IRC channel #ardour on freenode and was able to tell me how to do this.

No comments: