8 releases

0.3.0 Oct 22, 2022
0.2.0 Sep 22, 2022
0.1.0-alpha.7 Sep 5, 2022
0.1.0-alpha.6 May 25, 2022
0.1.0-alpha.2 Jan 16, 2022

#13 in #vst-plugin

Download history 5/week @ 2022-08-13 3/week @ 2022-08-20 7/week @ 2022-08-27 24/week @ 2022-09-03 32/week @ 2022-09-10 25/week @ 2022-09-17 14/week @ 2022-09-24 24/week @ 2022-10-01 6/week @ 2022-10-08 2/week @ 2022-10-15 37/week @ 2022-10-22 14/week @ 2022-10-29 29/week @ 2022-11-05 5/week @ 2022-11-12 5/week @ 2022-11-19 4/week @ 2022-11-26

53 downloads per month
Used in audio-processor-metronome

MIT license

70KB
577 lines

augmented-adsr-envelope

crates.io docs.rs


Implementation of an ADSR envelope.

Basic usage

use std::time::Duration;

use augmented_adsr_envelope::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.set_sample_rate(1000.0);
envelope.set_attack(Duration::from_millis(200));

// Trigger the envelope
envelope.note_on();
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.note_off();

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

Dependencies

~0.4–1MB
~23K SLoC