aboutsummaryrefslogtreecommitdiffstats
path: root/lib/envelope.moon
diff options
context:
space:
mode:
Diffstat (limited to 'lib/envelope.moon')
-rw-r--r--lib/envelope.moon26
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