General

Switch needs to cycle again to turn off - fix?

Started by biologik on .

Sign in or create an account to join the conversation.

17 posts

Topic starter
Hi Everyone,
I'm creating a template for my elektron octatrack.
Right now I've created a switch so that it launches the track (this is akin to launching a clip in ableton). It works fine except that when I want to turn OFF the track I have to cycle the switch (ie. make it light up again and then turn it off). Any ideas on how I can fix that?
You could use a Custom Button, with Mode=Pad, then change the Custom Button's 'color' attribute in a script to display the track status. The color attribute is a 2-element array.
// set Custom Button color: OFF=blue, ON=red
decl blue = RGB(0,0,1);
decl red = RGB(1,0,0);
setattribute( myCustomButton, 'color', {blue, red} );
Similar thing is possible using a Pads object using the 'colors' attribute. This 'colors' attribute is an array, containing the integer values that specify the 'OFF' color of the individual pads.
// set Pads colors
decl blue = RGB(0,0,1);
decl red = RGB(1,0,0);
decl c = fill(1, blue, sizeof(myPadsObject.x) ); // set the default pad OFF color
c[0] = red; // replace this line of code with your code that configures your pad colors as desired
setattribute( myPadsObject, 'colors', c);
Hi Dsorlien,
I'm trying to get your pad script to work. Right now I can get the buttons to respond no problem. Only one touch turns it on and off - exactly what I needed. But the color doesn't stay on.
Maybe it's the script placement.. where should I be dropping it? I'm not going to lie here, i'm a COMPLETE n00b when it comes to scripting. I've only ever been using Lemur in automap or hardware CC format. The only "script" i've used is to progressively change the colors from light to dark. So, where should I be plopping this?

edit: here's the code I'm plopping in: dec1blue=RGB(0, 0, 1);dec1red=RGB(1, 0, 0);dec1c=fill(1, blue, sizeof(Pads.x));c[0]=red;setattribute(Pads, 'colors', c);
Thanks again!
If you are unfamiliar with scripting, start off by using multiple Custom Button objects rather than a Pads object.

I assume the OctaTrack only has 8 tracks, so you only need 8 Custom Buttons to launch the tracks. Create your template with the 8 Custom Buttons, set to 'Pad' mode. Use the Mapping window to map MIDI or OSC messages to each Custom Button as needed to launch the OctaTrack tracks. Get that working and test it with the hardware.

In each custom button, add a script. Set the script execution to: 'On Expression', x, 'rising edge'
The script will trigger when the Custom Button is tapped
Copy and paste this code to avoid typos
// swap Custom Button color each time it is tapped
decl blue = RGB(0,0,1);
decl red = RGB(1,0,0);
decl c = getattribute(getobject(), 'color');
if(c[0] != blue)
  setattribute( getobject(), 'color', {blue, red} );
else
  setattribute( getobject(), 'color', {red, blue} );
On same subject I'm using a custom button in pad mode. Can't use switch. I need button to stay light when pressed like with mackie button softcore made. But with same idea that it lights up instead of using color.
To match the colors to existing objects in your template, you can add a Monitor object to display the 'color' or 'colors' attribute of an object.

For example, suppose you have a Custom Button named "myCustomButton". To get the colors of this object, add a Monitor object with value:
getattribute(myCustomButton, 'color')
Thank you a million times dsorlien...finally I have found a way to do this :D :D
So many times I need a hybrid switch/pad behaviour and now I have it!

Wonder if it's possible to get the text to do the same thing i.e latch
biologik wrote:[color=#000000]Hi Everyone, I'm creating a template for my elektron octatrack. Right now I've created a switch so that it launches the track (this is akin to launching a clip in ableton). It works fine except that when I want to turn OFF the track I have to cycle the switch (ie. make it[/color] [color=#000000]led light[/color][color=#000000] up again and then turn it off). Any ideas on how I can fix that?[/color]
hello friend were you able to create successful switch? I am looking to built similar one so can you provide me some useful information,,