lengthen silences

effects - truncate silence is great and works well.

Is there an opposite though? - ie something which would automatically locate the silences and then increase them by a changeable percentage?


Analyze > Silence Finder will locate silences and place a label at each one.
However, you will have to go through manually increasing the length of the silences.


The quickest way to do that is to Generate silence for the first marker, then copy that silence (Ctrl+C). Once you have copied the silence, you can paste it by simply clicking where you want it at pressing Ctrl+V

I know I can do it manually, however that is not practical for the application I have in mind. (I have an audio version of the Bible - in 1189 files. I want to add a pause - ie a lengthened silence - after each phrase, therefore I want to add an estimated 25K pauses, therefore accomplishing this by using chains or similar is highly preferable!)

How about burning to CD. Some CD burning programs (such as Nero) allow you to put silences of user defined length between each track (or you can pause the CD player). Most CD burning programs will insert a 2 second pause between tracks by default.

The maximum number of tracks on an audio CD is 99.

Audacity cannot import multiple tracks one after the other (append import). Imported tracks are always one audio file per track (each new import is on a track below the previous one).

It seems like this feature request http://forum.audacityteam.org/viewtopic.php?f=15&t=21595&p=67406#p67406 would provide what you want.

I don’t want to lengthen silence after each track but more like after each sentence, or certainly after each verse. I’d have to experiment with choosing suitable parameters to detect the silence, but Audacity is already good at that.

Also I don’t want to append - just want to process the 1189 files separately and export them as mp3 again (slightly lossy procedure I know) - so I’d be importing a file, lengthening say 10 to 200 silences and then exporting.

Thanks for your replies.

Yes ok then: use the silence finder to identify the silences, this will create a whole slew of labels one for each silence. Then use Export Multiple to export a set of WAV files based on the silence-labels. Then as Steve suggest burn the CD with intertrack gaps of the required length.

The limitation that you are likely to run in to is one imposed by the Red Book standard for CDs in that the maximum number of tracks allowed on a CD is 99. To circumvent this just burn the CDs in cunks of 99 tracks - blank CD-Rs cost c. 10USc/10pUK - so getting through a stack of those will still be cheaper tahn your time.


Out of curiosity: just why do you want a gap at the end of each biblical phrase?


The 1189 tracks with current silences are 75hrs, so I think I’ll keep looking rather than go down the CD route.

Out of curiosity: just why do you want a gap at the end of each biblical phrase?


It is read at normal speed, but I’d like to try it with longer pauses for comprehension. I’ve tried the Change Speed effect in Audacity, but that doesn’t sound too good.

I didn’t know about Export multiple (thanks Steve) - or that it could split the track at each silence, so that is a good step forward. I just need a joiner now that will add silence at beginning or end.

I’ve hacked the code of the Silence Finder plug-in so that it will insert additional silence instead of creating labels.
This is a “quick ‘n’ dirty” hack rather than a polished piece of code, so there are a few limitations:

  1. probably requires Audacity 1.3.7 or later (only tested on 1.3.11)
  2. quite memory hungry - applying to long tracks will probably crash Audacity. To ensure that used memory is released, restart Audacity.
  3. mono tracks only.
    (the “category” is also wrong, but this will not affect current versions of Audacity)

To see where silence will be inserted you can run “Silence Finder” first, then use the same settings for “Silence Lengthen”

To use, extract the attached file into your Audacity plug-ins directory. Restart Audacity and “Silence Lengthen” will appear in the Effects menu.
silencelength.ny.zip (2.15 KB)

Wow that works! I just tried it on a 55 minute track and it handled that fine. Would I be able to incorporate it into a chain?? At the moment it shows up below the line near the bottom of effects and the ones there don’t show up in the SELECT COMMAND window when editing a chain.

My application is probably a bit obscure, but I think this effect would be a very useful addition to Audacity for use in transcribing audio; I’ve often done that in the past and usually end up contstantly backtracking to get it right. I’ve also used change speed for that as well but to be able to lengthen silences would likely be a much better way to do it.

Wow that’s a lot better than expected :smiley:

