# How to automate the replacement of pauses with noise with "silence" of my own?

**URL:** <https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677>\
**Category:** Audio Processing\
**Created:** [February 26, 2025, 5:13pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677 "2025-02-26T17:13:44Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![ralhas](https://forum.audacityteam.org/letter_avatar_proxy/v4/letter/r/b9e5f3/32.png) [@ralhas](https://forum.audacityteam.org/u/ralhas)\
**Post date:** [February 26, 2025, 5:13pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/1 "2025-02-26T17:13:44Z")

</div>

Hi there,

To replace pauses (which often include sighs and external noise) with silence, I usually use a clip I made with “silence” recorded in empty room and with most of the noise removed. I then select the noisy pauses and replace them that “silence” clip. But this takes quite a time, depending on the length of audio, and eventually the number of pauses between the pronounced sentences.

Is it possible to automate this process somehow, by selecting all the pauses below some threshold value and replace them with my clip of certain length?

I tried **Effect → Truncate Silence** , but I can still hear the sighs and noise no matter how I change “Duration”.

Thank you!

---

<div class="post-metadata">

**Author:** ![Trebor](https://forum.audacityteam.org/user_avatar/forum.audacityteam.org/trebor/32/45854_2.png) [@Trebor](https://forum.audacityteam.org/u/Trebor)\
**Post date:** [February 26, 2025, 5:42pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/2 "2025-02-26T17:42:18Z")

</div>

Punching-in room noise is possible …

> [@Punch Copy/Paste](https://forum.audacityteam.org/t/punch-copy-paste/28906):
>
> A pair of plug-ins for simplifying “punch in” editing. Unlike the standard paste function in Audacity, the “punch” paste replaces the selected audio with just the right amount of pasted audio to match the duration of audio being replaced, thus the speed and timing of the track is not changed by pasting. These plug-ins were developed from a feature request on the forum ([https://forum.audacityteam.org/t/alternate-equal-length-paste-command-resolved/28836/1](https://forum.audacityteam.org/t/alternate-equal-length-paste-command-resolved/28836/1)) to streamline the work flow of replaci…

---

<div class="post-metadata">

**Author:** ![ralhas](https://forum.audacityteam.org/letter_avatar_proxy/v4/letter/r/b9e5f3/32.png) [@ralhas](https://forum.audacityteam.org/u/ralhas)\
**Post date:** [February 26, 2025, 6:17pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/3 "2025-02-26T18:17:30Z")

</div>

Thank you for your prompt reply!

Well, I can easily copy/paste the so-called “room tone” anyway, using a pre-recorded audio clip. In fact, Audacity does a great job of saving the clip in a separate clipboard, without interfering with the rest of the memory I can use for copying/pasting in other applications.

I just need to **automate** the process of pasting the “room tone” clip throughout the **whole length** of the audio, not just a single time, using the plugin you provided above. Is that possible? Maybe using the same “Punch Copy/Paste”?

As far as I understand, “Truncate Silence” just truncates the length of pieces it considers silence based on the specified threshold value, without actually reducing noise in the found parts. But I need to go a step further - reduce noise in that found parts or replace them with the “room silence” clip I have in hand.

Thanks!

---

<div class="post-metadata">

**Author:** ![ralhas](https://forum.audacityteam.org/letter_avatar_proxy/v4/letter/r/b9e5f3/32.png) [@ralhas](https://forum.audacityteam.org/u/ralhas)\
**Post date:** [February 26, 2025, 9:43pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/4 "2025-02-26T21:43:57Z")

</div>

After some trial and error, I have been able to select and export to a text file all such “noisy” pauses through **Analyze → Label Sounds**. There are more than 200 such labels, a.k.a pauses. Now the question is how I can effectively paste my room tone clip to **all** these labels, preferably in a single run.

Macros? Nyquist scripting? Any clue?

---

<div class="post-metadata">

**Author:** ![Trebor](https://forum.audacityteam.org/user_avatar/forum.audacityteam.org/trebor/32/45854_2.png) [@Trebor](https://forum.audacityteam.org/u/Trebor)\
**Post date:** [February 26, 2025, 11:25pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/5 "2025-02-26T23:25:52Z")

</div>

_Theoretically_ could [gate](https://manual.audacityteam.org/man/noise_gate.html) the noise to silence, then use the gated track to [AutoDuck](https://manual.audacityteam.org/man/auto_duck.html) a track of continuous room tone, so the room tone only occurs when there is silence.

---

<div class="post-metadata">

**Author:** ![Wrecks0](https://forum.audacityteam.org/user_avatar/forum.audacityteam.org/wrecks0/32/54897_2.png) [@Wrecks0](https://forum.audacityteam.org/u/Wrecks0)\
**Post date:** [February 27, 2025, 3:38pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/6 "2025-02-27T15:38:29Z")

</div>

I do something similar. I add a track with 3 hours of “room sound” (actually outdoor sound in my case) before exporting the mix. Then split the clip where the original recording ends and delete the remaining.

I no longer AutoDuck the sound. It is quiet enough to be drown out by the voices when mixed and the breaths and swallows aren’t as obvious against a background sound scape.

---

<div class="post-metadata">

**Author:** ![ralhas](https://forum.audacityteam.org/letter_avatar_proxy/v4/letter/r/b9e5f3/32.png) [@ralhas](https://forum.audacityteam.org/u/ralhas)\
**Post date:** [February 27, 2025, 4:01pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/7 "2025-02-27T16:01:42Z")

</div>

So you’re basically getting the room tone (a.k.a silence) from the 2nd track, while the 1st one (main recording) is split to as many pieces as there are pauses, with the splits in-between sentences “patched” from the 2nd (background) track anyway. Is this what you’re trying to say?

Sounds interesting indeed, if so. But do you use any tools/scripts to automate this process, as I have a similar issue explained in OP?

---

<div class="post-metadata">

**Author:** ![Wrecks0](https://forum.audacityteam.org/user_avatar/forum.audacityteam.org/wrecks0/32/54897_2.png) [@Wrecks0](https://forum.audacityteam.org/u/Wrecks0)\
**Post date:** [February 27, 2025, 4:14pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/8 "2025-02-27T16:14:45Z")

</div>

The noisy sounds in the voice recording (like coughing and throat clearing) I either delete, or force to silence. Deleting can make the pacing sound wrong, so I usually make them silent, then use the Truncate Silence effect to remove them with an appropriate gap.

Quiet sounds (like breaths, signs, and swallowing) I generally leave in. The background track makes them less obvious.

My use case is for a podcast, not audio books.

---

<div class="post-metadata">

**Author:** ![Wrecks0](https://forum.audacityteam.org/user_avatar/forum.audacityteam.org/wrecks0/32/54897_2.png) [@Wrecks0](https://forum.audacityteam.org/u/Wrecks0)\
**Post date:** [February 27, 2025, 4:29pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/9 "2025-02-27T16:29:37Z")

</div>

I forgot to answer your question.

OpenVINO has a good noise removal effect. Try that if you have a Windows computer.

You will definitely want to mix in a track of background sound when you do that because without it, the silence is “choppy”.

---

<div class="post-metadata">

**Author:** ![ralhas](https://forum.audacityteam.org/letter_avatar_proxy/v4/letter/r/b9e5f3/32.png) [@ralhas](https://forum.audacityteam.org/u/ralhas)\
**Post date:** [February 27, 2025, 8:10pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/10 "2025-02-27T20:10:27Z")

</div>

Below is a primitive yet working Python script I’ve finally come up with after some more trial and error, with huge back-and-forth support from Deepseek AI.

[Download the script](https://codeshare.io/EklBgo)

Basically, it creates a macro named `Room Tone.txt` to be run from Audacity to (semi-)automate the track import, selection, copying, and pasting operations. But first, you’ll need to:

- [enable scripting](https://manual.audacityteam.org/man/scripting.html#Enable_mod-script-pipe) in Audacity
- [label the regions](https://manual.audacityteam.org/man/label_sounds.html) you want to replace with room tone in your main audio file (`audio.wav`), then
- [export the labels](https://manual.audacityteam.org/man/file_menu_export_other.html) to a separate text file, e.g., `labels.txt`, then
- [import the macro](https://manual.audacityteam.org/man/macros.html) created by my script to Audacity
- make sure all the files (`pause.wav` and `labels.txt`) are in the same directory.

The script needs some tweaking hear and there, particularly some manual work with label fixing, file names and paths, your job priorities, etc., but it works okay.

### How Script Works

1. **Import Files** :

2. **Select and Copy Room Tone** :

3. **Replace Pauses** :

4. **Save the Project** :

Hope it helps!

---

<div class="post-metadata">

**Author:** ![Trebor](https://forum.audacityteam.org/user_avatar/forum.audacityteam.org/trebor/32/45854_2.png) [@Trebor](https://forum.audacityteam.org/u/Trebor)\
**Post date:** [February 27, 2025, 9:48pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/11 "2025-02-27T21:48:49Z")

</div>

> [@ralhas](#):
>
> Pastes the room tone in its place

There usually has to be a [crossfade](https://manual.audacityteam.org/man/creating_a_crossfade.html) of ~10ms to avoid clicks where the new audio is pasted in.

---

<div class="post-metadata">

**Author:** ![ralhas](https://forum.audacityteam.org/letter_avatar_proxy/v4/letter/r/b9e5f3/32.png) [@ralhas](https://forum.audacityteam.org/u/ralhas)\
**Post date:** [February 28, 2025, 5:23pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/12 "2025-02-28T17:23:28Z")

</div>

> [@Trebor](#):
>
> There usually has to be a [crossfade](https://manual.audacityteam.org/man/creating_a_crossfade.html) of ~10ms to avoid clicks where the new audio is pasted in.

Instead, I’ve updated the script to extend and shorten the start and end of each label by 40ms when writing to the macro. You can play with `adjusted_start` and `adjusted_end` variables to your liking. Audibly, this is not as subtle as cross-fading but should do the trick by avoiding the overlap of pause and the main audio track.

---

<div class="post-metadata">

**Author:** ![ralhas](https://forum.audacityteam.org/letter_avatar_proxy/v4/letter/r/b9e5f3/32.png) [@ralhas](https://forum.audacityteam.org/u/ralhas)\
**Post date:** [March 2, 2025, 9:59pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/13 "2025-03-02T21:59:04Z")

</div>

For those interested, after many hours of testing, these settings from the Label Sounds menu work best for me to identify and label pauses:

 ![label-sounds-menu](https://forum.audacityteam.org/uploads/default/original/3X/1/6/167ed70e20c2357595c7a8cf4fae4d641da31524.png)

---

<div class="post-metadata">

**Author:** ![ralhas](https://forum.audacityteam.org/letter_avatar_proxy/v4/letter/r/b9e5f3/32.png) [@ralhas](https://forum.audacityteam.org/u/ralhas)\
**Post date:** [June 16, 2025, 6:22pm UTC](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/14 "2025-06-16T18:22:50Z")

</div>

Apparently, the download link for the Python script [posted above](https://forum.audacityteam.org/t/how-to-automate-the-replacement-of-pauses-with-noise-with-silence-of-my-own/132677/10) expired. Here’s a [new and updated one](https://pastebin.com/QwYEF8PS).

Enjoy!
