Debian Codegraph @

examples/p5g.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -+rtaudio=alsa -o dac:hw:0
4 </CsOptions>
5 <CsInstruments>
6 nchnls = 1
7 ksmps = 1000
8
9 #define P5G_BUTTONS #0#
10 #define P5G_BUTTON_A #1#
11 #define P5G_BUTTON_B #2#
12 #define P5G_BUTTON_C #4#
13 #define P5G_JUSTPUSH #8#
14 #define P5G_JUSTPU_A #9#
15 #define P5G_JUSTPU_B #10#
16 #define P5G_JUSTPU_C #12#
17 #define P5G_RELEASED #16#
18 #define P5G_RELSED_A #17#
19 #define P5G_RELSED_B #18#
20 #define P5G_RELSED_C #20#
21 #define P5G_FINGER_INDEX #32#
22 #define P5G_FINGER_MIDDLE #33#
23 #define P5G_FINGER_RING #34#
24 #define P5G_FINGER_PINKY #35#
25 #define P5G_FINGER_THUMB #36#
26 #define P5G_DELTA_X #37#
27 #define P5G_DELTA_Y #38#
28 #define P5G_DELTA_Z #39#
29 #define P5G_DELTA_XR #40#
30 #define P5G_DELTA_YR #41#
31 #define P5G_DELTA_ZR #42#
32 #define P5G_ANGLES #43#
33
34 gka init 0
35 gkp init 0
36
37 instr 1
38 p5gconnect
39 ka p5gdata $P5G_JUSTPU_A.
40 kc p5gdata $P5G_BUTTON_C.
41 ; If the A button is just pressed then activate a note
42 if (ka==0) goto ee
43 event "i", 2, 0, 2
44
45 ee:
46 gka p5gdata $P5G_DELTA_X.
47 gkp p5gdata $P5G_DELTA_Y.
48 printk2 gka
49 printk2 gkp
50 if (kc==0) goto ff
51 printks "turning off (%d)\n", 0, kc
52 turnoff
53 ff:
54 endin
55
56 instr 2
57 a1 oscil ampdbfs(gkp), 440+100*gka, 1
58 ;; a1 oscil 10000, 440, 1
59 out a1
60 endin
61
62 </CsInstruments>
63
64 <CsScore>
65 f1 0 4096 10 1
66 i1 0 300
67
68 </CsScore>
69
70 </CsoundSynthesizer>