rsc3/doc/help/ugen/demand/dbufrd.help.scrbl

61 lines
1.2 KiB
Text
Raw Permalink Normal View History

2022-08-24 13:53:18 +00:00
#lang scribble/manual
@(require (for-label racket))
@title{(dbufrd bufnum phase loop)}
2022-08-28 10:27:01 +00:00
2022-08-24 13:53:18 +00:00
Buffer demand ugen.
bufnum - buffer number to read from
phase - index into the buffer (demand ugen or any other ugen)
loop - loop when phase exceeds number of frames in buffer
Example
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(with-sc3
(lambda (fd)
(async fd (b-alloc 10 24 1))
(send fd (b-setn1 10 0 (replicate-m 24 (exp-random 200 500))))))
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* ((q (dseq 3 (make-mce (list 0 3 5 0 3 7 0 5 9))))
(p (dseq dinf (mce2 q (dbrown 5 0 23 1))))
(t (dust kr 10)))
(audition (out 0 (mul (sin-osc ar (demand t 0 (dbufrd 10 p 1)) 0) 0.1))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00
Buffer as a time pattern.
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(with-sc3
(lambda (fd)
(async fd (b-alloc 11 24 1))
(send fd (b-setn1 11 0 (replicate-m 24 (choose (list 1 0.5 0.25)))))))
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* ((p (dseq dinf (mce2 (dseq 3 (make-mce (list 0 3 5 0 3 7 0 5 9)))
(dbrown 5 0 23 1))))
(d (mul (dbufrd 11 (dseries dinf 0 1) 1) 0.5))
(l (dbufrd 10 p 1)))
(audition (out 0 (mul (sin-osc ar (duty kr d 0 do-nothing l) 0) 0.1))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00
free buffers
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(with-sc3
(lambda (fd)
(async fd (b-free 10))
(async fd (b-free 11))))
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00