Debian Codegraph @

src/Examples/FLOSS Manual Examples/04 Sound Synthesis/04G01_Mass_spring_sine.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -n ;no sound
4 </CsOptions>
5 <CsInstruments>
6 sr = 44100
7 ksmps = 8820 ;5 steps per second
8
9 instr PrintVals
10 ;initial values
11 kstep init 0
12 k0 init 0
13 k1 init 0.5
14 kc init 0.4
15 ;calculation of the next value
16 k2 = k1 + (k1 - k0) - kc * k1
17 printks "Sample=%d: k0 = %.3f, k1 = %.3f, k2 = %.3f\n", 0, kstep, k0, k1, k2
18 ;actualize values for the next step
19 kstep = kstep+1
20 k0 = k1
21 k1 = k2
22 endin
23
24 </CsInstruments>
25 <CsScore>
26 i "PrintVals" 0 10
27 </CsScore>
28 </CsoundSynthesizer>
29 ;example by joachim heintz