Knob with step is waaaaaay too sensitive

I would like to use a knob to represent a control with a small discrete set of values, for example, the choice of an LFO’s waveform.

Using the step property of Knob I can restrict the knob so that it only ‘visits’ six positions. However, when I do this, the amount I need to move my mouse to go between the min and max values becomes so small that the knob becomes difficult to use.

Contrast the knob in the code below when the line k.step = 1/6; is commented or uncommented:

var window, midispec;
window ="step Knob", Rect(640,630,270,120)).front;
k =, Rect(20,10,100,100));
k.action_({|v,x,y,m| v.value.postln; });
k.mode = \vert;
//k.step = 1/6;

When the default step size is used, you get about the height of the knob itself to move between min and max. When step is set to 1/6, you only get a tiny vertical range.

Can anyone think of a way around this?

AFAICS from the help, step controls input (mouse) behavior directly, and output (value) behavior only indirectly.

The usual methodology for SC GUI objects is to accept the normalized, continuous value in the action function, and use the action function to convert to the range you want, including step quantization, e.g. value.round(0.2) would quantize to 0, 0.2, 0.4, 0.6, 0.8, 1.0 (6 steps), or min(value, 0.99999).trunc(1/6) to 0, 1/6, 2/6 … 5/6. Then you wouldn’t need .step at all.

Alternately, ControlSpec has a step size for the output range.

It might work for the action function to set the knob’s value, to show the steps visually.


Tested… alas, this works for Sliders but not Knobs (because, I think, Knob interaction is incremental while Slider’s is based on absolute position).