Need help with noisereduce?

Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

283 Stars 77 Forks MIT License 18 Commits 11 Opened issues

Noise reduction in python using spectral gating (speech, bioacoustics, time-domain signals)

No Data

Readme

- This algorithm is based (but not completely reproducing) on the one outlined by Audacity for the
**noise reduction effect**(Link to C++ code) - The algorithm requires two inputs:
- A
*noise*audio clip containing prototypical noise of the audio clip - A
*signal*audio clip containing the signal and the noise intended to be removed

- A

- An FFT is calculated over the noise audio clip
- Statistics are calculated over FFT of the the noise (in frequency)
- A threshold is calculated based upon the statistics of the noise (and the desired sensitivity of the algorithm)
- An FFT is calculated over the signal
- A mask is determined by comparing the signal FFT to the threshold
- The mask is smoothed with a filter over frequency and time
- The mask is appled to the FFT of the signal, and is inverted

pip install noisereduce

*noisereduce optionally uses Tensorflow as a backend to speed up FFT and gaussian convolution. It is not listed in the requirements.txt so because (1) it is optional and (2) tensorflow-gpu and tensorflow (cpu) are both compatible with this package. The package requires Tensorflow 2+ for all tensorflow operations.*

import noisereduce as nr # load data rate, data = wavfile.read("mywav.wav") # select section of data that is noise noisy_part = data[10000:15000] # perform noise reduction reduced_noise = nr.reduce_noise(audio_clip=data, noise_clip=noisy_part, verbose=True)

noise_reduce

n_grad_freq (int): how many frequency channels to smooth over with the mask. n_grad_time (int): how many time channels to smooth over with the mask. n_fft (int): number audio of frames between STFT columns. win_length (int): Each frame of audio is windowed by `window()`. The window will be of length `win_length` and then padded with zeros to match `n_fft`.. hop_length (int):number audio of frames between STFT columns. n_std_thresh (int): how many standard deviations louder than the mean dB of the noise (at each frequency level) to be considered signal prop_decrease (float): To what extent should you decrease noise (1 = all, 0 = none) pad_clipping (bool): Pad the signals with zeros to ensure that the reconstructed data is equal length to the data use_tensorflow (bool): Use tensorflow as a backend for convolution and fft to speed up computation verbose (bool): Whether to plot the steps of the algorithm

Project based on the cookiecutter data science project template. #cookiecutterdatascience