Insert Silence at Cursor Position

Hi everyone, I tried to write another plugin that inserts a silence section at the given position, or the cursor position to be exact. For some reason, I want it to work with cursor instead of a selection. Well it does work, but not as expected, as it inserts a new clip in between. Can I make it insert a silence section without creating new clips? Thanks anyway!
insert-silence-2.ny (318 Bytes)

image
Original

image
Worked but not as expected

image
Expected result

Why not use the built-in “Generate > Silence”?

To answer your question, use the mergeclips header.

Note also that Nyquist only has limited knowledge of the Audacity environment, and treats time as relative to the start of the selection (or cursor position). This means that generated audio is automatically inserted at the cursor position unless you tell it otherwise. This makes the plug-in more simple:

;nyquist plug-in
;version 4
;type generate
;name "Insert Silence"
;mergeclips 1
;release 1.0.1
;author "Steve Chow"
;info "Released under under GPL v2."

;control duration "Duration of silence (seconds)" real "" 1 0.01 10

(s-rest duration)

1 Like

Thank you! That’s awesome!
The reason I use a plugin instead of the built-in Generate Silence, is that I want to give it a fixed duration, say 0.1s, and assign a hot key to the plugin, so it become like a shortcut, which inserts some silence with a single click, quick and easy. Well there may be other ways, but this is what I can think of.

This topic was automatically closed after 30 days. New replies are no longer allowed.