I’m not sure if this is a bug or is it my bad doing?
I’m appending strings to an array. If I let this code run for a while it fills up the memory really badly and it doesn’t release it after I stop it. Also CPU consumption is not low.
Maybe I’m causing this, but I though it would do the job at i-time and be done with it.
Maybe there is a more clever way of appending strings to array?
**
**<Cabbage>
form caption("test strings array") size(300, 200), colour(0, 0, 0), pluginId("tsa1") guiMode("queue")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-d -n -+rtmidi=null -M0 -m0d
</CsOptions>
<CsInstruments>
ksmps = 16
//# appendStrings
opcode appendStrings, S[],S[]S
StringsIN[], Snew xin
iN = lenarray(StringsIN)
StringsOUT[] init iN+1
ind = 0
until ind == iN do
StringsOUT[ind] = StringsIN[ind]
ind += 1
od
StringsOUT[iN] = Snew
xout StringsOUT
endop
instr 1
Strings[] fillarray "default 1-1"
Strings[] appendStrings Strings, "woodwind - metal barrel"
Strings[] appendStrings Strings, "woodwind - barrel"
Strings[] appendStrings Strings, "woodwind - vocal barrel"
Strings[] appendStrings Strings, "woodwind - metal tube"
Strings[] appendStrings Strings, "deep 1: 1/3-1/6" ; -
Strings[] appendStrings Strings, "deep 2: 1/3-2/3" ; (shallow); -
Strings[] appendStrings Strings, "deep 3" ;(mid); -
Strings[] appendStrings Strings, "deep 4: 1/2-1/4" ; -
Strings[] appendStrings Strings, "shallow 1: 1/2-1/2" ; -
Strings[] appendStrings Strings, "paper 1: 1/2-1" ; -
Strings[] appendStrings Strings, "golden 3-3" ; 0.618 0.618 -
Strings[] appendStrings Strings, "golden 3-5" ; 0.618 1.618 -
Strings[] appendStrings Strings, "flat pan bell 2/3-1/3" ; -
Strings[] appendStrings Strings, "deep 5 (punch: 2/3-1/3)" ; -
Strings[] appendStrings Strings, "woodwind - trombone"
Strings[] appendStrings Strings, "bright: 1-3/2" ; -
Strings[] appendStrings Strings, "organ: 1-2" ; -
Strings[] appendStrings Strings, "tube bell"
Strings[] appendStrings Strings, "organ 1-3" ; -
Strings[] appendStrings Strings, "brass 1-1/2"
Strings[] appendStrings Strings, "brass 1-2"
Strings[] appendStrings Strings, "pan can: 5/4-5/4" ; -
Strings[] appendStrings Strings, "sharp 4/3-1/3" ; -
Strings[] appendStrings Strings, "bell 3/2-3/2" ; -
Strings[] appendStrings Strings, "tube can"
Strings[] appendStrings Strings, "sharp pan bell 3/2-1/3" ; -
Strings[] appendStrings Strings, "clarinet bass"
Strings[] appendStrings Strings, "clarinet alt"
Strings[] appendStrings Strings, "clarinet sopra"
Strings[] appendStrings Strings, "golden 5-3" ; 1.618 0.618
Strings[] appendStrings Strings, "sharper pan bell 5/3-1/3" ; -
Strings[] appendStrings Strings, "brass 2-1"
Strings[] appendStrings Strings, "tin can LFO"
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z ;starts instrument 1 and runs it for a week
i 1 0 -1;[60*60*24*7]
</CsScore>
</CsoundSynthesizer>