Table of Contents

Interface IAudioEffect<T>

Namespace
AiDotNet.Interfaces
Assembly
AiDotNet.dll

Defines the contract for audio effects processors.

public interface IAudioEffect<T>

Type Parameters

T

The numeric type used for calculations.

Remarks

Audio effects modify sound in creative or corrective ways:

  • Dynamics: Compressor, Limiter, Gate, Expander
  • EQ: Parametric EQ, Graphic EQ, Filters
  • Time-based: Reverb, Delay, Echo
  • Modulation: Chorus, Flanger, Phaser, Tremolo
  • Pitch: Pitch Shifter, Auto-Tune, Harmonizer
  • Distortion: Overdrive, Fuzz, Saturation

For Beginners: Audio effects are like Instagram filters for sound!

Common effects explained:

  • Reverb: Adds room ambience (makes it sound like you're in a hall)
  • Delay: Creates echoes of the sound
  • Compressor: Evens out loud and quiet parts (used in podcasts)
  • EQ: Boosts or cuts certain frequencies (more bass, less treble)
  • Pitch Shift: Makes voice higher or lower

Effects can be:

  • Chained: One after another (guitar -> distortion -> reverb -> amp)
  • Real-time: Process audio live as it plays
  • Offline: Process entire files for best quality

Properties

Bypass

Gets or sets whether the effect is bypassed (disabled).

bool Bypass { get; set; }

Property Value

bool

LatencySamples

Gets the processing latency in samples.

int LatencySamples { get; }

Property Value

int

Mix

Gets or sets the dry/wet mix (0.0 = dry only, 1.0 = wet only).

double Mix { get; set; }

Property Value

double

Remarks

For Beginners: - Dry = original unprocessed sound - Wet = fully processed sound - Mix 0.5 = 50% original + 50% processed (parallel processing)

Name

Gets the name of this effect.

string Name { get; }

Property Value

string

Parameters

Gets all adjustable parameters for this effect.

IReadOnlyDictionary<string, AudioEffectParameter<T>> Parameters { get; }

Property Value

IReadOnlyDictionary<string, AudioEffectParameter<T>>

SampleRate

Gets the sample rate this effect operates at.

int SampleRate { get; }

Property Value

int

TailSamples

Gets the tail length in samples (how long the effect rings out after input stops).

int TailSamples { get; }

Property Value

int

Remarks

Important for reverb/delay. When input stops, you need to continue processing for this many samples to capture the tail.

Methods

GetParameter(string)

Gets a parameter value by name.

T GetParameter(string name)

Parameters

name string

Parameter name.

Returns

T

Current value.

Process(Tensor<T>)

Processes audio through the effect.

Tensor<T> Process(Tensor<T> input)

Parameters

input Tensor<T>

Input audio tensor.

Returns

Tensor<T>

Processed audio tensor.

ProcessInPlace(Span<T>)

Processes audio in-place for efficiency.

void ProcessInPlace(Span<T> buffer)

Parameters

buffer Span<T>

Audio buffer to process in-place.

ProcessSample(T)

Processes a single sample (for real-time use).

T ProcessSample(T sample)

Parameters

sample T

Input sample value.

Returns

T

Processed sample value.

Reset()

Resets the effect's internal state.

void Reset()

Remarks

Call this when starting a new audio stream to prevent artifacts from previous audio bleeding through.

SetParameter(string, T)

Sets a parameter value by name.

void SetParameter(string name, T value)

Parameters

name string

Parameter name.

value T

New value.