2022-08-24 13:53:18 +00:00
|
|
|
#lang scribble/manual
|
|
|
|
@(require (for-label racket))
|
|
|
|
|
|
|
|
@title{(env-gen rate gate levelScale levelBias timeScale doneAction envelope)}
|
|
|
|
|
2022-08-28 10:27:01 +00:00
|
|
|
|
2022-08-24 13:53:18 +00:00
|
|
|
A segment based envelope generator. Note that the SC3 language
|
|
|
|
reorders the inputs to this UGen so that the envelope is the first
|
|
|
|
argument.
|
|
|
|
|
|
|
|
There are utilities for contructing the envelope argument.
|
|
|
|
|
|
|
|
The arguments for levelScale, levelBias, and timeScale are polled
|
|
|
|
when the env-gen is triggered and remain constant for the duration
|
|
|
|
of the envelope.
|
|
|
|
|
|
|
|
envelope - an breakpoint set
|
|
|
|
|
|
|
|
gate - this triggers the envelope and holds it open while > 0. If
|
|
|
|
the Env is fixed-length (e.g. Env.linen, Env.perc), the gate
|
|
|
|
argument is used as a simple trigger. If it is an sustaining
|
|
|
|
envelope (e.g. Env.adsr, Env.asr), the envelope is held open
|
|
|
|
until the gate becomes 0, at which point is released.
|
|
|
|
|
|
|
|
levelScale - scales the levels of the breakpoints.
|
|
|
|
|
|
|
|
levelBias - offsets the levels of the breakpoints.
|
|
|
|
|
|
|
|
timeScale - scales the durations of the segments.
|
|
|
|
|
|
|
|
doneAction - an integer representing an action to be executed when
|
|
|
|
the env is finished playing. This can be used to free
|
|
|
|
the enclosing synth, etc.
|
|
|
|
|
2022-08-28 10:27:01 +00:00
|
|
|
|
|
|
|
@racketblock[
|
2022-08-24 13:53:18 +00:00
|
|
|
(import (rhs) (rsc3))
|
2022-08-28 10:27:01 +00:00
|
|
|
]
|
2022-08-24 13:53:18 +00:00
|
|
|
|
|
|
|
Percussive envelope
|
2022-08-28 10:27:01 +00:00
|
|
|
|
|
|
|
@racketblock[
|
2022-08-24 13:53:18 +00:00
|
|
|
(let* ((d (env-perc 0.01 1 1 (list -4 -4)))
|
|
|
|
(e (env-gen kr 1 0.1 0 1 remove-synth d)))
|
|
|
|
(audition (out 0 (mul e (sin-osc ar 440 0)))))
|
2022-08-28 10:27:01 +00:00
|
|
|
]
|
2022-08-24 13:53:18 +00:00
|
|
|
|
|
|
|
The break-point assistant makes a static envelope from a
|
|
|
|
co-ordinate list. There is a duration and amplitude scalar.
|
2022-08-28 10:27:01 +00:00
|
|
|
|
|
|
|
@racketblock[
|
2022-08-24 13:53:18 +00:00
|
|
|
(let* ((d (env-coord (list (cons 0 0)
|
|
|
|
(cons 0.75 1)
|
|
|
|
(cons 1 0))
|
|
|
|
1 1 (replicate 3 "linear")))
|
|
|
|
(e (env-gen kr 1 0.1 0 1 remove-synth d)))
|
|
|
|
(audition (out 0 (mul e (sin-osc ar 440 0)))))
|
2022-08-28 10:27:01 +00:00
|
|
|
]
|
2022-08-24 13:53:18 +00:00
|
|
|
|
|
|
|
Trapezoidal
|
2022-08-28 10:27:01 +00:00
|
|
|
|
|
|
|
@racketblock[
|
2022-08-24 13:53:18 +00:00
|
|
|
(let* ((d (env-trapezoid 0 0.25 2 0.1))
|
|
|
|
(e (env-gen kr 1 0.1 0 1 remove-synth d)))
|
|
|
|
(audition (out 0 (mul e (sin-osc ar 440 0)))))
|
2022-08-28 10:27:01 +00:00
|
|
|
]
|
2022-08-24 13:53:18 +00:00
|
|
|
|
|
|
|
0.0 3 -1 -1 0.1 0.5 1.0 0.0 0.1 0.0 1.0 0.0 0.0 1.5 1.0 0.0
|
2022-08-28 10:27:01 +00:00
|
|
|
|
|
|
|
@racketblock[
|
2022-08-24 13:53:18 +00:00
|
|
|
(env-trapezoid 0 0.25 2 0.1)
|
2022-08-28 10:27:01 +00:00
|
|
|
]
|
|
|
|
|
2022-08-24 13:53:18 +00:00
|
|
|
|