Quickly Extend or Shrink a Selection

Hi everyone, I’m new to Audacity plugins, recently I’m looking for a plugin that can quickly operate on a selection, so that I can quickly insert a duration of silence, say 0.1s, into the selection, or remove a duration from it. I know this can be done manually, like copy and paste, but things become different when you have hundreds or even thousands of selections… So if the insertion and removal actions can be done more quickly, like a keyboard shortcut, it can save me a lot of time. Anyone has an idea? I’d really appreciate it if someone can help.

You have not provided much information about what you are trying to do, but perhaps you could do it with a macro.

There is also this topic that may be relevant: How to stop my super-simple fixed-length silence plugin from making new clips each time?

Maybe I can make it clear with an image. What I’m trying to do is:

  1. Select “Silence 01”;
  2. Insert some silence into “Silence 01” to make it longer;
  3. Select next “Silence 02”;
  4. Remove a piece from “Silence 02” to make it shorter;
  5. Repeat until the end of the audio.

Because there are many silences, I’d like to have a shortcut for it, for example, press Ctrl + comma to insert 0.1s of silence, and press Ctrl + period to remove 0.1s.

(The code that I recommend here is NOT mine.)

Someone posted code for a Nyquist plugin (modified from someone else’s), using the Change Tempo function to extend selected silence by 0.1s.


Here’s how to install it. Afterward, you can create a similar plugin to remove 0.1s.

Save the plugin code from that post to a file. Give it an appropriate filename with the .ny (Nyquist) extension.

Use a text editor to change “version 5” to “version 4” (to prevent the compatibility error mentioned in the post).

Then, in Audacity:

Tools > Nyquist Plugin Installer   
Browse > (navigate to the file)    

On successful installation, a confirmation dialog appears. (Take note: it will show the location of the plugins folder in which the plugin has been installed.) Dismiss the dialog. Rescan plugins:

Tools > Plugin Manager > Rescan

When the rescan completes, set Category to “Tool” and verify that the “Increase Silence Duration” plugin is listed and Enabled (check-marked). Click OK.

Set your shortcut key:

Edit > Preferences > Shortcuts
View by > Tree (or Name)
Search > Increase Silence Duration
Select it and set a key. Click OK.

Label some silences. Select the first silence label and its audio. Test the shortcut key. If the key doesn’t invoke the plugin, make sure the Audacity window has focus and try again. If it still doesn’t work, try setting some other key for the shortcut.

Because you selected the label and its audio, the label will be stretched with the audio, and the other labels on the right will be shifted with their audio.


Create a similar plugin that removes 0.1s:

Make a copy of the plugin file, with an appropriate name and the .ny extension.

Edit it:
Change “Increase” to “Decrease”.
Find this line:

(setf TARGET-LEN (+ trk-len 0.1))

Change + to

(setf TARGET-LEN (- trk-len 0.1))

Install the plugin and set a shortcut key.


Obvious note of caution:
Before each use of this plugin, check the accuracy of the selected silence label. If any non-silent audio is accidentally included in the selection, obviously it’ll be affected by the tempo change.