Extend Silences

Share your Audacity/Nyquist plug-ins here, or test drive the latest plug-ins submitted by Audacity users.

After testing a plug-in from this forum, please post feedback for the plug-in author.

Extend Silences

Permanent link to this post Posted by steve » Fri Jun 27, 2014 11:40 am

Topic split from viewtopic.php?f=39&t=72304

This plug-in was originally developed in response to a request for a way to "stretch" the pauses in a language tutorial recording so that the user has more time to repeat each phrase. The plug-in is not restricted to speech recordings - it may be used in any type of recording where there is a need to extend the silences within the recording.

The plug-in code has copious in-line comments that describe how the plug-in works.
To view the code, open the plug-in file ("ExtendSilence.ny") in a plain text editor (such as NotePad or the excellent NotePad++). For more information about Nyquist code, see: viewtopic.php?f=39&t=77214

How it works:
The plug-in scans the selected track, looking for places where the audio level remains below a specified level (the "Threshold") for more than a specified period. These places are classified as "silences". The plug-in then extends each detected "silence" by inserting additional silence at the end of each detected silence.

The amount of silence inserted may be defined in three ways:
  1. As an absolute length (in seconds).
  2. As a proportion of the length of the detected silence.
  3. As a proportion of the length of the preceding sound.
Any of these three methods may be used used at the same time.

For example, for a language tutorial CD, you may want to extend each "pause" by 50% of the length of the preceding phrase, plus 2 seconds. The resulting silence will then be:
{the length of the detected silence} + {50% of the length of the preceding phrase} + {2 seconds}


Controls:
  1. Threshold for silence (dB): [-100 to 0 dB. (default = -40 dB)]
    The peak level needs to drop below this level to be counted as "silence". If there is background noise, the threshold will need to be raised to a higher (less negative) level.
  2. Min detected silence (seconds): [0.1 to 10.1 seconds. (default = 1.0 seconds)]
    If the audio remains below the Threshold level for at least this length of time, it will be classed as "silence". Set to a smaller number if you wish to extend short gaps, or to a larger number if you wish to extend only long silences.
    Values greater than 10 seconds (up to 100 seconds) may be entered by typing into the text box.
  3. Add silence duration (seconds) [0 to 10 seconds (default = 5.0 seconds)]
    This extends each detected silence by the specified amount.
    Values greater than 10 seconds (up to 100 seconds) may be entered by typing into the text box.
  4. Add % of detected silence duration: [0 to 100 % (default = 0 %)]
    This extends each detected silence by an amount equal to a specified percentage of the detected silence. For example, if the detected silence is 10 seconds duration and this control is set to 50%, then 5 seconds of silence will be added.
    Values greater than 100 % (up to 1000 %) may be entered by typing into the text box.
  5. Add % of previous sound duration: [0 to 100 % (default = 0 %)]
    This extends each detected silence by an amount equal to a percentage of the duration of the preceding sound. For example, if there is a sound of 10 seconds duration before the detected silence, and this control is set to 50 %, then 5 seconds of silence will be added.
    Note leading silence before the first sound will not be extended by this control because there is no preceding sound.
    Values greater than 100 % (up to 1000 %) may be entered by typing into the text box.

The plug-in:
ExtendSilence.ny
(5.11 KiB) Downloaded 396 times

Installation instructions: http://wiki.audacityteam.org/wiki/Downl ... g_Plug-ins

Feedback and comments from plug-in users are an essential part of developing useful plug-ins.

For feedback, comments or questions, please post a reply to this topic.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44624
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Extend Silences

Permanent link to this post Posted by pbassham » Mon Sep 08, 2014 9:13 am

I am also using this for language learning and this is almost exactly the plugin I need.

Is there a way it can be modified to have the option to add the silence to the End or Beginning of the track automatically? (instead of inserting it where silence already is)

Reason is, I have each sentence as 1 track, and I am trying to create 2 other versions - One with silence after (for repeating), and one with silence before (to say the sentence before the 'answer')

But with such short tracks, and sometimes not perfect recordings, it is not about extending silence, but just adding the right durations of silence, either to the beginning or the end.

Another, less important option (for me at least), question: what about reducing silence to the correct duration? for instance, for a track with several sentences, but too much silence in between several phrases. Is there a way to put in just the right amount of silence, reducing if necessary, and adding if necessary?
pbassham
 
Posts: 8
Joined: Mon Sep 08, 2014 8:37 am
Operating System: Please select

Re: Extend Silences

Permanent link to this post Posted by pbassham » Mon Sep 08, 2014 9:51 am

Something like this plugin, but the option to also add the silence at the beginning.

viewtopic.php?f=42&t=72607

Also, is there a way to bulk add an effect like this to each track individually instead of summing everything together, or having to repeat the effect for each track separately?
pbassham
 
Posts: 8
Joined: Mon Sep 08, 2014 8:37 am
Operating System: Please select

Re: Extend Silences

Permanent link to this post Posted by steve » Mon Sep 08, 2014 10:33 am