Unfortunately no. Currently chains only support effects that are hard coded into Audacity.
Improving Chains is another commonly requested feature.

“a bit” !!! :wink:

Hmm, you could have a point there.
The plug-in is open source, so if anyone wants to polish it up they are most welcome to do so. I may have another go at it myself at some point, but I’ve got a few other things on the go at the moment.

I’m indebted to you Steve - for this, and of course to the whole Audacity team. I use Audacity a lot and its great, and the way it keeps improving so quickly is great too - oh and the quick responses here are great as well of course. At the rate you are going, I expect you’ll be getting offers from Adobe before long.

Your welcome.

Dear Steve, I really do need to get this code to lengthen silences. However I just can’t figure out how to put the plug-in into my my Audacity’s plug in folder on a MAC. As far as I can see, the Audacity program resides on the mac in some kind of virtual volume, and it seems to be locked. There is no way I can find to add or change any files in my audacity virtual disk, or in the “plug-ins” folder on it. Please can you tell me how to install it on a MAC. Thanks

I need to automatically insert silences because I have long Language Audio files for learning Chinese. It is very difficult to repeat the phrases, but there is only a gap of a few seconds between each phrase for me to repeat it. I want to extend those silent gaps to around 10 or 15 seconds each.

Thanks TrickyT

Sorry trickyt57 I’ve no idea about Macs. You will probably be best to post your question in the Mac forum.
I presume that you are using Audacity 1.3.12, if not you can get 1.3.12 from here: http://audacityteam.org/download/

The Mac (1.3.x) forum is here: http://forum.audacityteam.org/viewforum.php?f=17

It sounds like you are trying to run Audacity from the disk image. Don’t do that. Not only with Audacity, but any program. Create a folder inside your Applications folder. Call it anything, but “Audacity 1.3” is a good name. Now copy the entire contents of the .dmg (the “virtual disk”) into that folder. Eject the disk image. Run Audacity from the folder in your Applications folder.

– Bill

Bill many thanks for the advice. I did as you suggested and lengthening the silences in audacity files works fine on my Mac. I just took a 35 minute language repetition tape and expanded it to over 2 hours by automatically inserting 20 second pauses between phrases and then duplicating it and time shifting so now everything gets said twice and with much longer pauses. Just one point to note. It could not do the whole file in one go without crashing. I had to highlight 4 minute stretches at a time and lengthen the silence for that section only. Still its much faster than expanding it phrase by phrase. Steve, thanks again for a great useful program or add-in.

Sorry about that, but as it says earlier in this topic it’s just a bit of an ugly hack, but glad you’ve found it useful.

Is there any further developed version of silencelength.ny?

Is there another similar plug-in?

Truncate Silence would do it, but unfortunately it end at 1:1, so I can’t do an decompression.

Any other tips?

Here is a stereo expansion of SilenceLength.ny
My anyone have a look or try it , whether there are any bugs?

;nyquist plug-in
;version 1
;type process
;categories "http://lv2plug.in/ns/lv2core#AnalyserPlugin"
;name "Silence Lengthen 2"
;action "Inserting silence..."
;info "Based on Silence Finder by Alex S. BrownnReleased under terms of the GNU General Public License version 2nHacked by Steve Daulton as a 'proof of concept'.nn"
;control sil-lev "Treat audio below this level as silence [ -dB]" real "" 26 0 100
;control sil-dur "Minimum duration of silence [seconds]" real "" 1.0 0.1 5.0
;control slen "Length of Silence to Insert" real "[seconds]" 1 0.1 30

(setq labelbeforedur (/ sil-dur 2.0))

