Table of Contents

Class VolumeChange<T>

Namespace
AiDotNet.Augmentation.Audio
Assembly
AiDotNet.dll

Randomly changes the volume (gain) of audio.

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

Type Parameters

T

The numeric type for calculations.

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

Remarks

For Beginners: Volume change augmentation makes audio louder or quieter. This helps models become robust to different recording volumes and microphone distances.

Gain in dB:

  • +6 dB ≈ 2x louder
  • 0 dB = no change
  • -6 dB ≈ 0.5x volume

Constructors

VolumeChange(double, double, double, int)

Creates a new volume change augmentation.

public VolumeChange(double minGainDb = -6, double maxGainDb = 6, double probability = 0.5, int sampleRate = 16000)

Parameters

minGainDb double

Minimum gain in dB (default: -6.0).

maxGainDb double

Maximum gain in dB (default: 6.0).

probability double

Probability of applying this augmentation (default: 0.5).

sampleRate int

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

Properties

MaxGainDb

Gets the maximum volume change in dB.

public double MaxGainDb { get; }

Property Value

double

MinGainDb

Gets the minimum volume change in dB.

public double MinGainDb { get; }

Property Value

double

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.