Hi! This might be a bit of a vague and convoluted question.
I have a complex instrument, which is crashing Cabbage (2.7.7) and I am using Csound 6.16 from 6.16.1 beta (due to the turnoff
issue, Csound and Cabbage beta - incompatibilities?). In essence, it is a complex sequencer with lots of randomizations including tempo, scale, timbre etc.
I find it difficult to debug my instrument due to many parameters and crashing occurring after some time of running the beast (maybe after 10 min)… I couldn’t detect any abnormal CPU spikes during performance or before crashes.
I believe I narrowed down the source of crashing to the blinking lights, which I am using to indicate a discrete random change of tempo and a note sequence shuffle. After removing the “blinkers”, I had the instrument running for several hours now without a crash. However, I can’t reproduce the crashing by just extracting the blinking mechanism out of the entire thing (see example below).
-
I’m wondering if there is a way to log Csound and/or Cabbage errors, could they be detected before a Cabbage crash? I feel I am getting more creative in modular code debugging, but I am wondering if there are any tools/tricks I could use and if you could give me any advices on this?
-
I realize that the inner workings of Cabbage might be chaotic and mysterious (surely to me), e.g. the recent issue with the recursive loop in the
checkbox
widget (Little GUI widget slugs and wishes). I’m thus wondering if my crashing issue could be due to something similar. -
I tried with
image
instead ofcheckbox
with similar results. So, I am wondering if it could be due to my method of “blinking” and maybe related to the devoted “blinking instruments” used here?
In the example below, I have three knobs: (1) METRO for base frequency (kMetroFrq0), (2) DIS-F (kDisorderFrq) for disordering frequency, (3) RND for amount of randomization and a SYNC button to switch type of randomization. I’m setting a frequency (kMetroFrq) as a multiple of kMetroFrq0 and two types of randomisers selected by the SYNC button: (1) smooth jspline or (2) a discrete multiplier read from an array at kMetroFrq*kDisorderFrq. I am also shuffling notes (commented in this example) at frequency kDisorderFrq. There are two lights blinking: (1) at kDisorderFrq and (2) at discrete jumps when SYNC = 1. In both cases kMetroFrq0>0 for lights to blink. So sorry, this became a really long description!
<Cabbage>
form caption("Test") size(150, 150), colour(0,0,0), guiMode("queue"), pluginId("tmb1")
rslider bounds(20, 28, 36, 36) range(0, 1, 0, 0.7, 1e-06) channel("SL_MetroFrq") colour(255, 255, 0, 255) trackerColour(255, 255, 100, 255) markerColour(0, 0, 0, 255) popupText("0")
label bounds(20, 64, 36, 10) text("METRO") fontColour(255, 255, 0, 255) channel("label5")
button bounds(96, 22, 25, 10) channel("SL_MetroRndFrqSync") text("SYNC", "SYNC") colour:0(255, 255, 0, 50) colour:1(255, 255, 0, 255) fontColour:1(0, 0, 0, 255)
rslider bounds(92, 32, 32, 32) range(0, 1, 0, 1, 1e-06) channel("SL_MetroRndFrqAmp") colour(255, 180, 0, 255) trackerColour(255, 255, 100, 255) markerColour(0, 0, 0, 255) popupText("0")
label bounds(92, 64, 32, 10) text("RND") fontColour(255, 180, 0, 255) channel("label10")
checkbox bounds(122, 23, 10, 10), shape("circle") colour:0(255, 255, 0, 150), colour:1(255, 255, 0, 255) channel("MetroRndBlink")active(0) automatable(0)
checkbox bounds(84, 94, 10, 10), shape("circle") colour:0(255, 255, 0, 150), colour:1(255, 255, 0, 255) channel("DisorderBlink") active(0) automatable(0)
rslider bounds(54, 94, 32, 32) range(0, 1, 0, 0.5, 1e-06) channel("SL_DisorderFrq") colour(200, 255, 100, 255) trackerColour(255, 255, 220, 255) markerColour(0, 0, 0, 255) popupText("0")
label bounds(54, 126, 32, 10) text("DIS-F") fontColour(200, 255, 100, 255) channel("label20")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d
</CsOptions>
<CsInstruments>
ksmps = 32
giMetroRndFrqMultiplier87[] fillarray 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 2/3, 3/4, 3/4, 3/4, 3/4, 3/4, 3/4, 3/4, 3/4, 3/4, 3/4, 3/4, 3/4, 3/4, 3/4, 3/4, 3/4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4/3, 4/3, 4/3, 4/3, 4/3, 4/3, 4/3, 4/3, 4/3, 3/2, 3/2, 3/2, 3/2, 3/2, 3/2, 3/2, 3/2
#define MIDI_low_lim #0.007874015748# ;1/127 = 0.007874015748
instr 1
kMetroFrq0 = 50*cabbageGetValue:k("SL_MetroFrq")
kMetroFrq = kMetroFrq0
kMetroRndFrqAmp = cabbageGetValue:k("SL_MetroRndFrqAmp")
kDisorderFrq = round(cabbageGetValue:k("SL_DisorderFrq")*32)/32/6
kMetroRndFrqSync = cabbageGetValue:k("SL_MetroRndFrqSync")
kind init 64
; tempo randomization
if kMetroRndFrqAmp > $MIDI_low_lim then
; smooth jitter tempo
if kMetroRndFrqSync == 0 then
kMetroFrq *= 1 + kMetroRndFrqAmp*jspline:k(0.9, .1+kMetroFrq0, .1+kMetroFrq0)
endif
; reset tempo (array index)
if trigger(kDisorderFrq,$MIDI_low_lim,1)==1 then
kind = 64
endif
; discrete tempo change (via table) - triggered frequency given by kMetroFrq*kDisorderFrq
if kMetroRndFrqSync == 1 && kDisorderFrq > $MIDI_low_lim then
if metro:k(kMetroFrq*kDisorderFrq) == 1 then
event "i", "Show_MetroRndBlink", 0, 1/ksmps
kind = 64 + kMetroRndFrqAmp^2*random:k(-64, 22)
endif
kMetroFrq *= giMetroRndFrqMultiplier87[round(kind)]
endif
endif
; SHUFFLE
kDisorderTrig = metro:k(kMetroFrq*round(cabbageGetValue:k("SL_DisorderFrq")*32)/32/6)
if kDisorderTrig == 1 then
event "i", "Show_DisorderBlink", 0, 1/ksmps
;tableshuffle giSequenceShuffle
endif
endin
instr Show_MetroRndBlink
cabbageSetValue "MetroRndBlink", trighold:k(1,1/ksmps) ; blink
endin
instr Show_DisorderBlink
cabbageSetValue "DisorderBlink", trighold:k(1,1/ksmps) ; blink
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
i1 0 z
</CsScore>
</CsoundSynthesizer>