Hi, is it possible to use a LFO to control the parameters in the GUI? Such as a LFO changing the value for a simple knob or the values in a xy-pad, resulting in it happening visually in the GUI, instead of “behind the scenes”.
Hi @hdale94, and welcome to the forum!
Each widget has two communication with Csound. They can send and receive data. All standard VST widgets such as
comboboxes, etc can all have their values set using a
chnset. For example:
If you wish to modify the appearance of a widget you can use identifier channels. These are special channels that you can use to send Cabbage syntax to from your Csound code. This is a little more work as you have to generate entire strings of Cabbage code to send from Csound. You can read more about this here in the docs.
Nice! Thank you.
I have another question. I want to make a LFO go between f. example -1 and 1, but am having problems setting values to minus for the knob (in the code).
The range is set to -1 to 1.
Don’t use abs, this returns an absolute value. I was only using it earlier because my slider went from 0 to 1…
Ahh of course, I didn’t understand what abs really meant, so removing it fixed it right away! Thanks!
Things work perfect sonically, and the knob works perfect, but I am struggling to use a LFO to automate the x and y value of a xy-pad. So that the movement is the same as the example https://cabbageaudio.com/images/docs/xypad.gif
Hmm, looks like something is broken. You should be able to just grab and throw the ball around. I’ll have a look into this and try to get a fix as quickly as I can.
Ah yes using the xy-pad normally seems fine (leftclick, move around), but making it move accordingly to a LFO’s value is what I’m having problems with
Basically what I’m trying to do is link the channel for a knob and x or y-value of the pad together, so that when the knob is changing, the x or y-position also changes. And then when I use a LFO on the knob, it will also create the same movement in the xy-pad
Hi @hdale94, I fixed that bug. You should be able to try the fix in this latest beta build. You need to click on the drop link and then download the zip file. I had commented out the ability to
chnset values in the xypad because if you are updating the ball position and a user clicks on the xypad strange things happens as they will override the chnset momentarily. So I’m not sure if this is the best approach to take?
Nice! Yes it works and I notice what you describe. Maybe if I make a if-statement where the LFO stops when you drag on the ball, and when you release it, the LFO is enabled again? Do you think this is possible?
The question is, how do you know when the user has dragged the ball? It sounds like you might want to roll your own XY pad with an image widget?
I did something like this with a button to include it in a IF-statement. It’s not correct yet (trying to change LFO-type with a single click), but it will activate what’s inside the IF-statement.
if (chnget:k(“button2”) == 1) then
kLFOtype =+ 1
Maybe make my own XY-pad using a similar principle? Where the button would move accordingly to x and y parameters, and when you press it, an if-statement would stop the lfo, and continue on release. So basically checking the values of the button when being pressed and not.
If you are ok using a button then this approach will work. If I get time I’ll throw together a mock-up home rolled version of what I was talking about…
Ah yeah I guess a button is not that elegant of a solution, I was just thinking that it could be one way of achieving it. Rolling my own xy-pad with an image widget would indeed be very nice!
You could maybe build on this one?
xyPadHomegrown.csd (1.1 KB)
Nice! Yes I will try that
Note that you should probably put the brakes on in terms of how quickly this updates its GUI as it might put a drain on the CPU. Something like this. Visually there is not much of a different, but this only updates the UI 10 times a second as opposed to every 32 samples. You can also slow down the GUI update rate using the guifrefresh() identifier.
;basic usage instr 1 iXOffset = 0 iYOffset = 0 iXYPadWidth = 200 iXYPadHeight = 200 kBallClick chnget "xyClick" kMouseDown chnget "MOUSE_DOWN_LEFT" kX oscil 1, .15, 99 kY oscil 1, .7, 99 if metro(10) == 1 then if kMouseDown == 1 then SMessage sprintfk "pos(%d, %d)", chnget:k("MOUSE_X"), chnget:k("MOUSE_Y") chnset SMessage, "ballIdent" else SMessage sprintfk "pos(%d, %d)", kX*iXYPadWidth, kY*iXYPadHeight-5 chnset SMessage, "ballIdent" endif endif endin
I will work it into the project now. Also, is it possible to change the value of a button one single time, like when you press the button, it would only change from 0 to 1 one single time (so back to 0 immediately after 1), regardless of if you hold the button in or not?
This is for triggering a change in the waveform of a LFO