Cabbage Logo
Back to Cabbage Site

Standard way for a control, but k display?

I’m building an effect that will have audio rate LFOs. I’ll want to update the GUI to reflect the faders turning at the LFO rates. I think I understand that I’ll want to translate the audio rate LFO to a k-rate control for Cabbage. Is there a standard way that this is done? If you could point me to an example .csd file, documentation, or a vid, I’d be really appreciative.

Thank you!

I think you can use k(aLfo) or the downsamp opcode which provides an optional averaging window:

instr 1
aLfo  = lfo(1, .2)
kLfo  = k(aLfo)
kLfo2 = downsamp(aLfo) 
printk .2, kLfo
printk .2, kLfo2
endin 

</CsInstruments>
<CsScore>
i1 0 5.1
</CsScore>
</CsoundSynthesizer>

https://csound.com/docs/manual/downsamp.html
https://csound.com/docs/manual/opk.html

1 Like

Thank you!

1 Like

Rather than update the control at rate, you might want to reduce the number of updates a second using the optional trigger parameter to cabbageSetValue. Updating at k-rate can put a bit of a load of the CPU.

Thanks! I learned about using the metronome to trigger the updating. 30 times a second looked smooth enough to me. And much less taxing than the 1500 times a second my k-rate would be.

In the new version of Cabbage this won’t be much of a concern any more :wink: Things will be a lot smoother :slight_smile:

2 Likes