From your original brief,
Suppose that the current selection of audio corresponds to 1.19 seconds of duration. I am looking for a convenient way to insert a stretch of silence to the right of this selection (aka “(right-)padding”) so that the duration of the selection plus the newly added right-padding is 2 seconds.
This can be done quite easily with Nyquist, but unfortunately there is a bug in Audacity 3.0.2 that prevents it from working. It should work in Audacity 2.4.2 or earlier, and will work in Audacity 3.0.3 when it becomes available (hopefully quite soon).
This is the required code:
;type process
(setf target-length 10)
(sim (abs-env (s-rest target-length))
*track*)
Explanation:
Tell Audacity that we are processing the selection:
;type process
Set the required length:
(setf target-length 10)
Generate silence equivalent to the entire length:
(abs-env (s-rest target-length))
and add (mix) it with the original track audio:
(sim (abs-env (s-rest target-length))
*track*)
The code can be easily converted into an installable plug-in by adding the “required headers” (https://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference)