~pbatch/patchwerk

patchwerk/janet/test.janet -rw-r--r-- 601 bytes
9c265356 — paul plan9 additions from Sigrid 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(import build/patchwerk :as pw)

(var sr 44100)
(var patch (pw/mkpatch 8 10 64 sr))
(var sp (pw/sp-create sr))
(var stack (pw/patch-stack patch))

(var sine (pw/node-sine patch sp))
(pw/cable-set-constant
 (pw/node-get-cable sine 0)
 440)
(pw/cable-set-constant
 (pw/node-get-cable sine 1)
 0.5)

(pw/stack-pop stack)

(if (nil? sine) (print "uh oh"))

(var wavout (pw/node-wavout patch sp "test.wav"))
(if (nil? wavout) (print "uh oh"))

(pw/cable-connect
 (pw/node-get-cable sine 2)
 (pw/node-get-cable wavout 0))

(for i 0 (* sr 10) (pw/patch-tick patch))

(pw/delpatch patch)
(pw/sp-destroy sp)