Skip to main content

Modulator

Trait Modulator 

Source
pub trait Modulator {
    // Required method
    fn modulate(self, node_id: u32, param: u32, low: f32, high: f32);
}
Expand description

Modulator can be attached to a node to change a node parameter over time.

Modulators include both LFOs (Low-Frequency Oscillator) and envelopes. The difference is that LFOs keep oscillating between values while envelopes go from one value to another and then stop.

Internally, modulators only produce values from 0 to 1. Then, to get the final value of the parameter, the value from the modulator is projected on the range between low and high arguments passed together with the modulator when attaching a modulator to a node. For example, Node<Sine>::modulate accepts the range of modulated values for the sine wave frequency (which can be used for vibrato effect).

Even if a node has multiple parameters that can be modulated, currently single node may have at most one modulator attached.

Required Methods§

Source

fn modulate(self, node_id: u32, param: u32, low: f32, high: f32)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§