Edit-and-Replace gaps (of silence)

I am recording text; I read from a sheet of text, and have learned to plough on ahead, to clap my hands twice when Ii make an error and start again while letting the recorder run on. Then, of course, I play back from the start looking for those twin peaks which signal a hand-clap, delete the bad recording and leave a gap.
I try to make gap between sentences be around one second in length, but me being me, the gaps range from half a second to two seconds.

In Audacity 3.1.3 Win10 is there an easy way to “edit and replace” a gap that ranges between two given lengths (from half a second to two second) and replace the found gap with a gap of a fixed length (one second)?
Thank you in anticipation.
Chris Greaves

I’ll leave the possibility of doing this to others (there’s a Truncate Silence effect which may do half of what you want).

But I’m wondering how much you want this. What kind of projects are you recording for? In lots of work, varying silences are natural and help with ease of listening - making them all an exact length could make the recording sound subtly artificial or monotonous, even if the overall audio is entirely natural.


I use the following Macro. First I store a length of silence (or room tone) on the Punch/Copy Paste Clipboard. This stays on the clipboard until you replace it.

Then I select the section of audio I want to replace and execute the Macro. The section I highlighted is replaced by 1.2 seconds of what is on the Punch/Copy paste Clipboard. You can replace 1.2 in Macro with however many seconds you want the “silence” to be.

Is that what you are looking to do?


Thank you SecretCode. Good Questions!

(1) I want this a lot!
(2) I am recording for LibriVox, and one project (JS Bach) was written in German, translated into English, is choc-a-bloc with German, Italian (addagio) and English, lacking in commas (which I discover after three lines of text when i run out of breath), and has footnotes in English and German which run to 3/4 of a page, and occasionally are split between two pages (typically even-to-odd page so that as a hard-copy book they span as a block across two pages). There are typographical errors and back-then recognized abbreviations such as “Whit” for “Whitsunday”. Some of the footnote content is irrelevant (“One can be bought nowadays for £10”) or just useless in a (serial) audiobook (“See page s456”)
(3) You can’t begin to imagine the nightmares that wake me up at this hour of the morning; I started at 1:30a.m. and the time is now 3:15a.m. Recording is Real Work (because my German is a bit stale), and so I record each page of the book as a separate MP3 file and then go back and edit a dozen or so pages/MP3s all at once. I am, of course, learning how to use Audacity!
(4) I agree that natural spaces vary somewhat randomly, as does my tone of voice when I read half a page of numbered references to cantatas or arias. An exact length of silence might make the recording monotonous; but perhaps the variety of language with a corresponding change in tone helps a bit there.

I was thinking of a tool that would render every gap (between 0.5 and 2 seconds) to a standard length gap, all at once for an MP3 file (computers being good at doing boring and repetitive work) and then going back and making occasional adjustments where required. I edit out quite a few clicks/pops/ and so on, throat clearing, re-records (signaled by a double hand-clap followed by the new phrase), so all in all I end up with MP3 files containing rather large gaps, sometimes up to thirty seconds.

I see that mafg1953 has posted a macro, so I shall look at that later this morning.

Audacity is so rich in features that it is overwhelming. I have searched the menu system but didn’t spot anything that jumped out at me. (I am thinking of writing a short paper on the number of different ways ro introduce “silence” into a track!)

Thanks again

:smiley: Oh yes.

Just a note, MP3 is fine for the final output, but it’s much better to use WAV for original recordings and any intermediate files you are still going to edit. MP3 is a lossy format and each time you decode & encode it, distortion can increase.

Thank you too, for this tip.

I understand “degradation of signal” well, although not (until now) in terms of Audacity.
In LibriVox MP3 is their standard, but as far as i know, there is no insistence on the working format, and, to my dismay, no insistence on Audacity as the approved editor. (I believe that their Help Files would be better of help was given for a single audio editor)

Space-Volume (of WAV files) ought not to be a problem since they will be transient. I archive (PKZip.exe) the documents and MP3 files after submitting the final MP3, and right now can’t think of a reason for keeping my “studio version” WAV files.
Thanks again.
Now, about those macros … (grin)

Chris - I assign the Macro to a Keyboard Shortcut which I then assign to one of my mouse buttons. So all I need to do is highlight the section I want to replace and cliclk the assigned mouse button.

I use the Logitech M720 Mouse that has extra buttons and all buttons can be programmed based on the program you are running - very flexible.


Mike. First off THANK YOU! I was hoping only that I had overlooked a “find/replace” command. I had not realized that Audacity had macro capabilities. My first serious Macro task was modifying the IOCS macro on an IBM 1401 back in 1968/69, so you can see that macros have been the light of my life for a long time. Macros in Audacity? Today could see my resignation from LibriVox (grin)

I have created a very small macro to add Echo to a track, but please don’t tell LibriVox or they will kick me out. I have a grillion questions now, most of which will cause me to study all the available commands that arise from 'Insert" when editing a macro.

