I wasn’t sure whether to post this here or on the Nyquist board.
I would like to propose a small new feature for Nyquist plug-ins; two new numeric text widgets, one for integer values and one for floats.
These differ from the current “real” and “int” widgets only in that they do not have sliders. and the default text box size is a little larger.
In appearance they are exactly like the string input widget, but the user input is validated to allow only numbers, and in the case of the float version, the decimal separator appropriate to the locale.
The syntax is the same as for other widgets.
Ideally I would have liked to have called these “int” and “float”, but those names are already take, so I suggest “int-text” and “float-text”
This is the syntax:
;control variable-name “text-left” variable-type “text-right” initial-value minimum maximum
where “variable-type” is either “int-text” or “float-text” (without quotes).
As with other widgets, the “text-right” is optional (it may be an empty string). There is an old bug that text-right is not read by screen readers, I don’t know if that is still true in Audacity 2,1,2 alpha.
Example:
;control int "int-text" int-text "label" 10 -1 1000000000
;control float "float-text" float-text "label" 10 -1 1000000000
The user supplied number is validated to ensure that it is within the min / max range, but the default error message from Audacity is not very meaningful, so in most cases I think it better to set min and max well beyond the “sensible” range, and validate to the actual usable range within the Nyquist code. For example, if setting a frequency for a filter, the min and max for the widget could be set as above to -1 to 1000000000, and then validate within the Nyquist code for values between 0 Hz and half the sample rate.
Benefits of the new widgets,
-
Where a very large range is required, slider controls do not work very well because the limited number of “ticks” for the slider scale makes setting precise values impossible.
-
Sliders can be confusing for blind users because (I believe) they are always read with a scale of 0 to 100, regardless of the actual scale.
-
For non-mouse users, sliders are just “in the way”. Typing a number is usually much easier than scrolling the slider with cursor keys, so the slider is just one more thing to tab over.
-
Where the upper range is uncertain (for example when setting the frequency of a filter that is dependent on sample rate), a slider is misleading because users are likely to assume that the slider range is the valid range. So either the range of the control must be limited to the smallest likely maximum, or the top end of the range is invalid.
-
Only valid numbers may be typed (so better than the string widget when numeric data is required).
This screenshot show all available widgets. The two new ones are at the bottom:
This screenshot shows the Nyquist Notch filter with the new widgets: