| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-odac |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
|
| 7 |
sr = 44100 |
| 8 |
ksmps = 32 |
| 9 |
nchnls = 2 |
| 10 |
0dbfs = 1 |
| 11 |
|
| 12 |
;Van der Pol Oscillator ;outputs a nonliniear oscillation |
| 13 |
;inputs: a_excitation, k_frequency in Hz (of the linear part), |
| 14 |
;nonlinearity (0 < mu < ca. 0.7) |
| 15 |
opcode v_d_p, a, akk |
| 16 |
setksmps 1 |
| 17 |
av init 0 |
| 18 |
ax init 0 |
| 19 |
ain,kfr,kmu xin |
| 20 |
kc = 2-2*cos(kfr*2*$M_PI/sr) |
| 21 |
aa = -kc*ax + kmu*(1-ax*ax)*av |
| 22 |
av = av + aa |
| 23 |
ax = ax + av + ain |
| 24 |
xout ax |
| 25 |
endop |
| 26 |
|
| 27 |
instr 1 |
| 28 |
kaex = .001 |
| 29 |
kfex = 830 |
| 30 |
kamp = .15 |
| 31 |
kf = 455 |
| 32 |
kmu linseg 0,p3,.7 |
| 33 |
a1 poscil kaex,kfex |
| 34 |
aout v\_d\_p a1,kf,kmu |
| 35 |
out kamp*aout,a1*100 |
| 36 |
endin |
| 37 |
|
| 38 |
</CsInstruments> |
| 39 |
<CsScore> |
| 40 |
i1 0 20 |
| 41 |
</CsScore> |
| 42 |
</CsoundSynthesizer> |
| 43 |
;example by martin neukom, adapted by joachim heintz |