Cabbage Logo
Back to Cabbage Site

Unexpected behavior when trying to set kmps

Hi,

I tried to change default ksmps in a .csd and it didn’t work. So I tried to load other .csd I had on my computer and changed ksmps, and it worked for some of them. My goal is to set ksmps to 1024 in one of my project (I know it’s high but the latency declared is close to 20ms so I wanted to optimize the code for a lower CPU usage)

Here is an illustration of the issue below:

The code doesn’t make sense because I tried to add/remove some parts of the code to isolate the issue but I couldn’t find it. Does someone know what could happen?

Thank you!

.csd (ksmps doesn’t change):

<Cabbage>
form caption("Bug") pluginId("def1") size(840, 500), guiMode("queue"), colour(200,200,200) 

</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d
</CsOptions> 
<CsInstruments> 
; Initialize the global variables. 
ksmps  =  64
nchnls =  2
0dbfs  =  1

instr 1
    a1 inch 1
    a2 inch 2
    outs a1, a2
endin 

</CsInstruments>

<CsScore>
;causes Csound to run for about 7000 years...
f0 z
i 1 0 [60 * 60 * 24 * 7] 
</CsScore>

</CsoundSynthesizer>

Wow, that is odd. Leave it with me. I can reproduce it here on Windows. Nothing jumps out at me.

1 Like

There is an extra whitespace after the <CsoundSynthesizer> tag that is causing the problem. I’m not sure why this is, but I’m almost 100% sure it’s a Cabbage issue rather than a Csound one. Cabbage does parse the csd text for info about ksmps and other such things. So the route of the problem might be in that. This is another part of the code base that won’t be getting pulled in Cabbage3. Hindsight is a great thing, but I have to admit to making some rather naive decisions along the way with Cabbage 1 and 2 :grimacing:

Thanks Rory! I confirm removing this extra whitespace solves the issue!