| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-odac |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
sr = 44100 |
| 7 |
ksmps = 32 |
| 8 |
nchnls = 1 |
| 9 |
0dbfs = 1 |
| 10 |
|
| 11 |
opcode lin\_reson, a, akk |
| 12 |
setksmps 1 |
| 13 |
avel init 0 ;velocity |
| 14 |
ax init 0 ;deflection x |
| 15 |
ain,kf,kdamp xin |
| 16 |
kc = 2-sqrt(4-kdamp\^2)*cos(kf*2*$M\_PI/sr) |
| 17 |
aacel = -kc*ax |
| 18 |
avel = avel+aacel+ain |
| 19 |
avel = avel*(1-kdamp) |
| 20 |
ax = ax+avel |
| 21 |
xout ax |
| 22 |
endop |
| 23 |
|
| 24 |
instr 1 |
| 25 |
aexc rand p4 |
| 26 |
aout lin\_reson aexc,p5,p6 |
| 27 |
out aout |
| 28 |
endin |
| 29 |
|
| 30 |
</CsInstruments> |
| 31 |
<CsScore> |
| 32 |
; p4 p5 p6 |
| 33 |
; excitaion freq damping |
| 34 |
i1 0 5 .0001 440 .0001 |
| 35 |
</CsScore> |
| 36 |
</CsoundSynthesizer> |
| 37 |
;example by martin neukom |