Cabbage Logo
Back to Cabbage Site

Update Slider Value of incoming MIDI input?

Hello! Is there any way to update a widget value once I send a MIDI input? Basically, I want to be able to move the slider moving the MIDI Controller’s slider.

Any ideas?
Greetings

The easiest way to do this is with your host using MIDI assign, but if you are only using Cabbage then you can take the MIDI value and send it to a slider using a chnset. For example, the following instrument updates the slider’s value periodically.

<Cabbage>
form caption("Untitled") size(400, 300), colour(58, 110, 182), pluginid("def1")
keyboard bounds(8, 158, 381, 95), keypressbaseoctave(8)
rslider bounds(29, 22, 60, 60) range(0, 1, 0, 1, 0.001), channel("slider1")
</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

instr 1
k1 oscili .5, 1
chnset k1+.5, "slider1"
endin

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

Thank you.