How to do light editing automation?

For some friends I remove boring bits from long recordings. The work flow is identical, and I’d like to automate as much of it as I can. It doesn’t look like macros / chains allows any editing (e.g. can’t automate the “cut” as it’s not an effect). Any way to automate this? I’m up for some coding if someone would point me in the right direction.

Here is my workflow.

once I have the file loaded.

  1. find and select a boring bit (can’t be automated)
  2. cut it
  3. split @ cut point (helps w/ selections that follow)
  4. fade out the 1 second before the cut
  5. fade in the 1 second after the cut
  6. remove the split
    go to 1

it’s also a bit annoying that the fades don’t have hot keys. Maybe it’s assignable and I just haven’t figured it out yet?

Anyway, any ideas on how to automate some repetitive editing work? It’d cut-down on the time it takes to do this by quite a bit. Once I have the boring bit selected I’d like to just hit a hot-key (or at lest just select one menu-item) and automate the rest.

I’m running Audacity version 2.2.1 on Ubuntu 18.0.4.2. LST

Thanks in advance.

Would a short crossfade be better? Crossfade Clips - Audacity Manual

If so, then you could assign a keyboard shortcut to the Crossfade Clips effect (Commands and Keyboard Shortcut Reference - Audacity Manual), then:

  1. find and select a boring bit (can’t be automated)
  2. Ctrl + X (cut)
  3. Ctrl + i (Split)
  4. Make a short selection across the split line (I would use the mouse, but you could use Shift + cursor left/right)
  5. Shortcut for Crossfade Clips.

The steps 2 to 5 could be automated with a Macro Macros - Audacity Manual
The Macro would contain:

Delete:
SelectTime:End="1" RelativeTo="SelectionStart" Start="-1"
CrossfadeClips:

and you could make a custom shortcut to the Macro.

Yeah, a crossfade would work fine for my needs. Thanks for your help.

This is really stupid but, I don’t have a “tools → macro” menu item. I have a “File → Chains”, but those only allow effects, not edit commands like cut (AFAICT). did macros show up after 2.2.1, or arn’t available on linux, or am I just an idiot and can’t find it?

Yes, Chains changed to Macros (and were improved) in version 2.3.0

WC

Unfortunately, Audacity 2.2.1 is too old for the “Macro” solution because the “SelectTime” command was added later when Chains became Macros.

I think the method I described using shortcuts should still work with Audacity 2.2.1:

  1. find and select a boring bit (can’t be automated)
  2. Ctrl + X (cut)
  3. Ctrl + i (Split)
  4. Make a short selection across the split line (I would use the mouse, but you could use Shift + cursor left/right)
  5. Shortcut for Crossfade Clips.

Yep!

I uninstalled the package 2.2.x package from the Ububtu default repro, and installed the 2.3.x from snap and how I have macros!

I did the macro like you suggested. Works great! thanks!

Turns out, I like the fade in & fade out a little better than the cross fade, but the macro was easy to change. Posting it here for posterity in case anyone else could benefit. Using relativeTo=“Selection” for the second selection effectively just moves the selection forward one second. That was the only “tricky” bit. :

Delete:
SelectTime:End="0" RelativeTo="SelectionStart" Start="-1"
FadeOut:Use_Preset="<Factory Defaults>"
SelectTime:End="1" RelativeTo="Selection" Start="1"
FadeIn:Use_Preset="<Factory Defaults>"

Thanks you waxcylinder so much for your help and patience!

Here’s another possibility.

This is a Nyquist plug-in which deletes the selection except for the first and last bits of the selection. The first and last bits are crossfaded. For example, if you select 1 second, and the “Crossfade length” is 0.1 seconds, then the middle 0.8 seconds will be deleted, and the first and final 0.1 seconds are crossfaded.

This is the code:

;nyquist plug-in
;version 4
;type process
;name "Delete with X-fade"
;action "Processing..."
;author "Steve Daulton"
;copyright "Released under terms of the GNU General Public License version 2"

;control fade-len "Crossfade length" float "seconds" 0.1 0 10


(if (> (* 2 fade-len) 1)
    (setf fade-len 0.5)
    (setf fade-len (* fade-len (get-duration 1))))

(defun cut (sig)
  (if (> fade-len 0)
      (let ((start (extract 0 fade-len (cue sig)))
            (end (extract (- 1 fade-len) 1 (cue sig))))
        (setf *control-srate* *sound-srate*)
        (setf start (mult (pwlv 1 fade-len 0) start))
        (setf end (mult (pwlv 0 fade-len 1) end))
        (sum start end))
      (let* ((end (sref sig (/ (1- len)(* duration *sound-srate*))))
             (start (snd-fetch sig))
             (val (/ (+ start end) 2.0)))
        (snd-from-array 0 *sound-srate* (vector val)))))

(setf duration (get-duration 1))
(multichan-expand #'cut *track*)

If you want the plug-in to have a fixed length rather than being prompted each time, you could change the line:

;control fade-len "Crossfade length" float "seconds" 0.1 0 10

to

(setf fade-len 0.1)

which sets the fade length to 0.1 seconds.

Here’s the above code as a file which you can download and install:
delete-x-fade.ny (952 Bytes)
To install the plug-in, copy it to the hidden folder in your home directory:

~/.audacity-data/Plug-Ins/

and enable it in the Plug-in Manager (https://manual.audacityteam.org/man/manage_effects_generators_and_analyzers.html)