Struct oxcable_subtractive_synth::SubtractiveSynth [] [src]

pub struct SubtractiveSynth<M: MidiDevice> {
    // some fields omitted
}

A polyphonic subtractive synthesizer.

Methods

impl<M> SubtractiveSynth<M> where M: MidiDevice

fn new(midi: M, num_voices: usize) -> Self

Returns a new subtractive synth.

  • midi: the MIDI source to use.
  • num_voices: the maximum voices that can play at one time.

fn control_map<F>(self, map: F) -> Self where F: 'static + Fn(u8, u8) -> Option<Message>

Sets the control signal map to the provided closure, then return the same synth.

For further details on control mappings, see the main synth documentation.

fn gain(self, gain: f32) -> Self

Sets the gain of the synth in decibels, then return the same synth.

fn osc1(self, waveform: Waveform) -> Self

Sets the waveform of the synth's first oscillator, then return the same synth.

fn osc2(self, waveform: Waveform) -> Self

Sets the waveform of the synth's second oscillator, then return the same synth.

fn osc1_transpose(self, steps: f32) -> Self

Sets the transposition of the synth's first oscillator in steps, then return the same synth.

fn osc2_transpose(self, steps: f32) -> Self

Sets the transposition of the synth's second oscillator in steps, then return the same synth.

fn adsr(self, attack_time: f32, decay_time: f32, sustain_level: f32, release_time: f32) -> Self

Sets the synth's ADSR envelope, then return the same synth.

  • attack_time specifies the length of the attack in seconds.
  • decay_time specifies the length of the decay in seconds.
  • sustain_level specifies the amplitude of the sustain from 0 to 1.
  • release_time specifies the length of the release in seconds.

fn lfo(self, freq: f32) -> Self

Sets the synth's LFO frequency, then return the same synth.

fn vibrato(self, vibrato: f32) -> Self

Sets the synth's vibrato intensity in steps, then return the same synth.

fn tremolo(self, tremolo: f32) -> Self

Sets the synth's tremolo intensity in decibels, then return the same synth.

fn first_order(self, mode: FilterMode) -> Self

Sets the synth's filter to a first order with the specified mode, then return the same synth.

fn second_order(self, mode: FilterMode) -> Self

Sets the synth's filter to a second order with the specified mode, then return the same synth.

Trait Implementations

impl<M> MessageReceiver for SubtractiveSynth<M> where M: MidiDevice

type Msg = Message

fn handle_message(&mut self, msg: Message)

impl<M> AudioDevice for SubtractiveSynth<M> where M: MidiDevice

fn num_inputs(&self) -> usize

fn num_outputs(&self) -> usize

fn tick(&mut self, t: Time, _: &[Sample], outputs: &mut [Sample])