Implementing AI Noise Reduction in Audio AI noise reduction removes background noise (HVAC, traffic, keyboard, hum) from speech recordings. Unlike spectral subtraction, neural network models do not create "musical noise" and preserve the naturalness of the voice. ### Tools and Approaches noisereduce is a spectral subtraction-based library with an adaptive noise profile:
import noisereduce as nr
import soundfile as sf
import numpy as np
def denoise_audio(input_path: str, output_path: str) -> None:
audio, sr = sf.read(input_path)
# Статистика шума из первых 0.5 секунд (тишина/фон)
noise_sample = audio[:int(sr * 0.5)]
reduced = nr.reduce_noise(
y=audio,
sr=sr,
y_noise=noise_sample,
prop_decrease=0.75, # степень подавления: 0=нет, 1=максимум
stationary=False # False = адаптивный шум
)
sf.write(output_path, reduced, sr)
```**RNNoise** is a lightweight recurrent network from Mozilla that runs in real time:```python
import subprocess
def rnnoise_denoise(input_wav: str, output_wav: str) -> None:
# Требует 48 kHz моно
subprocess.run([
"ffmpeg", "-i", input_wav,
"-af", "arnndn=m=/usr/share/rnnoise/rnnoise-models/beguiling-drafter-2018-08-30/bd.rnnn",
output_wav
], check=True)
```**DeepFilterNet** — SOTA model for speech enhancement, DNSMos > 3.8/5:```python
from df import enhance, init_df
model, df_state, _ = init_df()
def deepfilter_enhance(audio_array: np.ndarray, sr: int) -> np.ndarray:
enhanced = enhance(model, df_state, audio_array)
return enhanced
```### Pipeline Usage | Scenario | Recommendation | Latency | |----------|------------|---------| | Post-processing of recordings | DeepFilterNet | not critical | | Realtime VoIP | RNNoise | < 10 ms | | Data preparation for STT | noisereduce | offline | | Studio remastering | Demucs + DeepFilterNet | offline | Noise reduction before Whisper reduces WER by 15-40% for recordings with SNR < 10 dB. Integration into an existing audio pipeline takes 3-5 days.