Automating fade-in/fade-out of labeled tracks with Envelope

Is this possible with scripting? I create a Master track from several input tracks, and subdivide that in multiple labeled regions. With “export multiple” I then create WAV and MP3 files for CD and Web tracks. I want those tracks to automatically fade in at the beginning and fade out at the end, but not by processing the audio signal itself, but by adapting the envelope, so as not to destroy audio material. I have done that a few times by hand, but it is quite time consuming. Does anyone know a way to automate this? And if not, does there already exist a plugin to fade-in/out the original audio based on labeled regions?

Jan Hartmann

Unfortunately Nyquist does not have access to the envelope data (though it’s already included on the “Nyquist wish list”)

Thanks Steve. Are there any plugins to do this on the audio data themselves: add fade-in and out on every labeled region?

The closest I can think of is to “Export Multiple” to create separate files for each labelled section, then use a batch script with SoX to apply a fade-in / fade-out to the file.

I don’t have a pre-written scipt, but somewhere to start looking:
To find the length of a file:

soxi -d <filename>

To apply a fade:

Ah, just what I was looking for. I didn’t know Sox, but I already did an “Export Multiple” of the labeled tracks, and the fade-in -out was the most time-consuming part of the operation. Now I can add it without changing the original track. Thanks, Steve.


Hi Steve, just another newbie question. I want to automate as much as possible the workflow: “create labeled regions” “export multiple” “add fades to each labeled track with sox”. It’s about the first step. It’s easy to find the point where the music start and ends, but is it possible to write a script to extend automatically each region with two seconds at the beginning and two at the end? After that I can export all tracks and I know how to use sox to add fades to those two non-musical parts of the tracks. It is possible of course to do it by hand, but then I need to locate the first and last sound anyway and scroll back and forward two seconds. Takes a lot of time if you have to do it every time again


Jan Hartmann

Do you mean an additional 2 seconds, or do you mean to set the labels 2 seconds before and after the music (no added silence - just using the silence that is already in the track?

If you mean the latter, then “Sound Finder” (Audacity 1.3.12) can already do that.
If you mean the former, then how long are the tracks that you are working on and how much RAM do you have in your computer?

Yes that’s it, I need to add two seconds before and after the music starts, based on the material that is already there. Sound Finder does exactly what I want, and reasonably correct too. Thanks again Steve.

Two small comments on Sound Finder:

  • Would it make sense to add a parameter “Minimum length of connected sound region” ?
  • The sliders have quite a small range, e.g. 0.10-5 seconds for the interval between tracks. I need at least 10, and can set that in the text window, but the next time the value will be changed back to 5 again.

Anyway, my workflow now is:

  • use Sound Finder to create labeled regions of the track’s sound parts, plus a few seconds at the beginning and end of each part
  • export each part to mp3 with export multiple
  • use sox to create a fade in and fade out on the first and last two seconds of each mp3 file.

Saves me lots of time each Sunday with the recordings of our church choir.

Thanks again,


This could be done with Nyquist, but it will be slow, and heavy on memory usage (not suitable for long tracks).
An alternative is to use SoX for this also.
There is a discussion here that I think will be very useful: Batch add silence and repeat OGG files