Scriptlet: Arturia KeyLab MkII LED control

Latest Update (September 2024)
Scriptlet: Arturia KeyLab MkII LED control - #14 by tripleB

Here we go again :slight_smile: First snow this year, time to write some lines on what I have been doing since September :wink:

Today I want to provide my current work on a handy scriptlet to control the LEDs of the MIDI button, and the buttons LEDs on the right side of an Arturia KeyLab MkII controller.

As the MkII does not support MIDI controller feedback ( GP “sync”) to control the button states, I tried to figure out a different way. Reading through some articles here regarding the LCD screen, I finally found some comments on the Arturia forum how this could work :slight_smile:

There’s a lot of room for improvements, but I just wanted to provide a basic sample script and I’m also requesting for some feedback and thoughts!

The attached KeyLabMkIILEDs.gig (262.6 KB) provides two rackspaces to demonstrate how this scriptlet works, based on the GP included HaNonB70 B3 Organ VST3.

YOU NEED TO ADJUST THIS TO YOUR NEEDS (Audio & MIDI…) - this also means you need to do a user preset on your Keylab mkII providing MIDI CC messages on the used buttons.

Some limitations in advance:

  • the addressed LEDs can only light up in white with this method [edti] only in this first version - colour LEDs are supported in following version below…
  • the MIDI LED on the left accept brightness control - the 9 LEDs on the right do not :frowning:
  • there are more LEDs to get control - however I use them the standard way in my rig
  • we have to work around some KeyLab MkII ‘behaviour’

I’ve scripted this with GP 4.5.8 and my KeyLab 61 MkII Firmware 1.3.1 (latest)

Basic concept:

  • the scriptlet needs just to be wired to the keyLab mkII MIDI output - no input
  • the scriptlet sliders can now directly control all 10 LEDs
  • there are hidden widget which are grouped to the widgets who control the functions you want to use in GP

I’ve implemented a Halfmoon switch (with some additional rackspace scripting…). Leslie S/F is controlled by Sustain CC64 - only when Leslie is enabled. This is reflected by a slider widget with Slow (left, MIDI LED off) - Brake (middle, MIDI LED dimmed) - Fast (right, MIDI LED full bright)

The two switches on the right side just demo the different behaviour depending on latching or non-latching button controllers sent from the mkII - the Select 1 and Select 2 buttons are used…

And here we run in our first trap: typically you would use momentary button switches to avoid the Keylab FW to light up with the programmed LED and colour. As GP reacts on the button down the scriptlet would send out immediately a LED on (or off) sysex which will be overwritten by the mkII when you release the button… So flickering and wrong colour on the mkII…

Therefore, I introduced a small delay in the scriptlet for sending the sysex for the LEDs slightly later…

If you want to use latching buttons, you can reduce (or even comment out) the delay - for non-latching buttons you need to adjust the timing to you demands.
Keep in mind, that all delay times sum up, when a rackspace is activated (sending all of and variation states…).

Have fun! :sunglasses:

… and don’t forget to provide some feedback here :wink:

BBB

9 Likes

Hi, your script is working perfect !
Is it possible to add the buttons solo,mute, record , … and the other daw control buttons in your script ?
// Arturia KeyLab MkII LED On/Off Scriptlet
// tripleb, September 2022

var

btn_MIDI("MIDI") : parameter 0..2 = 0         // MIDI button,used as HalfMoon indicator (Stop will become dimmed...)

btn_1("Select 1")  : parameter 0..2 = 0       // the 9 buttons below the sliders
btn_2("Select 2")  : parameter 0..2 = 0
btn_3("Select 3")  : parameter 0..2 = 0
btn_4("Select 4")  : parameter 0..2 = 0
btn_5("Select 5")  : parameter 0..2 = 0
btn_6("Select 6")  : parameter 0..2 = 0
btn_7("Select 7")  : parameter 0..2 = 0
btn_8("Select 8")  : parameter 0..2 = 0
btn_9("Multi")     : parameter 0..2 = 0

// Main Function to create a System Exclusive Message for the desired LED
Function SendLEDString(led: string, onoff: integer)
var
    SysExMsg : String
    OnOff : String
    now : double
    
    OnOff = "00"
    
    SysExMsg = "F0 00 20 6B 7F 42 02 00 10 " + led     
    if onoff > 1 then
        OnOff = "7f"
        now = TimeSinceStartup() // add some delay to wait for button release in Momentary mode
        While TimeSinceStartup() < now + 200.0  Do

        end
        //Print(TimeSinceStartup())
         
    else
       if onoff > 0 then
            OnOff = "1F"
       end
    end
    SysExMsg = SysExMsg + OnOff + " F7"
    
 
    SendSysexNow(SysExMsg)
