Skip to content

Adding LFOs

LFOs (Low-frequency oscillators) don't make any sound themselves, but are used to modulate other parameters of your synthesizer. They can be connected to the synth amp, panning, and note pitch in SynthEnginePro. LFO, similar to generator oscillators, takes a waveform on creation.

gml
synth = synth_create();

var _waveform = synth_waveform_sine;

// Default values, all optional
var _frequency = 5;
var _amount = 0.5;
var _retrigger = false;

LFO = synth_add_lfo(synth, _waveform, _frequency, _amount, _retrigger);

// Same as above
LFO = synth_add_lfo(synth, synth_waveform_sine);

Just like generator oscillators, LFOs support custom waveforms:

gml
var _animation_curve_asset = ac_synth_waves_smooth;
var _curve_name = "Sine";
var _frequency = 10;

synth_add_lfo_ext(synth, _animation_curve_asset, _curve_name, _frequency);

Frequency

Unlike generator oscillators, the frequency of an LFO is constant and defined at creation. This is because its purpose is not to generate sound, but to modulate another parameter of the synth at a steady interval (or frequency). The frequency you provide here should be fairly low, usually in the range of 0.1 to 20. Higher values are supported, but may yield harsh results depending on what you connect the LFO to.

Amount

It also accepts an amount argument, which dictates how strongly the LFO will affect connections. This means different things depending on what you connect the LFO to. The following table shows how this number affects the different connections:

RangeEffect
Synth amp0 to 1Modulates synth volume. A value of 0 indicates no modulation, and a value of 1 will modulate from silence to full volume. Replaces ADSR envelope.
Synth panning0 to 1Modulates synth panning. A value of 1 indicates full left/right panning modulation. Only has an effect on stereo synths.
Note pitch (SynthEnginePro only)0 to 2 (or higher)Modulates note frequency. A value of 1 indicates a full octave (12 semitones).

Note retriggering

Lastly, it accepts a boolean retrigger (or note trigger) argument. During the operation of your synth, added LFOs are constantly running. This means that you can get different results when you trigger a note for live playing when an LFO is modulating a parameter of your synth, since the LFO wave is not tied to the note trigger itself. Setting this argument to true will change that, and reset the phase of the LFO whenever a note is triggered while no other notes are active.