Skip to content

AudioAPI reference

Class Instrument

Namespace: MicroEngine.Audio.Retro
Assembly: MicroEngine.Audio.dll
Guide: Synthesized sound effects

A tracker-style voice: waveform plus an ADSR envelope (seconds, sustain level 0..1).

C#
public sealed record Instrument : IEquatable<Instrument>

Inheritance

object ← Instrument

Implements

IEquatable<Instrument>

Constructors

Instrument(Wave, float, float, float, float, float, float, float, float, float)

A tracker-style voice: waveform plus an ADSR envelope (seconds, sustain level 0..1).

C#
public Instrument(Wave Wave, float Volume = 0.3, float Attack = 0.005, float Decay = 0.08, float SustainLevel = 0.6, float Release = 0.06, float Pan = 0.5, float VibratoDepth = 0, float VibratoRate = 5, float LowPass = 0)

Parameters

Wave Wave

Volume float

Attack float

Decay float

SustainLevel float

Release float

Pan float

VibratoDepth float

VibratoRate float

LowPass float

Fields

Bass

A round triangle wave, for bass lines.

C#
public static readonly Instrument Bass

Field Value

Instrument

Bell

A sine with a long decay, for chimes.

C#
public static readonly Instrument Bell

Field Value

Instrument

Lead

A bright 25% pulse with light vibrato, for melodies.

C#
public static readonly Instrument Lead

Field Value

Instrument

Pad

A soft, filtered saw with slow attack and release, for chords.

C#
public static readonly Instrument Pad

Field Value

Instrument

Pluck

A short, filtered square, for arpeggios and accompaniment.

C#
public static readonly Instrument Pluck

Field Value

Instrument

Properties

Attack

C#
public float Attack { get; init; }

Property Value

float

Decay

C#
public float Decay { get; init; }

Property Value

float

LowPass

C#
public float LowPass { get; init; }

Property Value

float

Pan

C#
public float Pan { get; init; }

Property Value

float

Release

C#
public float Release { get; init; }

Property Value

float

SustainLevel

C#
public float SustainLevel { get; init; }

Property Value

float

VibratoDepth

C#
public float VibratoDepth { get; init; }

Property Value

float

VibratoRate

C#
public float VibratoRate { get; init; }

Property Value

float

Volume

C#
public float Volume { get; init; }

Property Value

float

Wave

C#
public Wave Wave { get; init; }

Property Value

Wave

Methods

<Clone>$()

C#
public Instrument <Clone>$()

Returns

Instrument

Deconstruct(out Wave, out float, out float, out float, out float, out float, out float, out float, out float, out float)

C#
public void Deconstruct(out Wave Wave, out float Volume, out float Attack, out float Decay, out float SustainLevel, out float Release, out float Pan, out float VibratoDepth, out float VibratoRate, out float LowPass)

Parameters

Wave Wave

Volume float

Attack float

Decay float

SustainLevel float

Release float

Pan float

VibratoDepth float

VibratoRate float

LowPass float

Equals(object?)

C#
public override bool Equals(object? obj)

Parameters

obj object?

Returns

bool

Equals(Instrument?)

C#
public bool Equals(Instrument? other)

Parameters

other Instrument?

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(Instrument?, Instrument?)

C#
public static bool operator ==(Instrument? left, Instrument? right)

Parameters

left Instrument?

right Instrument?

Returns

bool

operator !=(Instrument?, Instrument?)

C#
public static bool operator !=(Instrument? left, Instrument? right)

Parameters

left Instrument?

right Instrument?

Returns

bool