;Create a function to make the sum the two channels if they are stereo
(defun mono-s (s-in) (if (arrayp s-in) (snd-add (aref s-in 0) (aref s-in 1))

;Create a function to reduce the sample rate and prepare the signal for
;analysis. RMS is good to monitor volume the way humans hear it, but is not
;available in Audacity. Used a peak-calculating function instead.
;NOTE: this is the place to add any processing to improve the quality of the
;signal. Noise filters could improve the quality of matches for noisy signals.
;Reducing the samples per second should improve the performance and decrease
;the accuracy of the labels. Increasing the samples per second will do the
;opposite. The more samples checked, the longer it takes. The more samples
;checked, the more precisely the program can place the silence labels.
;my-srate-ratio determines the number of samples in my-s. Set the number after (snd-srate s)
;higher to increase the number of samples.

(defun my-s (s-in)
 (setq my-srate-ratio (truncate (/ (snd-srate (mono-s s-in)) 100)))
 (snd-avg (mono-s s-in) my-srate-ratio my-srate-ratio OP-PEAK)

(defun space (s-in time)
(stretch-abs 1.0
      (at 0  (s-rest time))
      (at time (seq (cue s-in)(cue  (s-rest time)))))))

;Set the silence threshold level (convert it to a linear form)
(setq thres (db-to-linear (* -1 sil-lev)))
;Store the sample rate of the sound
(setq s1-srate (snd-srate (my-s s)))
;Initialize the variable that will hold the length of the sound.
;Do not calculate it now with snd-length, because it would waste memory.
;We will calculate it later.
(setq s1-length 0)
;Initialize the silence counter and the labels variable
(setq sil-c 0)
(setq l NIL)
;Convert the silence duration in seconds to a length in samples
(setq sil-length (* sil-dur s1-srate))

;Define a function to add new items to the list of labels
(defun add-label (l-time l-text)
 (setq l (cons (list l-time l-text) l))

;The main working part of the program, it counts
;the number of sequential samples with volume under
;the threshold. It adds to a list of markers ever time
;there is a longer period of silence than the silence
;duration amount.

;It runs through a loop, adding to the list of markers (l)
;each time it finds silence.
(let (s1) ;Define s1 as a local variable to allow efficient memory use
 ; Get the sample into s1, then free s to save memory
 (setq s1 (my-s s))
 ;Capture the result of this "do" loop, because we need the sountd's legnth
 ;in samples.
 (setq s1-length
  ;Keep repeating, incrementing the counter and getting another sample
  ;each time through the loop.
  (do ((n 1 (+ n 1)) (v (snd-fetch s1) (setq v (snd-fetch s1))))
   ;Exit when we run out of samples (v is nil) and return the number of
   ;samples processed (n)
   ((not v) n)
   ;Start the execution part of the do loop
   ;if found silence, increment the silence counter
   (if (< v thres) (setq sil-c (+ sil-c 1)))

   ;If this sample is NOT silent and the previous samples were silent
   ;then mark the passage.
   (if (and (> v thres) (> sil-c sil-length))
 	  ;Mark the user-set number of seconds BEFORE this point to avoid clipping the start
 	  ;of the material.
    (add-label (- (/ n s1-srate) labelbeforedur) "S")
   ;If this sample is NOT silent, then reset the silence counter
   (if (> v thres)
    (setq sil-c 0)

;Check for a long period of silence at the end
;of the sample. If so, then mark it.
(if (> sil-c sil-length)
 ;If found, add a label
 ;Label time is the time the silence began plus the silence duration target
 ;amount. We calculate the time the silence began as the end-time minus the
 ;final value of the silence counter
 (add-label (+ (/ (- s1-length sil-c) s1-srate) sil-dur) "S")

;If no silence markers were found, return a message
(if (null l)
 (setq l "No silences found. Try reducing the silencenlevel and minimum silence duration")
(setf insert (list (get-duration 1)))
(dotimes (times (length L))
(setf insert (push (car (nth times L)) insert)))
(setq insert (push 0.0 insert))

(setq slist (list (multichan-expand #'extract-abs (nth 0 insert)(nth 1 insert) s)(multichan-expand #'extract-abs (nth 1 insert)(nth 2 insert) s)))

(setf slist ())
(setq seg (1- (length insert))) ; number of segments

(dotimes (var seg)
   (setf slist (push (multichan-expand #'extract-abs (nth (- seg (1+ var)) insert)(nth (- seg var) insert) s) slist)))

(seqrep (var seg)
      ;(cue (nth var slist))
      ;(cue (stretch-abs 1.0 (s-rest slen)))
	  (multichan-expand #'space (cue (nth var slist)) slen)