Page 1 of 2
Switch needs to cycle again to turn off - fix?
Posted: 24 Mar 2013 12:43
by biologik
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?
Re: Switch needs to cycle again to turn off - fix?
Posted: 24 Mar 2013 14:21
by Softcore
The functionality you need is performed by a pad not a switch - the obvious disadvantage of course, being, you wont have visual feedback of whether the track has been fired or not. Perhaps you can bypass this disadvantage with scripting to control the pad's light (in order to mimic a on-off state) or use LED objects to display the track's status.
Re: Switch needs to cycle again to turn off - fix?
Posted: 24 Mar 2013 17:23
by dsorlien
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.
Code: Select all
// 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.
Code: Select all
// 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);
Re: Switch needs to cycle again to turn off - fix?
Posted: 25 Mar 2013 13:34
by biologik
Thanks guys! I'll give this a shot tonight
I appreciate your help!
Re: Switch needs to cycle again to turn off - fix?
Posted: 26 Mar 2013 21:31
by biologik
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!
Re: Switch needs to cycle again to turn off - fix?
Posted: 26 Mar 2013 22:25
by Softcore
You got typos in your script....
its not dec1 its decl (short for declare)... You are declaring a new variable named, for example blue and then you proceed instructing Lemur what that variable equals to
Re: Switch needs to cycle again to turn off - fix?
Posted: 27 Mar 2013 00:08
by dsorlien
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
Code: Select all
// 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} );
Re: Switch needs to cycle again to turn off - fix?
Posted: 27 Mar 2013 02:47
by wurlt01
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.
Re: Switch needs to cycle again to turn off - fix?
Posted: 27 Mar 2013 04:13
by biologik
It works!! Thank for the script Dsorlien! I appreciate it. Thanks to everyone else too
Wurlt01, the pad script that Dsorlien posted works exactly as you need. You can change the colors are you need. I used:
http://web.njit.edu/~kevin/rgb.txt.html to pick colors, although they don't all match up well for some reason.
Re: Switch needs to cycle again to turn off - fix?
Posted: 27 Mar 2013 16:54
by dsorlien
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')