rsc3/doc/help/ugen/triggers/peak-follower.help.scrbl

59 lines
1.4 KiB
Text
Raw Normal View History

2022-08-24 13:53:18 +00:00
#lang scribble/manual
@(require (for-label racket))
@title{(peak-follower in decay)}
2022-08-28 10:27:01 +00:00
2022-08-24 13:53:18 +00:00
Track peak signal amplitude. outputs the peak amplitude of the
signal received at the input. If level is below maximum, the level
decreases by the factor given in decay.
in - input signal.
decay - decay factor.
internally, the absolute value of the signal is used, to prevent
underreporting the peak value if there is a negative DC offset. To
obtain the minimum and maximum values of the signal as is, use the
running-min and running-max UGens.
No decay
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(let* ((s (mul (dust ar 20) (line kr 0 1 4 do-nothing)))
(f (mul-add (peak-follower s 1.0) 1500 200)))
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00
A little decay
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(let* ((s (mul (dust ar 20) (line kr 0 1 4 do-nothing)))
(f (mul-add (peak-follower s 0.999) 1500 200)))
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00
Mouse x controls decay
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(let* ((x (mouse-x kr 0.99 1.0001 1 0.1))
(s (mul (dust ar 20) (line kr 0 1 4 do-nothing)))
(f (mul-add (peak-follower s (u:min x 1.0)) 1500 200)))
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00
Follow a sine lfo
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(let* ((x (mouse-x kr 0.99 1.0001 1 0.1))
(s (sin-osc kr 0.2 0))
(f (mul-add (peak-follower s (u:min x 1.0)) 200 500)))
(audition (out 0 (mul (sin-osc ar f 0) 0.2))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00