NeuralNoiseReducer<T>
Models & Types · AiDotNet.Audio.Enhancement
Neural network-based noise reducer for high-quality audio enhancement.
Inheritance: NeuralNetworkBase<T> → AudioNeuralNetworkBase<T> → NeuralNoiseReducer<T>
Implements: IAudioEnhancer<T>, IGeneratedParameterRegistrar<T>
For Beginners
This is like a “magic eraser” for audio noise!
How it works:
- Converts audio to a spectrogram (picture of sound)
- Neural network learns to identify and remove noise patterns
- Converts cleaned spectrogram back to audio
Key features:
- Works on any type of noise (AC hum, fan noise, traffic, etc.)
- Preserves speech/music quality while removing noise
- Can be trained on your specific noise conditions
- Supports real-time streaming for live applications
Use cases:
- Podcast/video production (remove background noise)
- Voice calls (improve speech clarity)
- Music restoration (remove hiss/crackle from old recordings)
- Hearing aids (enhance speech in noisy environments)
Two modes of operation:
- ONNX Mode: Load a pre-trained model for instant use
- Native Mode: Train your own model on custom data
How It Works
This model uses an encoder-bottleneck-decoder architecture inspired by U-Net to learn the mapping from noisy audio to clean audio. It operates in the time-frequency domain using STFT for analysis and synthesis. Note: The current implementation uses a simplified dense decoder; a full U-Net with transposed convolutions and skip connections is planned for future versions.
Example
var noisyAudioTensor = Tensor<float>.CreateRandom(1, 16000);
// Create a neural noise reducer with default settings
var reducer = new NeuralNoiseReducer<float>();
// Or with custom architecture
var architecture = new NeuralNetworkArchitecture<float>(
inputType: InputType.OneDimensional,
taskType: NeuralNetworkTaskType.Regression,
inputSize: 257,
outputSize: 257);
var customReducer = new NeuralNoiseReducer<float>(architecture);
// Enhance noisy audio
Tensor<float> cleanAudio = reducer.Enhance(noisyAudioTensor);
Constructors
| Constructor | Summary |
|---|---|
NeuralNoiseReducer() |
Creates a NeuralNoiseReducer with default configuration for native training mode. |
NeuralNoiseReducer(NeuralNetworkArchitecture<T> architecture, NeuralNoiseReducerOptions options, ILossFunction<T> lossFunction) |
Creates a NeuralNoiseReducer in native training mode. |
NeuralNoiseReducer(NeuralNetworkArchitecture<T> architecture, string modelPath, NeuralNoiseReducerOptions options) |
Creates a NeuralNoiseReducer in native training mode. |
Properties
| Property | Summary |
|---|---|
double EnhancementStrength { get; set; } |
|
int LatencySamples { get; } |
|
int NumChannels { get; set; } |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |
|
Tensor<T> Enhance(Tensor<T> audio) |
|
Tensor<T> EnhanceWithReference(Tensor<T> audio, Tensor<T> reference) |
|
Tensor<T> ProcessChunk(Tensor<T> audioChunk) |
|
void EstimateNoiseProfile(Tensor<T> noiseOnlyAudio) |
|
void ResetEnhancerState() |
Resets the enhancer streaming state. |