Faust button output

What’s the FAUST syntax for controlling button leds?
I can get CV out with:

cv = hslider("cv>[OWL:F]", .....)

and gate out with

tr5 = hbargraph("tg5>[OWL:B5]", 0, 1)

But I don’t have a clue on how to access button leds.
Any help will be very much appreciated.

EDIT: I’m working on patches for Witch

There’s no separate control for LEDs, button sets CV value on gate and LED if its available. You should be using button instead of hbargraph or there’s checkbox that can be toggled instead of giving momentary value.

If that doesn’t work, it might be some bug in With UI for handling LEDs.

1 Like

Thanks @antisvin for your quick reply.

I tried button and checkbox and both gave syntax errors when set for output.

gt1 = button("gt>[OWL:B1]", 0, 1); // throws sytax error
gt1 = checkbox("gt>[OWL:B1]", 0, 1); // throws sytax error

gt1 = hbargraph("gt>[OWL:B1]", 0, 1); // works

So hbargraph must be used for output, but the OWL value can be set to B1-B4, even if the button is already set as input:

btn1 = checkbox("BTN1[OWL:B1]", 0, 1); // input
gt1 = hbargraph("GATE OUT>[OWL:B1]", 0, 1); // output

I really appreciate your help. Thanks!

Sorry, you’re right of course - FAUST doesn’t let you use buttons as outputs and it doesn’t offer any alternative widget for that role. In FAUST the direction is actually determined by widget used (bargraphs are outputs, sliders and buttons are inputs, etc).

The > is necessary for hardware that has CV channels that can be configured as inputs or outputs on the fly (i.e. Magus). It’s recommended to use it for CV outputs even if you’re making a patch for device that has fixed CV direction to make it compatible with Magus. It doesn’t matter for buttons, at least currently - their direction is always fixed.

1 Like

Good to know. Thanks for all the info, it really helps. I’m just taking my first steps and it’s still a bit confusing.

Yes that’s correct. But when using checkbox, the corresponding LED is already controlled by the patch to show toggle status.

If you wanted to you could achieve the same thing by using button("[OWL:B1])" to toggle a variable, and sending the value back out to hbargraph("[OWL:B1]").

To illustrate, here’s a simple working example that inverts the button LED:

import("music.lib");

btn1 = button("btn1[OWL:B1]");
led1 = hbargraph("led1>[OWL:B1]", 0, 1);

process = attach(osc(1000) * btn1, 1-btn1 : led1);

You could of course use any signal to control the LEDs, it doesn’t have to be a button.

I’ll try to add an explanation of this to the docs.

1 Like

Great. Thanks for the clarification! : )