Debian Codegraph @

examples/lincos.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 </CsOptions>
4 <CsInstruments>
5
6 sr = 44100
7 ksmps = 128
8 nchnls = 2
9 0dbfs = 1.0
10
11 ; Example file for lincos.csd
12
13 /*
14 lincos
15
16 similar to cosseg, but with an explicit input for time
17 lincos can be used ease-in / out any linear ramp
18
19 ky lincos kx, ky0, ky1, kx0=0, kx1=1
20 iy lincos ix, iy0, iy1, ix0=0, ix1=1
21
22 */
23
24
25 seed 0
26
27 instr 1
28 ; Map a value within the range 1-3 to the range 0-10.
29 iy lincos 1.5, 0, 10, 1, 3
30 print iy
31 kx line 1, p3, 3
32 ky lincos kx, 0, 10, 1, 3
33 printks "kx: %f ky: %f \n", 1/kr, kx, ky
34 endin
35
36 instr 2
37 ; lincos can be used to create amplitude or pitch envelopes
38 ktrig init 0
39 krnd dust 1, 1
40 ktrig = lineto(tirghold(krnd & ~ktrig, 0.5), 1)
41 kpitch = lincos:k(ktrig, 60, 61)
42 a0 oscili 0.7, mtof(kpitch)
43
44 kfade lincos linsegr(0, 1.5, 1, 1.5, 0), 0, 1
45 kcresc lincos ktrig, 0.25, 1
46 outch 1, a0 * interp(kfade * kcresc)
47 endin
48
49 </CsInstruments>
50 <CsScore>
51
52 i 1 0 0.2
53 i 2 0 20
54
55 </CsScore>
56 </CsoundSynthesizer>