Quickly Extend or Shrink a Selection

(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.

https://forum.audacityteam.org/t/incompatible-plugin/105391

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)    
Apply

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.

1 Like