Endless Knob
V3 2024-03-11 —added turns ratio input for sped up or vernier behavior.
Issues from output “k” continuous values, increasing or decreasing by 1 each time around. As for regular knob nodes, clockwise rotation is a positive change. Unlike regular knob nodes, these are adjusted by rotation about their centers. Small changes can be made by dragging the knob anywhere along or near its edge.
The value of k and the knob position are optionally saved and will be restored at next startup. A sample/hold node allows this memory. To make the memory feature easily optional, two S/H nodes are used, one with save turned on and one off, so that you can set the option without plowing through the guts of the module.
This knob can be truly “endless” or it can be set to work over a limited range by applying a 1 at “Limits,” using the values at Lim1 and Lim2, making the higher of the two the upper limit, etc. (Don’t forget that an open input is interpreted as one of the limits)
In addition to the k output, the “∂k” output provides the stream of distance samples and the “Adj” issues a 1 while the knob is being touched.
Reset the knob to the value at input “Reset Val” by taking the “Reset” input high.
Set the home position (pointer position when output is zero) by applying a value to input “Home Pos.”
This module is not yet assignable, as I don’t have a continuous controller knob at this point for testing.
This knob also lacks any direct-wire connectivity that knob nodes currently feature. You gotta crank on this one!
Operation: This module uses point-to-point wiring, which proved far more CPU cycle friendly than DSP node, but the operation is similar.
1: waiting: Capture and verify initial touch, capture initial x and y and make sure it’s close enough to the knob. Compute first angle using arc-tangent (atan2) function.
To allow closer positioning to adjacent knobs such that their xy touchpads overlap somewhat, a touch is accepted only if it’s close to the knob. This is calculated by comparing the knob-center-to-touch distance with sum of knob radius, “kradius,” and an arbitrary finger width which is intended to allow adjustment of values by flicking at or near the edge of the knob. To keep the active region circular for large knobs, the valid touch radius can not grow larger than half the width of the Canvas node (and matching touch pad.)
2: collecting - if still touching, collect subsequent x and y, compute new angle via atan2 function, find the difference between samples, then compute tangent on the difference, which represents how far you’ve moved along the unit circle (analogous to the derivative.) Add this distance to the previous knob position (analogous to integration). If not still touching, go back to a “waiting” state.
“Reset” high will in both operating states set the output to the value applied to the “Reset Val” input and set the state machine to “waiting.” Note that it’s possible to reset to a value outside of the limits (if the knob has limits set, of course). This won’t break it, but with any subsequent adjustment the output will pop to one of the limits.
I/O
Input | Signal Range | Notes |
---|---|---|
kRadius | 10-40 | Knob radius (upper value limited by xy touch pad size. Defaults to standard knob radius. |
Reset | 0/1 | Held high, resets knob output to “Reset Value,” below. |
Reset Value | +/- any value | |
Home Pos | +/- any value | the fractional part sets position where k = 0 |
Save@close | 0/1 | If 1, saves knob position and value at close |
Turns Ratio | 0 to any value. | Positive 1 gives visible rotation that matches the angle input. Negative values reverse the knob and output summing. |
Limits | 0/1 | If 1, applies limits at Lim1 and Lim2 |
lim1/2 | +/- any value | Used as lower and upper limits. Order is not important for these inputs; the lower of the two is used as the lower limit. |
Output | Signal Range | Notes |
---|---|---|
k | +/- any value | knob output, in revolutions, one rev per turn |
∂k | +/- small values | angular velocity stream, revolutions/sample. |
Adj | 0/1 | 1 when the knob is being adjusted. |
Version History
Revision | File
V3-1
Endless Knob v3-1.audulus4 (16.9 KB)
V2-8
Endless Knob v2-8.audulus4 (16.5 KB)
2| Original, DSP node-based. Original features, no save.
1 | Endless Knob 2024-02-06-01.audulus4 (8.3 KB) | 2/6/2024
Demo
Endless Knob v3-1 Demos.audulus4 (42.2 KB)