René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

Echo in CSound

I have found this echo on http://icem-www.folkwang-hochschule.de/~neuhaus/klangsynthese/node42.html and found it so useful I had to copy it.
It is much better than the standard comb opcode.
f 1 0 1024 10 12 11 10 9 8 7 6 5 4 3 2 1
i 1 0 .5 5000 100
i 1 1 .5 5000 200
i 1 2 .5 5000 300
f 0 3
s
i 100 0 7 2 

i 1 0 .5 5000 100
i 1 1 .5 5000 200
i 1 2 .5 5000 300

i 100 7 7 4 

i 1 7.01 .5 5000 100
i 1 8    .5 5000 200
i 1 9    .5 5000 300
f 0 15
s
i 100 0 8 8

i 1 0 .5 5000 100
i 1 1 .5 5000 200
i 1 2 .5 5000 300

i 100 8 20 16

i 1 7.01 .5 5000 100
i 1 8    .5 5000 200
i 1 9    .5 5000 300
f 0 20

e
sr = 44100
kr = 4410
ksmps = 10
nchnls = 2

gareverb init 0

instr 1

iamp  = p4
ifreq = p5

kamp    linseg 0,0.01,iamp,0.1,iamp/4,p3-0.21,iamp/4,0.1,0
asig    oscil   kamp,ifreq,1
        outs    asig,asig
        
gareverb = gareverb + asig/2

endin

instr 100; reverb
gareverb init 0

irevtime  = p4

apdelay delay gareverb, sqrt(irevtime)/50

acomb0 comb apdelay,irevtime,0.05
acomb1 comb apdelay,irevtime,0.056
acomb2 comb apdelay,irevtime,0.061
acomb3 comb apdelay,irevtime,0.068
acomb4 comb apdelay,irevtime,0.072
acomb5 comb apdelay,irevtime,0.078
asum   =    (acomb0 + acomb1 + acomb2 + acomb3 + acomb4 + acomb5)/6
asig0 alpass asum,irevtime, 0.006
asig1 alpass asig0,irevtime,0.0063
asig2 alpass asum,irevtime, 0.0061
asig3 alpass asig1,irevtime ,0.0062
        outs (asig0+asig1),(asig2+asig3)
gareverb = 0
endin