Debian Codegraph @

examples/cent.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac ;;;RT audio out
5 ;-iadc ;;;uncomment -iadc if RT audio input is needed too
6 ; For Non-realtime ouput leave only the line below:
7 ; -o cent.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 instr 1 ; original pitch
17
18 iroot = 440 ; root note = A (440 Hz)
19
20 print iroot ;print out
21
22 asig oscili 0.6, iroot, 1
23 outs asig, asig
24
25 endin
26
27 instr 2
28
29 iroot = 440 ; root note = A (440 Hz)
30 icents = p4 ; change root note by 300 and 1200 cents
31
32 ifactor = cent(icents) ; calculate new note
33 inew = iroot * ifactor
34
35 print iroot ; Print all
36 print ifactor
37 print inew
38
39 asig oscili 0.6, inew, 1
40 outs asig, asig
41
42 endin
43
44 </CsInstruments>
45 <CsScore>
46 ; sine wave
47 f1 0 32768 10 1
48
49 i 1 0 2 ;no change
50 i 2 2.5 2 300 ;note = C above A
51 i 2 5 2 1200 ;1 octave higher
52
53 e
54
55 </CsScore>
56 </CsoundSynthesizer>