High precision Endless Encoders

xanadu's icon

What's the optimal algorithm for high precision endless encoders?

I have some MIDI devices supporting endless encoders. I would like to use these for high precision parameter control.

There are two requirements:
1. High precision support
2. Ability to change the value drastically

After two evenings of experimenting I've come up with the code below. It looks to work well with Arturia SparkLE encoders. It expects a list with CC number and CC value, with the sign bit on the seventh position. It will output the same format, but with accelleration for quick movements.

Max Patch
Copy patch and select New From Clipboard in Max.

My questions are:
- Is this the optimal solution?
- Do you have suggestions for improvement?

Roman Thilenius's icon

you could probably write the whole thing into one expr ... :) but for a start, i would remove the GUI objects and use timer and delay instead of cpuclock. otherwise the following rule applies here: when it works good for you, it is right.