Debian Codegraph @

src/Examples/FLOSS Manual Examples/01 Basics/01C02_rms_feedback_system.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac
4 </CsOptions>
5 <CsInstruments>
6 sr = 44100
7 ksmps = 32
8 nchnls = 2
9 0dbfs = 1
10
11 giSine ftgen 0, 0, 2^10, 10, 1 ;table with a sine wave
12
13 instr 1
14 a3 init 0
15 kamp linseg 0, 1.5, 0.2, 1.5, 0 ;envelope for initial input
16 asnd poscil kamp, 440, giSine ;initial input
17 if p4 == 1 then ;choose between two sines ...
18 adel1 poscil 0.0523, 0.023, giSine
19 adel2 poscil 0.073, 0.023, giSine,.5
20 else ;... or a random movement
21 ;for the delay lines
22 adel1 randi 0.05, 0.1, 2
23 adel2 randi 0.08, 0.2, 2
24 endif
25 a0 delayr 1 ;delay line of 1 second
26 a1 deltapi adel1 + 0.1 ;first reading
27 a2 deltapi adel2 + 0.1 ;second reading
28 krms rms a3 ;rms measurement
29 delayw asnd + exp(-krms) * a3 ;feedback depending on rms
30 a3 reson -(a1+a2), 3000, 7000, 2 ;calculate a3
31 aout linen a1/3, 1, p3, 1 ;apply fade in and fade out
32 outs aout, aout
33 endin
34 </CsInstruments>
35 <CsScore>
36 i 1 0 60 1 ;two sine movements of delay with feedback
37 i 1 61 . 2 ;two random movements of delay with feedback
38 </CsScore>
39 </CsoundSynthesizer>
40 ;example by Martin Neukom, adapted by Joachim Heintz