0

I like Audacity because of its noise reduction. With a recording done in studio, a noise profile, and reduction at 16 dB (with sensitivity 6.00 and 3 frequency smoothing bands), I get a perfect result without voice distortion.

I would like to automate this noise reduction process: give the software a file with the background noise, generate a noise profile, and reduce that noise in multiple other files.

Audacity allows scripting; even then, it crashes on my system, and no longer allows noise reduction:

This effect is not currently available from scripting.

I tried SOX from this thread:

sox Take80-noise.wav  -n noiseprof noise.prof
$ sox Take80.wav Take80-clean.wav noisered noise.prof 0.21

With my studio recordings and the same noise input, a level of 0.21 has very little effect, and a level of 0.6 has more effect on background noise without eliminating it and it does distort the voice.

How can I automate noise reduction with similar results as Audacity?

2 Answers 2

1

I stumbled on this thread a few years ago trying to do the same thing. I like your Applescript solution, but a few months later I found this Github repo https://github.com/tals/audacity-noise-reduction which when built spits out a standalone executable that provides the same parameters and results as Audacity. I wrote a Python API around it to automate audio processing and uploading on a large scale, and it does exactly what I need. Hopefully this can be helpful to someone else!

2
  • It doesn't seem to do compression and limiting, right? Jul 10, 2022 at 16:23
  • 1
    @miguelmorin It doesn't, but those Audacity plugins are scriptable. Noise reduction seems to be the sole exception to automation in Audacity. If you don't want to use Audacity at all there are projects like github.com/jagger2048/Dynamics-processor that work just as well. Compressing and limiting audio is a lot simpler and commonplace I believe than the Fourier transforms noise reduction needs.
    – benonymity
    Jul 17, 2022 at 0:42
0

For lack of results in two months, I copy the answer from Automate pre-processing of sound (noise reduction, compressor, limiter).

I programmed an AppleScript that controls the Audacity Graphical User Interface and achieves the same result. It loads a track with the noise and gets the noise profile, loads the track with the voice, removes the noise with the previous settings, and I also included a limiter and a compressor.

set noise_track to "/path/to/noise/track.wav"
set voice_track to "/path/to/voice/track.wav"
set export_name to "voice-clean"

set short_delay to 1
set middle_delay to 5
set long_delay to 10

tell application "System Events"
    
    tell application "Audacity" to activate
    
    tell application "Audacity" to open noise_track
    
    delay short_delay
    keystroke "a" using command down
    
    
    tell process "Audacity"
        click menu item "Noise reduction..." of menu "Effect" of menu bar 1
    end tell
    delay short_delay
    
    repeat 2 times
        key code 48
        delay short_delay
    end repeat
    key code 49
    delay short_delay
    
    tell application "Audacity" to open voice_track
    delay short_delay
    
    --------------------
    -- Noise reduction
    --------------------
    
    keystroke "a" using command down
    delay short_delay
    
    tell process "Audacity"
        click menu item "Noise reduction..." of menu "Effect" of menu bar 1
    end tell
    delay short_delay
    
    key code 36
    
    delay long_delay
    
    --------------------
    -- Limiter
    --------------------
    
    tell process "Audacity"
        click menu item "Limiter..." of menu "Effect" of menu bar 1
    end tell
    delay short_delay
    
    key code 36
    delay long_delay
    
    --------------------
    -- Compressor
    --------------------
    
    tell process "Audacity"
        click menu item "Compressor..." of menu "Effect" of menu bar 1
    end tell
    delay short_delay
    
    key code 36
    delay long_delay
    
    keystroke "e" using {command down, shift down}
    delay middle_delay
    keystroke export_name
    delay short_delay
    key code 36
    
    delay long_delay
    
    --------------------
    -- Close two projects
    --------------------
    repeat 2 times
        keystroke "w" using command down
        delay short_delay
        key code 48
        delay short_delay
        key code 49
        delay 2 * short_delay
    end repeat
end tell

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.