Cabbage Logo
Back to Cabbage Site

How to link slider to filter opcodes?

help me please. It’s must use some opcodes or other?
thank you so much

You use the channel() identifier for the widget, and the chnget opcode in Csound:

(...)
rslider bounds(10, 10, 90, 90), channel("cutoff")
(...)

instr 1
kCutoff chnget "cutoff"
(...)
1 Like

You should also also warp the response of your slider so that it is not simply outputting frequency values in linear fashion. One way to do this is to define the fourth argument of the ‘range’ identifier to something other than 1. This should be adjusted to taste but something like 0.25 should give more useful behaviour:

<Cabbage>
form caption("Untitled") size(400, 300), colour(58, 110, 182), pluginid("def1")
hslider bounds(10,10,380,30), channel("cutoff"), range(50,20000,10000,0.25)
</Cabbage>

<CsoundSynthesizer>
<CsOptions>
-n
</CsOptions>

<CsInstruments>

0dbfs = 1

alwayson 1
instr 1
asig vco2   1,100
kcf  chnget "cutoff" 
asig moogladder2  asig, a(kcf), 0.4
     outs   asig,asig
endin

</CsInstruments>
</CsoundSynthesizer>
2 Likes