augmented-adsr-envelope

crates.io docs.rs


Implementation of an ADSR envelope.

Basic usage

```rust use std::time::Duration;

use augmentedadsrenvelope::Envelope;

// Create an exponential envelope. // The envelope configuration uses atomics, so it doesn't need // to be an immutable reference. let envelope = Envelope::exp();

// Set settings envelope.setsamplerate(1000.0); envelope.setattack(Duration::frommillis(200));

// Trigger the envelope envelope.noteon(); for i in 0..10000 { // Tick the envelope by 1 sample envelope.tick(); // Get the current volume let _volume = envelope.volume(); } // Trigger the release stage envelope.noteoff(); ```

Plots

Envelope::default();

| Attack | 0.3 | | Decay | 0.3 | | Sustain | 0.8 |

| Release | 0.3 |

Envelope::exp();

| Attack | 0.3 | | Decay | 0.3 | | Sustain | 0.8 |

| Release | 0.3 |

License: MIT