rsc3/doc/help/ugen/fft/convolution.help.scrbl

40 lines
926 B
Text
Raw Normal View History

2022-08-24 13:53:18 +00:00
#lang scribble/manual
@(require (for-label racket))
@title{(convolution in kernel framesize)}
2022-08-28 10:27:01 +00:00
2022-08-24 13:53:18 +00:00
Strict convolution of two continuously changing inputs. Also see
[convolution2] for a cheaper CPU cost alternative for the case of a
fixed kernel which can be changed with a trigger message.
in - processing target
kernel - processing kernel.
framesize - size of fft frame, must be a power of two
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(audition
(let ((input (sound-in (mce2 0 1)))
(kernel (white-noise ar)))
(out 0 (mul (convolution input kernel 2048) 0.1))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(let ((a 2048)
(b 0))
(with-sc3
(lambda (fd)
(async fd (b-alloc b a 1))
(send fd (b-set1 b 0 1.0))
(replicate-m 100 (send fd (b-set1 b (random-integer a) (random 0.0 1.0))))
(play fd (out 0 (mul (convolution
(sound-in (mce2 0 1))
(play-buf 1 b (buf-rate-scale kr b) 1 0 1)
(* 2 a))
0.2))))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00