Skip to content

AudioAPI reference

Class SfxParams

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

Parameters for a retro sound effect (in the spirit of sfxr). Every game sound in the samples is described with one of these, so audio is original, tweakable and license-free.

C#
public sealed record SfxParams : IEquatable<SfxParams>

Inheritance

object ← SfxParams

Implements

IEquatable<SfxParams>

Constructors

SfxParams()

C#
public SfxParams()

Properties

Arpeggio

Optional arpeggio: frequency multipliers stepped every ArpeggioStep seconds.

C#
public float[]? Arpeggio { get; init; }

Property Value

float[]?

ArpeggioStep

Seconds each Arpeggio multiplier lasts (default 0.05).

C#
public float ArpeggioStep { get; init; }

Property Value

float

Attack

Seconds to rise from silence to full volume.

C#
public float Attack { get; init; }

Property Value

float

Crush

Bit-crush to N levels (0 disables) for crunchy hits.

C#
public int Crush { get; init; }

Property Value

int

Decay

Seconds to fade to silence after the sustain. The sound lasts Attack + Sustain + Decay seconds.

C#
public float Decay { get; init; }

Property Value

float

EndFrequency

Frequency at the end of the sound (exponential slide). Null keeps it constant.

C#
public float? EndFrequency { get; init; }

Property Value

float?

Frequency

Start frequency in Hz.

C#
public float Frequency { get; init; }

Property Value

float

LowPass

Simple one-pole low-pass in Hz (0 disables). Softens harsh square/noise sounds.

C#
public float LowPass { get; init; }

Property Value

float

Sustain

Seconds held at full volume after the attack.

C#
public float Sustain { get; init; }

Property Value

float

VibratoDepth

Vibrato depth as a fraction of the frequency (0 disables; 0.02 is a light wobble).

C#
public float VibratoDepth { get; init; }

Property Value

float

VibratoRate

Vibrato speed in Hz (default 8).

C#
public float VibratoRate { get; init; }

Property Value

float

Volume

Peak amplitude, 0..1 (default 0.5).

C#
public float Volume { get; init; }

Property Value

float

Wave

The oscillator waveform (square by default).

C#
public Wave Wave { get; init; }

Property Value

Wave

Methods

<Clone>$()

C#
public SfxParams <Clone>$()

Returns

SfxParams

Equals(object?)

C#
public override bool Equals(object? obj)

Parameters

obj object?

Returns

bool

Equals(SfxParams?)

C#
public bool Equals(SfxParams? other)

Parameters

other SfxParams?

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(SfxParams?, SfxParams?)

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

Parameters

left SfxParams?

right SfxParams?

Returns

bool

operator !=(SfxParams?, SfxParams?)

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

Parameters

left SfxParams?

right SfxParams?

Returns

bool