Cabbage Logo
Back to Cabbage Site

Envelope chnset widget

Can I use the chnset opcode to implement an envelope on a widget
So far I have a moogladder with a widget control on the cutoff frequency can I use the chnset opcode to apply an envelope to that widget to control the amount of time that widget is set so with a high decay on the envelope the widget will bounce from 0 to 2000 for example

I’m a little confused, are you asking if you can control a widget from data in Csound, like say an envelop? If so the answer is yes. Check out the following code:

<Cabbage>
form caption("Untitled") size(400, 300), colour(58, 110, 182), pluginid("def1")
keyboard bounds(8, 158, 381, 95)
rslider bounds(20, 14, 104, 108) channel("slider"), range(0, 1, 0, 1, 0.001)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
ksmps = 32
nchnls = 2
0dbfs = 1

;instrument will be triggered by keyboard widget
instr 1
kEnv madsr .1, .2, .6, .4
chnset kEnv, "slider"
aOut vco2 p5, p4
outs aOut*kEnv, aOut*kEnv
endin

</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
</CsScore>
</CsoundSynthesizer>

envControl.csd (703 Bytes)

I was more interested if the chnset opcode could be used to modulate the widget if so how would you go about doing this

Continuously? Just use an oscillator? I’m still not following exactly what you are trying to do.

Sorry for my explanation very much like in the explanation above but only once with varying levels of in intensity so aswell as having a filter cutoff slider you can control in the GUI you could set the cutoff slider to move independent of the GUI control or could leave it at 0 and have no independent movement

I suppose with an oscillator that only has one cycle might be what I need or maybe another solution :thinking:

I suppose one way to describe what I mean is an envelope on top of a filter so on the GUI there’s a slider controlling the filter cutoff but then also something maybe a adsr envelope modulating the filter cutoff also

My first example showed a slider being controller by an ADSR, that could easily be connected to a filter, and any other control signal can easily be connected to a widget. There is two way communication.