🔥 Lifetime deal! Get Control Surface Studio for Just £67 👉 Click Here To Get It
Time left... mailtimers.com
⚠️ Lifetime licenses are ending soon, get yours before they're gone ⚠️
Your shopping cart is empty.

Interpreting Relative Encoders

Submitted by Image_Engine on Tue, 09/01/2020 - 03:42
Control Surface Studio User

I have an issue whereby the definition of an encoder in the surface script is quite simple
Type = Relative
Left = 1
Right = 127
Steps = 127

That was fine while I was prototyping and you move an encoder slowly. When using encoders with acceleration, the Left value can range between eg 1,2,3,4 and the right 127, 126, 125, 124

What is the correct way to manage this as the actions seem to be ignored when I turn the encoder quickly? What is the controller filter actually doing when it comes to relative encoders?


Topic Category: 

23 Responses


Control Surface Studio User

if I understood your doubt:

that hapens beacuse it takes 127 steps to make a action. try drecreassing the step value, like this

Left = 127
Right = 1
Steps = 1

check which value is being sent with a midi signal monitor.

https://www.midimonitor.com/ (Chrome Only)

Control Surface Studio User

In relative encoders works like this:

when the knob is rotated to the left, the midi value sent is 127
when the knob is rotated to the right, the midi value sent is 1

Control Surface Studio User

