How can I specify a lag time to a control in its metadata?
A ControlSpec only specifies the range/curve/step size/label of a control’s corresponding GUI element. If you want to specify a lag time, you have to do that on the SynthDef level. SynthDef.new has a rates argument which expects an array of rate specifications:
(
SynthDef(\ratesTest, { |out, freq=440|
Out.ar(out, SinOsc.ar(freq) * Env.perc.ar(2));
}, rates: [0, 4] // lag freq (second arg) by 4 seconds
).add;
)
If you use NamedControls in your SynthDefs, you can set a lag time directly upon instantiation (it’s the second argument, after the default value):
(
SynthDef(\ratesTest, { |out|
Out.ar(out, SinOsc.ar(\freq.kr(440, 4)) * Env.perc.ar(2));
}).add;
)
Or just use one of the simple UGen wrapper methods directly in the UGen graph function: .lag, .lag2, .lag3, .lagud, lag2ud, lag3ud, .varlag.
- How can I specify a lag time to a control in its metadata?
- Is there a way to temporarily engage a “fine” control when interacting with a slider, to achieve a higher resolution?
I can’t think of an easy way to do this without modifying .makeGui’s implementation - it would have to be rewritten using layout management classes (HLayout/VLayout) to enable stretching the sliders to arbitrary widths, and I don’t know any slider class with a fine control feature. I agree this would be great to have, though!
Edit: Forgot to mention, you can do relatively fine adjustments by selecting a slider and pressing up/down arrow (or left/right, does the same thing) - this increments or decrements the slider value by the amount specified by the Slider’s step instance variable. Pressing “r” randomizes the slider value. See here.