Table of Contents

Class AudioNoise<T>

Namespace
AiDotNet.Augmentation.Audio
Assembly
AiDotNet.dll

Adds background noise to audio data.

public class AudioNoise<T> : AudioAugmenterBase<T>, IAugmentation<T, Tensor<T>>

Type Parameters

T

The numeric type for calculations.

Inheritance
AugmentationBase<T, Tensor<T>>
AudioNoise<T>
Implements
IAugmentation<T, Tensor<T>>
Inherited Members

Remarks

For Beginners: This augmentation adds random noise to audio, simulating real-world recording conditions like background hum, ambient sounds, or electronic interference. This helps models become robust to noisy inputs.

SNR (Signal-to-Noise Ratio):

  • Higher SNR = less noise (cleaner audio)
  • Lower SNR = more noise (noisier audio)
  • 20 dB = barely audible noise
  • 10 dB = noticeable noise
  • 0 dB = signal and noise are equal

Constructors

AudioNoise(double, double, double, int)

Creates a new audio noise augmentation.

public AudioNoise(double minSnrDb = 10, double maxSnrDb = 30, double probability = 0.3, int sampleRate = 16000)

Parameters

minSnrDb double

Minimum SNR in dB (default: 10.0).

maxSnrDb double

Maximum SNR in dB (default: 30.0).

probability double

Probability of applying this augmentation (default: 0.3).

sampleRate int

Sample rate of the audio in Hz (default: 16000).

Properties

MaxSnrDb

Gets the maximum signal-to-noise ratio in dB.

public double MaxSnrDb { get; }

Property Value

double

MinSnrDb

Gets the minimum signal-to-noise ratio in dB.

public double MinSnrDb { get; }

Property Value

double

NoiseType

Gets or sets the type of noise to add.

public NoiseType NoiseType { get; set; }

Property Value

NoiseType

Methods

ApplyAugmentation(Tensor<T>, AugmentationContext<T>)

Implement this method to perform the actual augmentation.

protected override Tensor<T> ApplyAugmentation(Tensor<T> data, AugmentationContext<T> context)

Parameters

data Tensor<T>

The input data.

context AugmentationContext<T>

The augmentation context.

Returns

Tensor<T>

The augmented data.

GetParameters()

Gets the parameters of this augmentation.

public override IDictionary<string, object> GetParameters()

Returns

IDictionary<string, object>

A dictionary of parameter names to values.