Hmm, not sure you understood my post;
Everything works great
1 = left, 1`27 = right with 127 steps...until I apply acceleration in firmware which now modifies the relative compliment to apply faster movement to the interpreting software
ie slow = 1, slightly faster = 2, fast = 3, really fast =4 and so on
If you modify the steps in CSS, then the resolution is lost.
The way its meant to work is that eg a value of 4 send by the firmware is interpreted in Live as a 'faster' rotation by reducing the resolution.
CSS seems to be using a rigid interpretation and now allowing acclerative relative values.
I just dont want to be using reactions everywhere for simple stuff when relative acceleration is common standard.
Thanks for your reply

Robert Büttner
Control Surface Studio User

I have the same problem.
I really want to use the relative behavior of my x-touch mini.
It has acceleration as described by Image_Engine and therefor only registers really slow movements.
When i turn the encoder faster it sends values either higher then 1 or lower then 127 and CSS is not picking them up.

Is there a way to make it work?

I just bought the app and really love it so far,.
It would be a bummer if i could not use it for my setup as it is so quick and easy :-)

Robert Büttner
Control Surface Studio User

i tried to do a little patch in max, that would transform midicontrol messages that have a value of 2 in two messages with a value of 1... and so on. I think this should work.
But i do not find a way to route the midi through max to live and into the script.

I tried virtual midi cable and even though they are not red in live, somehow it is not working...

Anyone knows why?

Control Surface Studio User

Hi Robert
Firstly...adding max makes it far to complicated...I used m4l for quite a while and Im not joking when I say that whilst native is harder...what you are doing is making it way too complicated. If you already understand max, then the key is creating a behaviour in CSS and using the values to create a pass through. I ended up just changing the hardware to send the same value based on acceleration ie val 1 but repeating the faster you turn...but not everyone has access the the firmware engineers; I ended up working it after the firmware update but the issue becomes the controller. which is the issue. CSS must allow a relative controller to not just respond to eg 1 and 127 but respond to the RANGE 1-63 and 64-127; if you look into the remotes scripts ie STC single track control, it tells you how the absolute/relative is handled and can help understand but all of that management is now available in Ableton framework. HTH in some way...KEY IS Controller Script Fix! imho

Robert Büttner
Control Surface Studio User

Hey Image_Engine,

thanks for your answer.
As it seems there is no internal option in CSS to use accelerated relative messages and i have no way to change the firmware of my controller the only way i see ist to put something (eg max) in between the controller and the script that transforms the messages in something the script can handle.

The patch that i did in max, does exactly what you did in the firmware. sending more and faster 1-values instead of 2-63 values..

Maybe John will say something here if this is a change we might see in the future.

Bye and thanks again for the answer

Control Surface Studio User

I guess if max gets you by for now...all good.
Im hoping it will get addressed...as mentioned I know its all now managed nicely in framework but I realise John has tons of work with CSS at the moment.
Actually, I wonder if the controller was actually set as an absolute cc in the controller script and then the behaviour could just scan the val but pass the status as a relative cc? Im at work atm so cant look at it but perhaps there is a kludge to do it?

Robert Büttner
Control Surface Studio User

I just realized that the web-app has relative controlling behaviour the way it should be.
There are 3 different standards: "two compliement", Signed bit" and "binary offset"
They all have acceleration just in different ways.

two compliement works great with one of the relative behaviours my controller offers.

But in CSS this is not possible.
To me it looks like the devs wanted the relative behaviour in CSS to be editable and the feature became a bug...

The problem is that the Web-App is not able to do what i need.
And i just payd 80 bucks for the premium version... :-(

please can you change the relative behaviour to the beheaviour in the web app, or add the 3 standarts that you can choose from in the web app to CSS!

Forum Admin

Hi Robert,

With CSS we dropped using the Web App / framework style of encoder/relative control as there were a number of issues with it. One of the main ones being that it wasn't possible to add multiple mappings to a single controller input using that method. So we went for our own custom solution which also allowed for more editable options (as you mentioned).

I thought it would be possible to use the web app control via a Reaction but after having a dig around it can't quite do it at the moment. But! we are working on a huge update to the Reactions ecosystem and I'm pretty sure you'll be able to add web app/framework controls using it.

One thing I need to ask is, what functionality/mappings are you looking to control with your relative controls?

Robert Büttner
Control Surface Studio User

Hey John,

thanks a lot for the answer!
I am looking forward to the update, i also fiddled around a bit with the reactions but could not make it work.

I created a simple script for my Behringer x-touch mini:

I can scroll through the highlighted tracks
On the active track i can choose a device, mute the devices, choose banks and change parameters of the active device.

i realized when i add feedback to the encoders from live for quiet some parameters it would messy... I think it happens when the resolution of the live parameter is different then the 128 steps of the encoder and then the feedback would be different then the just set step.

This problem was solved wen i tried to use relative control instead of absolute.
Another possibility would be to send the feedback just to the LEDs instead of the encoder.
This is possible with the X-Touch mini but the resolution of this control is 14 (i would have to be able to set a separate min and max for the feedback) and it happens on the global midi channel that cant be addressed trough CSS.

If there is a better way to do this, and i just did not realize, i am happy to hear.

Beside this problems and some Limitations, i really love the program and i think the idea behind it is genius :)

Best Robert

Forum Admin

Maybe you could try doing feedback via Reactions?
here's a blog post on sending led feedback to your controller using reactions: https://remotify.io/tutorials/sending-custom-led-feedback-your-midi-cont...

Christian Björklund
Control Surface Studio User

So.. is accelerated encoders supported some clever way now and if so is there a guide somewhere? Also trying to make use of my the x-touch mini here.

I mean, I think I know enough now to set up a reaction that interprets them but it would use one reaction and one modifier per encoder... and I probably will spend days before it obeys properly too. =)

Christian Björklund
Control Surface Studio User

Ok, so because I'm an idiot - I did it, it works and it does exactly what I wanted but it was tedious, 100% reactions, 32 of them! =) So yeah, would be very useful if the Endless encoders in the templates handled acceleration instead of doing it with Reactions and modifiers, at least the way I did it, maybe there are smarter ways.

If anyone wants a script for the x-touch mini that controls eight parameters on the first device on any selected track (like the Mackie Control script but without any button pushing), I'm putting it here! With acceleration, LED ring feedback, push to reset to default and all.


The unit needs to be in MC mode, and oh I found this online, how to control the LED rings. I'm using the TRIM mode in this version but it's easy to change.


CC 48-55


0 = OFF
1-11 = SINGLE
17-27 = TRIM (22 in the middle)
33-43 = FAN
49-54 = SPREAD


Ismael Gómez
Control Surface Studio User

For encoders with acceleration you can create various script mappings for each encoder, for example: you want to use one encoder to control volume, so first you create a track volume mapping on your script with the default value (Left=1, Right=127), then you duplicate this volume mapping and set the control override to custom, and you set values: Left=2, Right=126 for the same encoder. Then you duplicate and add values of Left=3, Right=125 for same encoder, etc. Also you can change the step on each mapping so it can handle the acceleration function.

Golden Frog
Control Surface Studio User

For reference on how to use relative encoders with acceleration, I’m attaching a code snippet below that you can copy and paste in your action block. You only need one Reaction to each encoder you use and the code do the work for acceleration. The code takes into consideration the following:

- It’s for one encoder controlling one device parameter, on the selected track and selected device. It works with tracks, return tracks, tracks folded under groups, master track and macros, as long as the device is selected.
- There are two code files: one for Signed Bit relative format (right moves from 1 to 8 and left from 65 to 72) and one for Two’s complement (right moves from 1 to 8 and left from 127 to 120).
- The resolution it’s adjusted depending of the type of device parameter: regular parameter that go 0.0 to 1.0, quantized parameter that have items to choose from like types of filter, distortion, quantization, etc., and macro parameters that go from 0 to 127.
- It does nothing and avoid sending errors to the log file if the parameter is not enabled (like if its already mapped to a macro) or if the number of the parameter to move is superior to the total of parameters the device has (like trying moving parameter 7 but the device only has 6 available to move).

Before continuing, let’s explain the differences of types of encoders. There are many but the most used are Signed Bit and Two’s Complement, and I uploaded the code file for each one:

Signed Bit encoders send values from 1 to 8 if moved right, and 65 to 72 if moved left.
Two’s complement encoders send values from 1 to 8 moved right, and from 127 down to 120 if moved left.

Here it is how to use the code:

First set your encoder in your Controller Template. I’m using Signed Bit, CC 21 as an example:

MIDI type = CC
MIDI Channel = 1
MIDI Value = 21

Type = Relative
Left = 65 (for Two’s complement, set it to 127)
Right = 1
Steps = 127

Now in your Script, create a Reaction with only one Listener to your encoder moved and one action block. In the action block > action box, copy and paste the entire code depending if it’s Signed Bit or Two’s Complement (check your encoder). The code has 5 parts delimited by comments under “”” “””. You only need to change the following:

Under “”” Set parameter number and settings “””
x = to the parameter number you want you control with your encoder from 1 and up.

encoder = change the number ch_0 to the midi channel (0 is channel 1) of your encoder and also change val_21 to the CC number of your encoder (mine is CC 21). Example, setting it to self.midi_cc_ch_1_val_30.cur_val changes the midi channel to 2 and CC 30.

And that's it.

Create another reaction for each of your encoders and repeat the process with its corresponding parameter and CC numbers.

Control Surface Studio User

WHere is the native CSS handling of encoders up to atm?

Control Surface Studio User


Control Surface Studio User

Golden Frog your script works, and I think it's the answer to my problems. Unfortunately I am now stuck trying to figure out how to make that reaction work on specific tracks/devices instead of just the first one selected. Any advice?

António Malheiro
Control Surface Studio User

Golden Frog, you're a legend my man!

António Malheiro
Control Surface Studio User

Sike! bbedar yeah same here now.

António Malheiro
Control Surface Studio User

I'm so sad I can't get this script to work anymore :c.

António Malheiro
Control Surface Studio User

Got it working. Referenced wrongly the CC.