Automate band demo creation

I started recording our band. Single mic through an M-Audio USB interface. Quality is “good enough”. During rehersal I create a single Audacity project and each song gets its own track.

I’d like to automate:

  1. Apply a saved eq to all tracks.
  2. Splice N seconds of each track, at a random point in each song, into a single track.
  3. Fade out/in between each segment.

I can do this manually, but man is it tedious! Plus with the randomnessness, I could just keep generating and listening for one I like.

Has anyone done this? I think it would make a sweet tool.

I’m comfortable with a few programming languages, Python, C++, Common Lisp. I haven’t dug into the Audacity code base yet.

2.0.0 on Ubuntu 12.04 64bit

From your title I was sure you were going to ask how to get Audacity to help set up your microphones. Koz

Ahahaha. I’ve cleared that hurdle!

While the project is open and contains all of the tracks you can use Ctrl+A (Select All) and then apply the Equalization effect. All selected tracks will be processed with the same settings.

Do you really mean “random point”? Do you want the automation to generate a random number and then select N seconds based on that random number, or do you want “N seconds” from somewhere near the middle of the track but not important exactly where?

If the latter, then assuming that your tracks are one below the other, you can:

  • select N seconds in one track, then Ctrl+Shift+K to select that region in all tracks (or “Edit > Select > In All Tracks”).
  • Then press Ctrl+T to trim to the selection (Edit > Remove Audio or Labels > Trim Audio)
  • Tracks > Align Tracks > Align End to End
  • Tracks > Align Tracks > Start to Zero

Do you want to fade one out then fade the next in, or do you want to cross-fade from one audio clip to the next?

Hey steve,

I’d like the start point to be random, but the length of the selection to be fixed, say 20 seconds. So 20 random seconds of each track. The method you described works well though and it’s much simpler than what I was doing.

I suppose a crossfade between each segment would be better eh?

Here’s a “Nyquist script” that can be run in the “Nyquist Prompt” effect (in the “Effect” menu).

To use the script, select a complete track, then open the Nyquist Prompt from the Effect menu and copy and paste this code into the Nyquist Prompt text box:

(setq clip-dur 20) ; required length of the audio clip
(setq fade-dur 3) ; required length of the fade-in fade out

(setq dur (get-duration 1))
(if (< dur clip-dur)
    "ErrornTrack selection is shorter than required audio clip"
      (setq start (* (rrandom)(- dur clip-dur)))
      (setf s (multichan-expand #'extract-abs start (+ start clip-dur) s))
      (setf env (pwlv 0 (/ fade-dur dur) 1 (/ (- clip-dur fade-dur) dur) 1 (/ clip-dur dur) 0))
      (mult s env)))

This will extract a random 20 seconds from the selected track and applies a 3 second fade in the the start and a 3 second fade out to the end.
The first two lines can be customised to suit your needs.

Apply this to each track in turn.
When completed, you can use the align commands from my previous post to line them up end to end.
For a cross-fade, switch to the Time Shift tool and drag the tracks left/right so that they overlap by about 2 seconds, then export your finished masterpiece.

“Nyquist” is a scripting language based on XLISP (a dialect of Lisp).
You can read more about Nyquist programming and how to make Nyquist plug-ins from these links:

We also have a forum board for questions about Nyquist:

That’s great steve. Thanks for taking the time to put that together. Nyquist looks like a ton of fun. Lots of reading to do!