rsc3/doc/help/ugen/disk-io/disk-out.help.scrbl

67 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{(disk-out bufnum channels)}
2022-08-28 10:27:01 +00:00
2022-08-24 13:53:18 +00:00
Note: There are constraints on the size of the buffer, it must be
greater than or equal to twice the size of the audio bus. There
must be the same number of channels at the buffer and the disk-out
ugen.
2022-08-28 10:27:01 +00:00
@racketblock[
2022-08-24 13:53:18 +00:00
(let ((bus-size 1024)
(bufferexpt 15))
(= 0 (fxand (expt 2 bufferexpt)
(- (fxarithmetic-shift bus-size 1) 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 ((g (letc ((bufnum 0))
(let ((z (clip2
(rlpf
(lf-pulse ar
(mul-add (sin-osc kr 0.2 0) 10 21)
(mce2 0 0.1)
0.1)
100
0.1)
0.4)))
(mrg2 (disk-out bufnum z)
(out 0 z))))))
(with-sc3
(lambda (fd)
(send-synth fd "disk-out-help" g)
(async fd (b-alloc 10 32768 2))
(async fd (b-write 10
"/tmp/test.aiff"
"aiff"
"float"
32768
0
1))
(send fd (s-new1 "disk-out-help" 1001 1 1 "bufnum" 10)))))
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
(with-sc3
(lambda (fd)
(send fd (n-free1 1001))
(async fd (b-close 10))
(async fd (b-free 10))))
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
(system "sndfile-info /tmp/test.aiff")
2022-08-28 10:27:01 +00:00
]
@racketblock[
2022-08-24 13:53:18 +00:00
(system "jack.play /tmp/test.aiff")
2022-08-28 10:27:01 +00:00
]
2022-08-24 13:53:18 +00:00