Arturia Keylab MK2 Custom Midi Remote Script ( MKII )

Ach yeah you’re right of course. I was confused because I saw indices higher than 23 in the log. I forgot to put parenthese around the integer formula printed in the console.log string and JS does not like that…

OK. Now I’m going to look at problem #2… Still happens 9 times out of 10.

I added arg2=Math.ceil(arg2)
in the surfaceElements.padsCustom0[padCustomIndex].mOnProcessValueChange=(function(activeDevice,arg1,arg2)
function and this seems to fix the problem.

Hi Minas
I also found a small offset error in Helper_updateBeats function.
When you reset (switch off) the pads you use:

        var prevBeat=parseInt(prevBeatString)

It should be:

        var prevBeat=parseInt(prevBeatString)

Right ?

Hi, yes, this was fixed in the version I have here. It’s minor but can bring up the wrong value when swapping from user/al to daw mode.

Arg2 is just the diff of pads velocity, and I can’t remember right now if the pads in ableton mode really send pressure or just binaries. I recall using it for performing some actions upon the pads’ release. Other than that, I don’t see how this would fix going to mixer page, except if you mean to just light up the pad, without really changing the page. I’m sure that changing to mixer page is resolved in my current script, but I’m nowhere near my PC to test it and send feedback, sorry.

I never said it didn’t go to the mixer page. I said that (most of the time) I needed to tap twice on the Mixer Pad to light it on. The problem does not seem to arise the first time I switch back to Mixer page (in other words, it works once), but after that, every time I’m in -say- Commands page, I need to tap twice the Pad1 to see it lit on again. And this does not happen with other pads.
And as I said, the workaround I found seems to fix the problem.

No worries, of course you didn’t, I was the one who noticed it in an earlier version of the script and corrected it. But I don’t remember if the correction is in the script currently shared.

Hi Minas
I tried to use the recommended function

        setTimeout(() => {
            console.log("Hello World") or whatever
        }, delay);

but it generates an “empty expression not allowed error”…
I suppose this the reason why you use soft delays in your code ?

ES5 doesn’t support this, so yes I had to invent one.

@m.c is this the latest version? the script works quite well, I just have one question for some reason [ALT - PAD 3] bottom row is not following the loop markers start and end. with [fn - PAD 4] I can set them, but can not go to the start or end with ALT << and >>. I am using cubase 1 3 pro latest version with MKEYLAB 49 MKII. (macbook pro m3)

Thanks for a great script…

Hi, if I remember correctly, PAD3 (Alt) held with any of the 3x3 matrix of pads (starting from top-left corner) is for setting up a cycle marker. Then with PAD4 (FN) held and the same matrix, we recall any of the 1-9 cycle markers.

I don’t think there are dedicated commands for navigating through the cycle markers, if there existed we could surely alter the script and have for e.g. FN+Previous/Next buttons assigned to it. Let me know if you have seen this type of navigation. The closest I can think of is using the Navigate Left/Right commands but this involves having the markers track selected obviously. But at least this can be done for sure.

EDIT: Perhaps I totally missed your point. You’re talking about the Rewind/Forward buttons? If so, indeed FN+these buttons is used for setting left/right locators. ALT+ is used for locating the selection’s Start/End. If you want it to go to left/right locators we have to alter a but the script. Let me know if this what you’re after (makes perfect sense by the way).

Correct I was looking for a way to go to the start of the cycle marker and the end using [ALT] + [<<] left marker [ALT] + [>>] Right marker. Is that the intended function ?

1 Like

Hi @MusicalExperiments

To achieve this you just have to modify the file /Users/YourUserName/Documents/Steinberg/Cubase/MIDI Remote/Driver Scripts/Local/Arturia/Keylab_MK2_MC_Custom/mapOfTransportSectionCommands.js
Just replace the existing code (using any simple text editor):

    var rewindBindings=[
        ["Transport","Locate Previous Marker","Prev Marker"],//shift+rewind
        ["Transport","Return to Zero","GoTo Start"],//ctrl+rewind
        ['Transport', 'Locate Selection',"Loc Sel Start"],//alt+rewind
        ["Transport","Set Left Locator","Set Left Loc"]//fn+rewind


    var forwardBindings=[
        ["Transport","Locate Next Marker","Next Marker"],
        ['Transport', 'Goto End',"GoTo End"],
        ['Transport', 'Locate Selection End',"Loc Sel End"],
        ["Transport","Set Right Locator","Set Right Loc"]


    var rewindBindings=[
        ["Transport","Locate Previous Marker","Prev Marker"],//shift+rewind
        ["Transport","Return to Zero","GoTo Start"],//ctrl+rewind
        ["Transport","To Left Locator","To Left Loc"],//alt+rewind
        ["Transport","Set Left Locator","Set Left Loc"]//fn+rewind


    var forwardBindings=[
        ["Transport","Locate Next Marker","Next Marker"],
        ["Transport","Goto End","GoTo End"],
        ["Transport","To Right Locator","To Right Loc"],
        ["Transport","Set Right Locator","Set Right Loc"]

Reload the script and that should do what you want…


And this is the reason my friend, I started a complete rewrite of the script, make it much easier for the users to alter everything using the UI of the remote, thus leaving script changes for the more experienced users and cases where scripting is really unavoidable. Done it with the Novation SL MK3 partially, by providing empty pages for direct binding using clicks, my aim is to make it to a full extent on the Keylab.

1 Like

Sounds great Minas !
In the meantime I thought I could provide an (easy) solution to this user until you come up with the appropriate solution (as you sounded pretty busy…) :slightly_smiling_face:

Contributions are always and most welcomed! Even more currently since I do face issues out of the context of this thread, and being at the same time busy with open projects totally irrelevant with the music industry. Thank you!

ok done! that’s great! This is exactly what I was looking for. I don’t use marker tracks all that often, this is far more useful for me. Also, can I use the [FN] modifier with the Jog wheel and move the cycle forward and backwards once it’s set.
Example, let’s say I set the cycle marker for four bars, now I would like to move it to next four bars, sliding it forward/backwards.

By the way, this script is incredibly helpful.

Hi, the FN+Jog is currently assigned to preset previous/next when in the stripped-down version, and to plugin previous/next when in the full version (the one that uses virtual MIDI ports). If you have the stripped-down version, the modification is relatively a bit easier:

Open the core script file (Arturia_Keylab_MK2_MC_Custom.js) then search for these lines:

page.makeCommandBinding(surfaceElements.mapCustomVars.presetPrevious,‘Preset’, ‘Previous’)

page.makeCommandBinding(surfaceElements.mapCustomVars.presetNext,‘Preset’, ‘Next’)

You have to turn them to:

page.makeCommandBinding(surfaceElements.mapCustomVars.presetPrevious,‘Nudge’, ‘Loop Range Left’)

page.makeCommandBinding(surfaceElements.mapCustomVars.presetNext,‘Nudge’, ‘Loop Range Right’)

Now, if you want also the label connected to this action in the UI changed, you have to find this line:

page.setLabelFieldText(surfaceElements.labels[“jog”][4],“Preset P/N”)

and set it to something better describing the action, for example:

page.setLabelFieldText(surfaceElements.labels[“jog”][4],“Loop L/R”)

Thanks you so much!
got a syntax error at 1st then realized it just needed ["] instead of ['] …

so is the .js file created by Arturia_KeyLab MK2 MC Custom.midiremote?
what type of file is Arturia_KeyLab MK2 MC Custom.midiremote?

how does one create that?

You can use either ’ or “, it should not make a difference. However they should be balanced. For instance you can use ‘Loop Range Left’ or “Loop Range Left” but not 'Loop Range Left”…
As for the midiremote file, once the scripts are loaded with your cubase project, you can use the Studio/Midi Remote Manager: select the current script (Arturia_Keylab_MKII_MC_Custom) and enable it if not already done. There should be an export command at the bottom of the window. Just use that to create a .midiremote file that you can store anywhere.

1 Like

This is because the text parser of the forum replaces the single quotes with quotation marks. I should have placed the code inside preformatted text blocks, my bad, sorry.

1 Like