TEK2 encoder push&rotate

Hello, i’m a compleet noob with LUA and for that, I’m having a hard time understanding the GridEditor. Nonetheless, i’m willing to dig into it.

I have the default TEK2 profile installed and I’m able to change some parameters to my liking. I have the encoders working, controlling my DAW faders.

I really would like to have the PushRotate function enabled so I can use the two encoders control 4 faders in my DAW (AUM for ios). I watched a video on how to install the Push & Rotate action block on Intech’s youtube site but that only concerns the potmeters on the EF44. The action block is not available in my TEK2 / GridEdit configurator. Can someone help me on track with this?

Are you wanting it so that, when you push and hold the jog wheel then turn it, it adjusts a different AUM parameter:

Regular turn adjusts parameter 1 (i.e. fader 1)
Push and turn adjusts parameter 2 (i.e. fader 2)

Alternatively, are you want to press the jog wheel to toggle between two values to send:

Regular turn adjusts value 1(i.e. fader 1)
Push encoder to toggle to parameter 2 (i.e. fader 2)
Regular turn adjust parameter 2 (i.e. fader 2)
Push encoder to toggle to parameter 1
Regular turn adjust value 1 etc.

I think suggestion 2 is a better one. Push to toggle between two parameters would be ideal. Push while turn is a bit awkward.

1 Like

I’m just getting ready for work here so I can provide examples. I also don’t own a TEK2 so I can only load a virtual module. However, this is fairly easy to do with a regular encoder so it should be doable with the jiog wheel.

For an encoder, you need to set the button behavior to ‘Toggle’ with an action block in the ‘Init’ tab in Grid. There is likely a similar action block for the jig wheel.

I can go over the rest of the details at some point later today when I’m done work. If not today then, I am pretty open tomorrow. I’m in Canada so our time zones likely differ.

Someone else might provide and answer sooner though now that we understand the behavior you’re looking for.

One thing to check because I don’t have time before work is, does AUM let you set MIDI takeover behavior? If it does not then, TEK2 will need a bit of extra programming to store the current jog wheel value when toggling between the two parameters you want. If you don’t then, you’ll get parameter jumps in AUM.

I have to figure this out. I thank you so much for your input. I’ll let you know the progression.

I put the toggle function in the first tab, which is not ‘Init’ anymore but ‘Setup’. I guess it’s the same but renamed. What I don’t understand is where the distinction between the toggled state and untoggled state is made, for I have only one ‘Endless’ tab.

I see that the distinction in LEDs is made in layer 1 and layer 2. I mean, I can toggle by pushing the encoder and get a different led color. That works just fine. But I don’t know how to get the encoder to output a different midi output after a push. The same midi output while the LEDs are a different color.

I’ve read the manual about this subject, but the same as the online video, The action blocks mentioned in the manual are not available in the TEK2 configurator. So the mentioned Push & Rotate functions are not there. So my guess is that the TEK2 works just a little different then the ‘normal’ encoders found on the EF44. But I can’t seem to find a manual for that.

This could be true.

On an encoder, you could set it to ‘Toggle’ on the ‘Setup’ tab (my bad, I’ve not fired up the Editor in awhile). Then, on the encoder tab, you would use an ‘IF’ statement/block to check the state of the button.

In plain-ish English, it would be something like this:

IF the button value is 0 then, send MIDI CC 1.
ELSEIF the button value is >1, send MIDI CC 2.
END

‘Toggle’ changes the value of the button from 0 to, I believe, 1 (or 127 but it’s anything ‘not 0’). So, every time the jog wheel increments or decrements, it checks the value of the button then sends the appropriate MIDI CC that you need.

However, I don’t have a TEK2 so I can’t speak to how the jog wheel behaves. You could open the MIDI Debug after setting up the jog wheel to send out some basic MIDI CC (if possible), then check if it increments and decrements the values of that CC in the MIDI Debug. If it does then, you should be able to toggle the button value to change what CC you send.

Keep you posted. This helps me a lot. No time now though. Busy hours. But I’ll be back … thanx

I’m coming a long way. I decided i’m gonna work, for the time being anyway, with a push while rotate function. I’ve made a codeblock in the Endless tab with the necessary code’s, so I think, with my no scripting knowledge. But there is one thing. I would like the smoothness of MIDI14. The code I have now has a resolution of MIDI7. Does anyone know how to convert this to MIDI 14 ?

if self:button_state() > 0 then
    midi_send(0, 176, 10, val)
else
    midi_send(13, 176, 12, val)
end

edit :
I tried the following code, which works for one state, but if I try to fill in the “else” statement, I get an error on the code for having to many characters, 408/399. Is there a way to shorten this code and have the same output ?

if self:button_state() > 0 then
    midi_send(0, 176, 10, val // 128)
    midi_send(0, 176, 10 + 32, val % 128)
else
    midi_send(13, 176, 12, val // 128)
    midi_send(13, 176, 12 + 32, val % 128)
end
1 Like

The above is only 196 characters so the other action blocks on that element tab are likely pushing you over. There would certainly be ways to tighten things up though.

You could save your current configuration first. Then, on the ‘Endless’ tab, select all of the action blocks and ‘Convert to code’ Button looks like this […]. That will show you the underlying code generated by the Action Blocks.

There’s a lot of things that could be shortened for sure. I’ve been pressed for time so I’ve not been able to get anything done for you.

My approach would be to create two global variables, done on the ‘System’ element ‘Setup’ tab. In the code block, I would declare 2 variables for each jog wheel (if you intend to use both in the same fashion).

st1, st2, st3, st4 = 0, 0, 0, 0

That will initialize 4 variables that we can save the jog wheel value to when we toggle to the secondary state and back. If you didn’t save the value then, when you bounced to the secondary state, made a change, the went back to the first state, you’d be sending the wrong value.

So, on button click, save the value of the jog wheel to one of the state variables while recalling the value from the other state variable and assigning it to the jog wheel value.

So, something like this on the ‘Button’ element of a jog wheel:

if self:button_state() > 0 and self:button_value() > 0 then
     st1 = self:endless_value()
     self:endless_value(st2)
elseif self:button_state() > 0  and self:button_value() == 0 then
     st2 = self:endless_value()
     self:endless_value(st1)
elseif self:button_state == 0 then
end

You’ll want to make sure that the button type is set to ‘Toggle’ on the ‘Setup’ tab of the jog wheel. This will make it so each button press toggles the button value between 0 and 127.

You could also use the same self:button_value() to determine which MIDI messages to send. The above code for the button makes it so you save the value of the jog wheel so you can recall it when toggling between states. It avoids parameter jumps in whatever you’re controlling.

This is just quick and dirty but that about how I would handle it.

Thanx. Much appreciated. I’ll work on it later this week. But it’s a step further… :+1:

1 Like

It’s not terribly complicated. I just only have access to the virtual module. I can’t test anything to make sure the code works. I can only put code snippets in here.

Play with that code and keep asking questions here. :slight_smile: I’m sure we can get it sorted out as you need. If not by me then, one of the devs or another user might chime in.