pub struct EnvelopeAutomaton { /* private fields */ }Expand description
An envelope automaton that generates time-varying control signals.
The envelope progresses through stages (Attack, Decay, Sustain, Release, etc.) and outputs a value that can be mapped to a parameter. The stage curve controls the shape: 1.0 = linear, >1.0 = exponential, <1.0 = logarithmic.
Implementations§
Source§impl EnvelopeAutomaton
impl EnvelopeAutomaton
Sourcepub fn adsr(
name: &str,
attack: f64,
decay: f64,
sustain: f64,
release: f64,
) -> Self
pub fn adsr( name: &str, attack: f64, decay: f64, sustain: f64, release: f64, ) -> Self
Create a new ADSR envelope.
Sourcepub fn ar(name: &str, attack: f64, release: f64) -> Self
pub fn ar(name: &str, attack: f64, release: f64) -> Self
Create a new AR envelope (suitable for percussion).
Sourcepub fn asr(name: &str, attack: f64, sustain: f64, release: f64) -> Self
pub fn asr(name: &str, attack: f64, sustain: f64, release: f64) -> Self
Create a new ASR envelope (suitable for organ sounds).
Sourcepub fn ahdsr(
name: &str,
attack: f64,
hold: f64,
decay: f64,
sustain: f64,
release: f64,
) -> Self
pub fn ahdsr( name: &str, attack: f64, hold: f64, decay: f64, sustain: f64, release: f64, ) -> Self
Create a new AHDSR envelope with an additional hold stage.
Sourcepub fn with_curve(self, curve: f64) -> Self
pub fn with_curve(self, curve: f64) -> Self
Set the stage curve exponent (1.0 = linear).
Sourcepub fn with_range(self, range: Range) -> Self
pub fn with_range(self, range: Range) -> Self
Set the output range.
Trait Implementations§
Source§impl Automaton for EnvelopeAutomaton
impl Automaton for EnvelopeAutomaton
Source§type State = EnvelopeState
type State = EnvelopeState
State type.
Source§type Action = EnvelopeAction
type Action = EnvelopeAction
Action type (a pure function applied to the state).
Source§fn step(
&self,
time: Time,
action: &Self::Action,
state: &Self::State,
) -> (Self::State, Option<f64>)
fn step( &self, time: Time, action: &Self::Action, state: &Self::State, ) -> (Self::State, Option<f64>)
Advance the automaton by one time step. Read more
Source§fn initial_state(&self) -> Self::State
fn initial_state(&self) -> Self::State
Return the initial state.
Source§fn extract_value(&self, state: &Self::State) -> f64
fn extract_value(&self, state: &Self::State) -> f64
Extract the output value from the state.
Source§impl Clone for EnvelopeAutomaton
impl Clone for EnvelopeAutomaton
Source§fn clone(&self) -> EnvelopeAutomaton
fn clone(&self) -> EnvelopeAutomaton
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EnvelopeAutomaton
impl RefUnwindSafe for EnvelopeAutomaton
impl Send for EnvelopeAutomaton
impl Sync for EnvelopeAutomaton
impl Unpin for EnvelopeAutomaton
impl UnsafeUnpin for EnvelopeAutomaton
impl UnwindSafe for EnvelopeAutomaton
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more