2022-08-24 13:53:18 +00:00
|
|
|
#lang scribble/manual
|
|
|
|
@(require (for-label racket))
|
|
|
|
|
|
|
|
@title{(running-sum in numsamp)}
|
|
|
|
|
2022-08-28 10:27:01 +00:00
|
|
|
|
2022-08-24 13:53:18 +00:00
|
|
|
A running sum over a user specified number of samples, useful for
|
|
|
|
running RMS power windowing.
|
|
|
|
|
|
|
|
in - input signal
|
|
|
|
numsamp - How many samples to take the running sum over
|
|
|
|
(initialisation rate)
|
|
|
|
|
2022-08-28 10:27:01 +00:00
|
|
|
|
|
|
|
@racketblock[
|
2022-08-24 13:53:18 +00:00
|
|
|
(let ((n 40))
|
|
|
|
(audition
|
|
|
|
(out 0 (foldl1 mul (list (sin-osc ar 440 0)
|
|
|
|
(running-sum (sound-in (mce2 0 1)) n)
|
|
|
|
(recip n))))))
|
2022-08-28 10:27:01 +00:00
|
|
|
]
|
|
|
|
|
2022-08-24 13:53:18 +00:00
|
|
|
|