end

Initialization
   SetInfoMessage(
<<<Connect this Scriptlet to the MIDI out of your KeyLab MkII. 

There is no MIDI in needed. 

Connect the cntrols with grouped (and hidden) widgets and your leds will sync>>>) 
                    
   SetDisplayMessage("TripleB, 09/2022")
   
end



// Called when rackspace is activated
On Activate
    SendLEDString("14 ", btn_MIDI)
    
    SendLEDString("22 ", btn_1)
    SendLEDString("23 ", btn_2)
    SendLEDString("24 ", btn_3)
    SendLEDString("25 ", btn_4)
    SendLEDString("26 ", btn_5)
    SendLEDString("27 ", btn_6)
    SendLEDString("28 ", btn_7)
    SendLEDString("29 ", btn_8)
    SendLEDString("2a ", btn_9)
    
End


On ParameterValueChanged matching btn_MIDI
   SendLEDString("14 ", btn_MIDI)
End

On ParameterValueChanged(btn_i : subrange, i : integer) matching btn_1, btn_2, btn_3, btn_4, btn_5, btn_6, btn_7, btn_8, btn_9 

var 
    btn_led : string

    Select
       i == 0 : btn_led = "22 "
       i == 1 : btn_led = "23 "
       i == 2 : btn_led = "24 "
       i == 3 : btn_led = "25 "
       i == 4 : btn_led = "26 "
       i == 5 : btn_led = "27 "
       i == 6 : btn_led = "28 "
       i == 7 : btn_led = "29 "
       i == 8 : btn_led = "2a "
       
    End
    SendLEDString(btn_led, btn_i)
    
end
2 Likes

Hi,
btn_1(“Select 1”) : parameter 0…2 = 0
is “Select 1” the name used in ARTURIA MIDI CONTROL CENTER ?

