Debian Codegraph @

examples/FLmouse.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 ; Audio out Audio in No messages
5 -odac -iadc -d ;;;RT audio I/O
6 </CsOptions>
7 <CsInstruments>
8
9 sr=44100
10 ksmps=128
11 nchnls=2
12
13 ;Example by Andres Cabrera 2007
14 giwidth = 400
15 giheight = 300
16 FLpanel "FLmouse", giwidth, giheight, 10, 10
17 FLpanelEnd
18
19 FLrun
20
21 0dbfs = 1
22
23 instr 1
24 kx, ky, kb1, kb2, kb3 FLmouse 2
25 ktrig changed kx, ky ;Print only if coordinates have changed
26 printf "kx = %f ky = %f \n", ktrig, kx, ky
27 kfreq = ((giwidth - ky)*1000/giwidth) + 300
28
29 ; y coordinate determines frequency, x coordinate determines amplitude
30 ; Left mouse button (kb1) doubles the frequency
31 ; Right mouse button (kb3) activates sound on channel 2
32 aout oscil kx /giwidth , kfreq * (kb1 + 1), 1
33 outs aout, aout * kb3
34 endin
35
36 </CsInstruments>
37 <CsScore>
38 f 1 0 1024 10 1
39
40 i 1 0 120
41 e
42
43 </CsScore>
44 </CsoundSynthesizer>