Hi All,
Anyone have a good way of converting a "standard" encoder (sending out 0-127) into an endless encoder? Is there a way to detect if the numbers are ascending or descending (tried "edge", etc. with no luck).
Thanks!
Converting 0-127 CC Knob Into "Endless" Encoder
Hi All,
Anyone have a good way of converting a "standard" encoder (sending out 0-127) into an endless encoder? Is there a way to detect if the numbers are ascending or descending (tried "edge", etc. with no luck).
Thanks!
Well, sort of.
You can use the 'greater than" operator in combination with a route object to do a basic absolute-to-binary conversion, like so:
You may want to add a line object in there to smooth things out in case of value jumps from the encoder or you'll start to lose range -- but that brings us to the second problem. That is, how much range do you need for your "endless" value? If you only need 128 steps, you're all set. If you need more than that (or less) you need to do a bit more work.
If the 0-127 encoder wraps back to 0 after you exceed 127 and back to 127 when you go below zero, that would be one problem. However, most I have seen have a "stop" at the max or min value no matter how far you turn them. You might try adding a second route object in that case:
Anyway that's a start...
@davysumner The number box is an endless encoder, although not very pretty.
Use number2 if you want to save the value with your patch.
David.
@davysumner This converts an incoming stream of numbers modulo 128 into an endless stream, so it is kind of an invert function for mod 128. It even works if the incoming stream is skipping numbers, maybe when you twist the knob very fast. Only if the jump between values is more than 63 it will lead to erroneous results: endless.zip
Whew... that's a tricky one that I myself have attempted before. There are a few ways to potentially do this, but it depends on some things... Like nodsp said, the range is an important factor as well as the behavior of how it handles jumping between maximum and minimum values... and also the knob that is being used along with how the device handles sending the values received for that knob. If it spins endlessly, but stops sending values after after the knob turns past the minimum or maximum, thats a problem. If the knob reaches the min or max, and continues to send the min or max value each time the knob is turned past the value, then i'd do an endless encoder like this... endless-encoder.pd
To make a range constraint, just throw a modulo ( [%] ) object at the output, or something like [cyclone/wrap]
If the device being input does not send values once the knob goes past the limit, it becomes a bit more complicated. Youd have to take the expr object and set it so that when it receives a 0, it outputs 1 and if it receives a 127, it outputs 126, then route that back into the device to set the value so that you will get an output from the device on the next turn of the knob. does that make sense?
Oops! Looks like something went wrong!