AudioAPI reference
Class Synth
Namespace: MicroEngine.Audio.Retro
Assembly: MicroEngine.Audio.dll
Guide: Synthesized sound effects
Deterministic waveform synthesis for sound effects and music voices.
public static class SynthInheritance
Methods
Envelope(float, float, float, float)
A linear attack-sustain-decay envelope: 0..1 at t seconds.
public static float Envelope(float t, float attack, float sustain, float decay)Parameters
t float
attack float
sustain float
decay float
Returns
Layer(params (AudioClip Clip, float Offset)[])
Mixes several clips (mono) starting at given offsets in seconds.
public static AudioClip Layer(params (AudioClip Clip, float Offset)[] parts)Parameters
parts (AudioClip Clip, float Offset)[]
Returns
Exceptions
A clip is not mono or not at DefaultSampleRate.
NoteFrequency(string)
Frequency of a note name such as “C4”, “F#3” or “Bb5” (A4 = 440 Hz).
public static float NoteFrequency(string note)Parameters
note string
Returns
Oscillator(Wave, float, float)
The value of wave at phase, in -1..1.
public static float Oscillator(Wave wave, float phase, float noise)Parameters
wave Wave
The waveform.
phase float
Position in the cycle, 0..1.
noise float
The value returned for Noise.
Returns
Render(SfxParams, int)
Synthesizes a mono sound effect. The same parameters always produce the same samples.
public static AudioClip Render(SfxParams p, int sampleRate = 44100)Parameters
The sound description.
sampleRate int
Samples per second of the result.
Returns
A mono clip, ready for AddSound.