diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-03-02 14:40:00 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-03-02 16:48:09 +0000 |
| commit | 4ebb6f4408600f3c0f2a745b7ed0ba951bf521b3 (patch) | |
| tree | cdf0953fdee07a6c83c510470a7b8ab8d832d25d /lib/envelope.moon | |
| parent | update lib.math and lib.logic to new op interface (diff) | |
| download | alive-4ebb6f4408600f3c0f2a745b7ed0ba951bf521b3.tar.gz alive-4ebb6f4408600f3c0f2a745b7ed0ba951bf521b3.zip | |
lift remaining libs to new op interface
Diffstat (limited to 'lib/envelope.moon')
| -rw-r--r-- | lib/envelope.moon | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/lib/envelope.moon b/lib/envelope.moon deleted file mode 100644 index eb79a64..0000000 --- a/lib/envelope.moon +++ /dev/null @@ -1,26 +0,0 @@ -import Stream, Op, Scope, eval from require 'core' - -class ar_core extends Op - @doc: "(ar-core attack release gate) -((ar attack release) gate) - AR envelope - -goes from 0 to 1 in attack seconds, holds while gate is on, then goes back to 0 in release seconds." - - new: (...) => - super ... - @out = Stream 'num', 0 - - setup: (@a, @r, @gate) => - assert @a, "ar requires an attack value" - assert @r, "ar requires a release value" - assert @gate, "ar requires a gate value" - @out - - update: (dt) => - slope = if (@gate\unwrap 'bool') then (@a\unwrap! or 0.1) else -(@r\unwrap! or 0.5) - - @out\set math.min 1, math.max 0, @out\unwrap! + dt / slope - -scope = Scope.from_table { 'ar-core': ar_core } -scope\set 'ar', eval '(fn (a r) (fn (gate) (ar-core a r gate)))', scope -scope |
