Hello.
I’m trying to sum the output of each instance of instr 1, and output the sum in instr 99. This is because I want to apply opcodes such as filtering in instr 99 instead of 1 to reduce CPU usage.
Currently, this is causing feedback/loud noise the way I’ve implemented it (warning: loud sound)
Wondering if anyone has any tips on how to achieve this correctly.
<Cabbage>
form caption("Stretch") size(600, 500), guiMode("queue"), pluginId("1287"), colour (0,100,0)
keyboard bounds(102, 380, 381, 95)
soundfiler bounds(110, 52, 300, 200), channel("Soundfiler1", "Soundfiler2"), colour(188, 188, 188), tableBackgroundColour(62, 71, 86), showScrubber(1), displayType("mono")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
gaOutL init 0
gaOutR init 0
instr 98
gSfile cabbageGet "LAST_FILE_DROPPED"
if (changed(gSfile) == 1) then
cabbageSet 1, "Soundfiler1", "file", gSfile
endif
endin
instr 1
Sfile cabbageGet "Soundfiler1", "file"
if filevalid(Sfile) == 1 then
if filenchnls(Sfile) == 1 then
a1 diskin2 Sfile, 1, 0, 1
gaOutL += a1
else
a1, a2 diskin2 Sfile, 1, 0, 1
gaOutL += a1
gaOutR += a2
endif
endif
endin
instr 99
outs gaOutL, gaOutR
endin
</CsInstruments>
<CsScore>
f0 z
i98 0 z
i99 0 z
</CsScore>
</CsoundSynthesizer>