I see too that your Most active topic is “Enhancement for Macros”; more reading to be done!

Now: I have eyeballed your macro, and I can see what it does, almost, and your overview helps. I will study your chosen commands in more detail and learn what they do. I do follow the logic of (a) storing some sound in the clipboard and then (b) copy/pasting it to a selected location. As well I can see my way to reducing all gaps greater than (say) two seconds down to two seconds, and then all gaps less than two seconds to a fixed 0.5 seconds, which would remove my pauses while I mentally rehearse some German pronunciation or work out where the next batch of commas should be and (b) make all sentence gaps a fixed length.

That said, my first glance suggests that Audacity macros are somewhat like MSAccess macros; they permit a linear assembly of commands, but do not provide a programming capability. By that I mean that If/Then/Else and Do/Loop constructions are not possible. I see too the thread “Create a Macro with a infinite loop”. More reading to be done!

Lack of programming ability is not fatal; I have spent my working life automating what I can, where I can, and assigning a macro to a shortcut key, and so pressing the shortcut key as often as is necessary, is much better than issuing each command manually, and repeatedly.

I must now do my daily session of recording, which I will complete as soon as I can and then rush back here to wallow in macros.

Please do me a favour, and take the rest of the day off.
You have earned it.
Cheers, Chris

Chris, I was programming back in the mid '70s in COBOL. Still hanging in there …

Let me know if the Macro needs clarification.

There is a built-in Truncate Silence Effect that you might find useful as well.

I think you can do that with Nyquist Commands that you can program. I don’t know anything about them, but there is documentation …


Mike, you will be hanging forever. COBOL is a stupid language; it has no macro capability. I should know. COBOL fed me for almosty thirty years. :laughing: :laughing: :laughing:

Let me know if the Macro needs clarification.

Don’t worry about that, Mike. You are on the hook and cannot wriggle off.

I think you can do that with Nyquist Commands that you can program.

I have seen references to Nyquist and might be forced to add yet-another-language to my brain.
But I will start with standard Audacity commands. I have set myself a project to build a catalogue of small, simple, modular macros that will relieve me of the Boring and repetitive tasks in my daily workload of recording tracks for LibriVox. Once I have achieved that plateau I will set a new goal.

Mike, thank you for the encouragement; I may be a day or two before I get back. There is a great deal to study^H^H^H^H^H play with.

I forgot to do this, but that is not important yet.

Mike, I spent a bit of time getting a rough idea of the commands in your example, then built eight macros of my own doing trivial things from the menu (“Tone” and the like), and then built your macro from your image using the “Insert” command to select and insert commands one by one:

Comment:_="1.2 seconds room tone"
Comment:_="1.2 seconds room tone"
SelectTime:End="1.2" RelativeTo="SelectionStart" Start="0"
SelectTime:End="1.2" RelativeTo="SelectionStart" Start="0"

My system does not have a “Punch Paste” command in that table of macro commands (Tools, Macros). I am Win10, Audacity 3.1.3 from just two or three weeks ago.
When I have run this macro successfully, I would like to document it and send you my notes, to see if I have understood each function line.


Sorry, I forgot you need to download the plugin. The Punch Copy/Paste is a Nyquist Plugin that you can read about here:


… and download from here:


… and there is an updated feature if you need it here:



Bingo! I ran the macro and it inserted 1.2 seconds of silence.
I made a separate macro to effect the copy to the plugin’s clipboard, because I couldn’t see how to execute it from the menu system

PunchCopy/paste:curve="Linear" fade-seconds="0" loop="Enable looping" mix="100" mode="Copy (safe)"

Now let’s see if I can devise a plan to do it all in one macro:
(1) Before running the macro, there will be a 5-second gap of space at the end of the track. This is a LibriVox convention.
(2) Select the first gap to be standardized
(3) Run the macro.
The macro
(a) Stores the current cursor or selection pointers
(b) Selects the last five seconds of the track
(c) Copies that five seconds to the Plugin clipboard
(d) Returns to the stored selection
(e) Does all the clever commands in your original macro.
Would Audacity support that kind of a pre-process to make this a one-shortcut-key process?
Copying that five seconds each time wouldn’t worry me at all.

Then (heh heh) One might [somehow] issue commands to locate the next gap of a specified size (say, 0.5 of a second), and move the cursor to that next gap, leaving the system set up for a second, then a third use of the shortcut key.

I am not yet planning to do this.
I wanted to know if my thinking lies within the bounds of Audacity macros.

I have many more questions of a general nature about Audacity macros, but will post them in a separate thread.

Mike, again, thanks for your help.

Chris, I think this is doable. You can store the cursor position and return to it and you can make a time selection that is 5 seconds relative to the end of the track and copy it to the clipboard. I believe that each of those commands are available within the Macro commands.