I tried to define btn_solo(“solo”) (this button is named solo in ARTURIA CONTROL CENTER
I then added
On Activate

SendledString("34 ",btn_solo) (34 is hexvalue of 52 which is the cc received from this button)

On ParameterValueChanged matching btn_solo
SendledString("34 ",btn_solo) (34 is hexvalue of 52 which is the cc received from this button)

I tried also with the decimal value 52 but the led on the solo button is not changing.

Maybe I have it all wrong and you can help me out here ?

1 Like

Hi @vercom,

I’ll try to find some time at the weekend, unfortunately quite busy at the moment

BBB

Ok, thx

Hi KeyLab MkII users,

I just dived a little bit deeper in the KeyLab SysEx world this morning.
Two good news:

  • I figured out how to address the colours of the supported colour LEDs for the pads and the buttons below the sliders
  • I created a table with all my findings and all the other LEDs on the KeyLab MkII surface

Please find attached a small PDF with all needed information
Arturia KeyLab MkII SysEx.pdf (737.6 KB)

With this information you can easily modify my Scriptlet introduced above

@vercom you are on the right way:
btn_1(“Select 1”) describes the name for btn_1 in the scriptlet panel - I used the default panel names

If you want to add more LEDs/buttons you could either expand the array/list of btn_i or add more On ParameterValueChanged matching btn_XXX functions - have a look at the end of the scriptlet

And don’s forget to declare a new slider, defaults in On Activate :wink:

Have fun
BBB

PS: maybe we should bring this all together one day with the Arturia Keylab : display on LCD screen thread…
[Edit] just replaced the PDF because of two minor corrections…

6 Likes

Amazing ! Just tried with the solo btn and it works.
Thank you !

1 Like

Just one more update for today :slight_smile:

I did a KeyLabMkIILEDsV2.gig (327.2 KB)

In the rackspaces 3 and 4 you will find a new Scriptlet where you can setup the initial colour of the 16 Pads of an Arturia KeyLab MkII, just use the sliders and check :wink:

I had some trouble when sending too much SysEx, from time to time not all LEDs had responded, so I introduced some guard times in the Scriptlet, when the rackspace gets activated.

The Scriptlet in rackspace 4 ist the latest edit! Just switch between the rackspaces 1-4 to see the different behaviour when activating them

BBB

3 Likes

One day later - the final KeyLabMkIILEDsV3.gig (345.6 KB) - currently :sunglasses:

New:

  • OSC trigger added to send a Reset command to the Global Rackspace. In the Global backspace Script there’s small version of the scriptlet just to reset all Pad LEDs to blue
  • reloading the LED colour after a Pad has been touched, triggered own NoteOff of the used Pad
  • Orange light added to reflect all Gig Performer supported Pad widget colours - blue is default

I’ve played around a lot with the latest version od this scriptlet. For the moment I’m fine.

Have fun!

BBB

[Edit] the latest version of the scriptlet lives in Rackspace 4… Just switch between RS 4 and 1 to see the effects…

5 Likes

I just recently purchased my Keylab 88mkII and and very interested in integrating this script into my work. However, since I’m a totally newbie to scripting and what it can do, my eyes have been watering over in attempting to follow this thread. I guess my initial question is should this script be installed in a Global rackspace? Is there a template already built that would allow me to jump start this endeavor?
Many more questions to follow, I fear…

1 Like

Hi @musicbysterling,

you need to place the scriptlets in every rackspace you want to have access to the LEDs of your Keylab mkII and wire it to the KeyLab MIDI port. Just have a look at the picture in the initial post.

If you want additional support to reset the PAD LEDs when leaving a rackspace you have to copy the Global Rackspace script of the KeyLabMkIILedsV3.gig to your own giggle.

You can either go by copy and paste to an external editor while replacing the gig, or better: open a 2nd instance of GP and just copy and paste from there the complete blocks :wink:

1 Like

Do you have for Keylab Essential MK3?

No, sorry.

Update! Here comes V4 of the Arturia KeyLab MkII LED scriptlets!

What’s new?

  • the possible flickering of the LEDs while GP loads a gig is now history - there’s no MIDI output for the LEDs while GP starts up. This also prevents from some more or less rare crashes of GP in this startup phase - Good :slight_smile:
  • I removed the internal OSC commands completely, as they also figured out not to be very reliable due to asynchronous processes when changing rackspaces. Therefore now each of my rackspaces became the needed scriptlets (even just for switching LEDs off, or provide my standard colors for the pads…) in the wiring view.

So, the Global Rackspace script also became a bigger rework. With GP5 we became environments variables which I use to detect if GP is still starting up or up and running. In other words: if it’s ‘safe’ to switch LEDs on the KeyLab…

Please modify you Global Rackspace script accordingly.

There may occur one side effect if you recompile all of your scripts, or change your rig by the rig manager (who forces a recompile all scripts). As a result the LEDs may not work again.

Therefore the Global Rackspace became a button the set the environment variable for LOADED manually. Otherwise you can also just reopen GP or reload your gig file…

Have fun!

KeyLabMkIILEDsV4.gig (435.8 KB)

5 Likes

Hi tripleB, thank you very much for this useful script! It works fantastic. I have a question:
Is it also possible to use the bank select (part 1/2/bank) on the mk2 so we could use the 30 possible buttons?

kind regards
Carl

Hi @CarlVandoorne,

Have a look in the pdf a few postings back: Scriptlet: Arturia KeyLab MkII LED control - #6 by tripleB

You can access these 3 LEDs, however, you can not get the buttons by MIDI messages - they are ‚hardwired‘ to switch the knob/fader/button banks.

HTH - BBB

Edit: I also have not been able yet to switch these banks from GP :frowning:

1 Like

Thanks! I have a lot to learn.
kind regards

1 Like

You rock! While I haven’t had the chance to implement this yet, my rig consists of 2 Keylabs and I want to use the LED colors to help me track what button/drumpad does what so I will be adding this into my rig this fall. Thanks for this!

1 Like

Lazy Sunday afternoon - just added a new Scriptlet to the KeyLab LED collection :slight_smile:

I often just use the LEDs as an indicator in which part of a song (i.e. which variation) I am. With the old scriptlet I had to provide a lot of (hidden) grouped/linked buttons, and corresponding value limitations to select the wanted color.

With this additional script I can add a (hidden) knob widget within a rackspace to select one of my most used patterns (I typically use more than one LED - most common a complete row that I really can see where I am…). In each variation I can change this easily.

You can modify or add other patterns in the source code, I tried to keep it simple …

Enjoy!

Edit: replaced the gig - uploaded a version without restoring the LEDs after a pad was triggered by accident… This is the right version:

KeyLabMkIILEDsV4.1a.gig (503.0 KB)

3 Likes