Open Stage Control Basic Widget Questions for Beginners

Hi OSC Community,

I thought I'd start a basics for beginners thread to better understand OSC for myself, but also to help anyone else who is new to OSC. As I continue to build different aspects of my template, I come across certain issues, syntax problems, or ways widgets work that I have questions about.

I'm trying to make a tap button that sends a midi cc message of a specific value. In this case, I'd like a button to send channel 1, cc1 value of 64.

I've made a button, but how come this doesn't work?

image

Cheers

The button sends its on and off values only.
When in tap mode, it only sends the on value.
So, just change the on prop to 64.

Good to know, thank you. So the "value" field for any type of button does nothing?

It does, but mainly for dynamically changing its value.
For instance, you can have another widget, that in a specific condition, sets the button value to on or off.

1 Like

Got another basic question about text and the textarea widgets.

I would like to label my faders with the CC# but also the description of what the control does. I can use multiple text widgets per fader...but I wanted to know if there's a more simplified way, since my description will typically be a single word.

The question is can I add a line break into the text widget? So the Top line reads "CC#" and beneath that it reads "Expression" for example.

Yes, you can use Shift + Enter to add a line in a common prop.

1 Like

Thank you, I ended up using separate text widgets. Unless there's a way to use shift + enter, and adjust the line spacing further

You can adjust the line-height property in the text widget CSS prop, like so:

label {
    line-height: 1.25em;
}
1 Like

Got another question about buttons. Would the following require a custom module?

I have multiple faders...let's say 10 that control different CC messages. They all have a default position value set.

I would like to have a single "tap" button that sends the current (or default) value of all faders. Are there any pointers you can give me on how to accomplish this?

I'm practicing using buttons to modify other widget properties. I came across

getVar(widgetId, variableName)

setVar(widgetId, variableName, newValue)

however am not able to get it to work properly. Is there a syntax issue or am I approaching this incorrectly?

"Faders" is the widgetID of the panel.

As an example, I have a panel with multiple faders.
image

I've created a button elsewhere and in
Script: On Value:
image

But the panel won't change visibility upon button press.

When using scripting, ids, vars, props names, etc, should be used between quotes, like this:

if (get("button_2" == 1) {
    setVar("Faders", "fadersVis", false)
}
1 Like

Answering your previous question:
You can use the linkId prop, setting a button to be the master and all the faders to be slaves (prepending the linkId name with >> or << respectively)
I've added this functionality to the previous fader example I did before.
Here is the new session demonstrating it:
fader_composite.json (11.9 KB)

1 Like

Thank you for this, I notice the button value determines where the faders get reset to. What if you wanted to have different faders "reset" at different values?

ex:
Expression default value (and reset) should be 127
Mod default value(and reset) 64

Ah interesting now I see the manual says "as a string" meaning quotes. Thank you again. Also, if you wouldn't mind, could you show me an example of this same functionality but using a custom module?

I think the syntax issues are what's making it tough to learn..as I'm just starting out. Anywhere to point me to with more examples to better study this?

and it gets more complex :sweat_smile:
Not sure if it's the best approach, but it works fine.
Basically I created some variables to reset faders groups, and I'm using them as linkdId masters.
Then, in the button, I removed the linkId and added an onValue script to set the variables groups to their corresponding values.
Here is the session example (too lazy to rename it, lol)
fader_composite.json (12.4 KB)

This is only one way of solving the problem.

1 Like

Well, learning a language is quite a long journey. The hardest thing is not the syntax, but to make your mind thinking logically. I suggest starting with the basic concepts, operators and types definition, like string, boolean, array, object, etc.

This is a good resource:

2 Likes