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

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!

2 Likes

Punching-in room noise is possible …

1 Like

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!

1 Like

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?

Theoretically could gate the noise to silence, then use the gated track to AutoDuck a track of continuous room tone, so the room tone only occurs when there is silence.

1 Like

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.

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?

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.

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”.

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

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:

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:

    • The room tone file (pause.wav) is imported into Audacity.
  2. Select and Copy Room Tone:

    • The room tone track (track 1) is selected.
    • The SelTrackStartToEnd command selects the entire duration of the room tone track.
    • The Copy command copies the selected room tone to the clipboard.
    • The room tone track is then deleted since it’s no longer needed.
  3. Replace Pauses:

    • For each pause defined in labels.txt, the macro:
      • Extends and shortens the start and end of each label to avoid possible overlaps. You can also experiment with crossfading, as pointed here.
      • Selects the pause in the main track.
      • Deletes the pause.
      • Pastes the room tone in its place.
  4. Save the Project:

    • The Export2 command saves the project as audio_edited.wav in the same directory as the original audio.wav file.

Hope it helps!

There usually has to be a crossfade 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.

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