Debian Codegraph @

examples/xyscale-FLTK.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 ksmps=128
10 nchnls=2
11
12 giwidth = 400
13 giheight = 300
14 FLpanel "FLmouse", giwidth, giheight, 10, 10
15 FLpanelEnd
16
17 FLrun
18
19 0dbfs = 1
20
21 instr 1
22 ; We define four chords for bottom-left, bottom-right, top-left and top-right
23 ; Use the mouse to interpolate between them
24 ibl[] fillarray ntom:i("4C"), ntom:i("4Eb"), ntom:i("4G")
25 itl[] fillarray ntom:i("4E"), ntom:i("4G#"), ntom:i("4B")
26 ibr[] fillarray ntom:i("4G"), ntom:i("4A"), ntom:i("4B")
27 itr[] fillarray ntom:i("4Eb"), ntom:i("4Eb+"), ntom:i("4F")
28
29 kmousex, kmousey, kb1, kb2, kb3 FLmouse 2
30 kx = limit(kmousex/giwidth, 0, 1)
31 ky = 1 - limit(kmousey/giheight, 0, 1)
32
33 printf "x: %f y: %f \n", changed(kx, ky), kx, ky
34
35 iamp = 0.1
36 a0 oscili iamp, mtof(xyscale(kx, ky, ibl[0], itl[0], ibr[0], itr[0]))
37 a1 oscili iamp, mtof(xyscale(kx, ky, ibl[1], itl[1], ibr[1], itr[1]))
38 a2 oscili iamp, mtof(xyscale(kx, ky, ibl[2], itl[2], ibr[2], itr[2]))
39 aout = sum(a0, a1, a2)
40 outs aout, aout
41 endin
42
43 </CsInstruments>
44 <CsScore>
45 i 1 0 120
46
47 </CsScore>
48 </CsoundSynthesizer>