Debian Codegraph @

examples/modulus.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac -Ma --midi-key=4 --midi-velocity-amp=5 -m0 ;;;realtime audio out and midi in
5 ;-iadc ;;;uncomment -iadc if realtime audio input is needed too
6 ; For Non-realtime ouput leave only the line below:
7 ; -o %.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 sr = 44100
12 ksmps = 32
13 nchnls = 2
14 0dbfs = 1
15
16 giScale ftgen 1, 0, -12, -2, 0, -34, -7, 10, -14, 3, -21, -3, -27, -10, 7, -17 ;12 note scale with detuned keys
17
18 instr 1
19
20 ikey = p4
21 ivel = p5
22 indx = ikey % 12 ;work on the twelftone scale
23 icent tab_i indx, giScale ;load the scale
24 ifreqeq = cpsmidinn(ikey)
25 ifreq = ifreqeq * cent(icent) ;change frequency by cents from table
26 prints "Key %d modulus 12 = %d. ", ikey, indx
27 prints "Equal-tempered frequency of this key = %f,", ifreqeq
28 prints " but here with cent deviation %d = %f%n", icent, ifreq
29 asig vco2 ivel*.5, ifreq
30 outs asig, asig
31
32 endin
33 </CsInstruments>
34 <CsScore>
35 f 0 60 ;run for 60 seconds
36
37 e
38 </CsScore>
39 </CsoundSynthesizer>
40