This is the basic circular delay example from the Csound 6 book. It is easy to understand, but seems incredibly inefficient based on RAM usage. For my purposes (I’ve extended this quite a bit …), this approach was very attractive, but the RAM usage is crippling.
<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue") pluginId("def1")
rslider bounds(296, 162, 100, 100), channel("gain"), range(0, 1, 0, 1, .01), text("Gain"), trackerColour("lime"), outlineColour(0, 0, 0, 50), textColour("black")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d
</CsOptions>
<CsInstruments>
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
opcode Delay,a,ai
setksmps 1
asig, idel xin
kpos init 0
isize = idel > 1/sr ? round(idel*sr) : 1
adelay[] init isize
xout adelay[kpos]
adelay[kpos] = asig
kpos = kpos == isize-1 ? 0 : kpos + 1
endop
instr 1
kGain cabbageGetValue "gain"
a1 inch 1
a_delay_out Delay, a1, 60
outs (a1 + a_delay_out) * kGain, (a1 + a_delay_out) * kGain
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
;starts instrument 1 and runs it for a week
i1 0 [60*60*24*7]
</CsScore>
</CsoundSynthesizer>
I realize that I’ve set the delay to 60 seconds … but why the heck is Cabbage using 780 MB of RAM? I think this should be 8.23 MB of data (one minute of 24 bit, 48KHz audio). What am I missing?
Thank you!