pbassham wrote:Is there a way it can be modified to have the option to add the silence to the End or Beginning of the track automatically? (instead of inserting it where silence already is)

See "Trim / Extend" http://wiki.audacityteam.org/wiki/Nyqui ... .2F_Extend

pbassham wrote:Also, is there a way to bulk add an effect like this to each track individually instead of summing everything together, or having to repeat the effect for each track separately?

Unfortunately "Nyquist plug-ins" cannot tell the difference between empty track space ("white space") and "silence". They are also not able to see where audio clips start/end. Nyquist plug-ins can therefore not be reliably used for processes where the start/end of audio clips need to be considered. Rather, Nyquist plug-ins can only act on the current "selection". However, please see this section in the manual about batch processing: http://manual.audacityteam.org/o/man/ch ... ation.html
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44624
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Extend Silences

Permanent link to this post Posted by pbassham » Mon Sep 08, 2014 10:53 am

Thanks. I have used the trim/extend plugin, but what I am going for is the ability to modify the amount of silence added relative to the selection/length of the audio or track.

If that makes sense.
pbassham
 
Posts: 8
Joined: Mon Sep 08, 2014 8:37 am
Operating System: Please select

Re: Easy way to add silence??

Permanent link to this post Posted by Dr. Righteous » Wed Sep 17, 2014 4:58 pm

Split from http://forum.audacityteam.org/viewtopic.php?f=48&t=81204

Well, it does work but not perfectly.
I was able to extend the silences in the program to meet the minimum.
But what I noted there was a "thump" that hit about -30db when the additional time was added.
You couldn't hear it but it bumped the VU meters. The timer and time remaining don't work.
When the timer ran out it just sat for a couple minutes before it completed.

So overall, it works but needs some fine tuning.

Thanks guys.
Dr. Righteous
 
Posts: 38
Joined: Wed Apr 02, 2014 10:20 pm
Operating System: Please select

Re: Extend Silences

Permanent link to this post Posted by steve » Sun Sep 21, 2014 11:21 am

Dr. Righteous wrote:But what I noted there was a "thump" that hit about -30db when the additional time was added.

Thanks for the feedback.
The "thump" is probably due to the sudden change between low level noise in the "silence" that you are extending and the "absolute silence" that is inserted by the effect.
That is quite a tricky "problem" to address automatically because different use cases will probably require different approaches. One method would be for the effect to add a short fade-out to the original audio before inserting the silence and a short fade-in when returning to the original audio. Another approach would be to insert low level noise rather than absolute silence. There are probably other approaches too, but I can't think of a general method that will suit all applications. The "best approach" is to use the effect on audio where the gaps to be extended are already "silent" (very low level) - for audio where that is not possible, use of a noise gate prior to inserting the silences may help.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44624
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Extend Silences

Permanent link to this post Posted by uvhwpevx » Thu Aug 06, 2015 10:53 am

...inserting additional silence at the end of each detected silence...

Hi Steve! Your plugin is amazingly useful! But it cuts some nearly quiet beginnigs of words. Could you add an option to choose where silences to insert: at begins, MIDDLES or ends of detected silences?! Thank you!
uvhwpevx
 
Posts: 10
Joined: Thu Aug 06, 2015 9:11 am
Operating System: Please select

Re: Extend Silences

Permanent link to this post Posted by steve » Thu Aug 06, 2015 6:09 pm

uvhwpevx wrote:But it cuts some nearly quiet beginnigs of words.

Try reducing the "Threshold" setting (a more negative number).
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Site Admin
 
Posts: 44624
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Extend Silences

Permanent link to this post Posted by uvhwpevx » Fri Aug 07, 2015 12:32 pm

where silences to insert: at begins, MIDDLES or ends of detected silences

To cut them into silence pieces at any % as wanted, I just replaced:

1. That line:
Code: Select all
;control add-snd-pc "Add % of previous sound duration" real "" 0 0 100
by this:
Code: Select all
;control add-snd-pc "Add % of previous sound duration" real "" 0 0 100
;control ins-pos-pc "Insert at % of detected silence piece" real "" 100 0 100


2. That line:
Code: Select all
(setq snd-ratio (/ (constrain add-snd-pc 0 1000) 100.0))
by this:
Code: Select all
(setq snd-ratio (/ (constrain add-snd-pc 0 1000) 100.0))
(setq pos-ratio (- 1 (/ (constrain ins-pos-pc 0 1000) 100.0)))


3. And that line:
Code: Select all
(push (list (/ count lo-rate) (/ sil-count lo-rate)) sil-list))
by this:
Code: Select all
(push (list (- (/ count lo-rate) (* (/ sil-count lo-rate) pos-ratio)) (/ sil-count lo-rate)) sil-list))
uvhwpevx
 
Posts: 10
Joined: Thu Aug 06, 2015 9:11 am
Operating System: Please select

Next

Return to New Plug-Ins



Who is online

Users browsing this forum: No registered users and 1 guest