SpectralSubtractionEnhancer<T>

Models & Types · AiDotNet.Audio.Enhancement

Audio enhancer using spectral subtraction for noise reduction.

Inheritance: AudioEnhancerBase<T> → SpectralSubtractionEnhancer<T>

For Beginners

Think of it like this:

Imagine you’re in a cafe trying to hear a friend:

  • Noisy signal = friend’s voice + cafe background noise
  • If we know what the cafe sounds like alone (noise estimate)
  • We can “subtract” the cafe sound to hear just the friend

Advantages:

  • Simple and fast
  • Low latency (good for real-time)
  • Works well for stationary noise (AC hum, fan noise)

Limitations:

  • Can introduce “musical noise” artifacts (twinkling sounds)
  • Struggles with non-stationary noise (traffic, other speakers)
  • May reduce speech quality if over-applied

This implementation includes:

  • Adaptive noise estimation
  • Spectral flooring (prevents negative magnitudes)
  • Smoothing to reduce musical noise

How It Works

Spectral subtraction is a classic noise reduction technique that:

  1. Estimates the noise spectrum during silent periods
  2. Subtracts the noise spectrum from the noisy signal spectrum
  3. Reconstructs the cleaned signal

Constructors

Constructor Summary
SpectralSubtractionEnhancer(int sampleRate, int fftSize, int hopSize, double alpha, double beta, double smoothingFactor, bool adaptiveNoiseEstimation, double enhancementStrength) Initializes a new SpectralSubtractionEnhancer with default parameters.

Methods

Method Summary
void ResetState()