faustideas
faustideas copied to clipboard
Add idea for improving scale metadata with new scaleslider primitive
Add idea for improving scale metadata with a new clipslider
Could this be built on top of the new widget modulation model ?
import("stdfaust.lib");
myfilter = fi.lowpass(1, cutoff)
with {
FREQ_MIN = 8;
FREQ_MAX = 20050;
cutoff = hslider("cutoff", FREQ_MIN, FREQ_MIN, FREQ_MAX, .01) : aa.clip(FREQ_MIN, FREQ_MAX);
};
modulation = button("gate") : si.smoo : it.interpolate_linear(_, 0, 10000);
process = modulation, _ : ["cutoff":+ -> myfilter] <: _, _;
That's about as close as I can get with the existing modulation feature.
- The clipping aspect works, but I had to write the
aa.clipcode myself. It would be easier if this were assumed somehow. - The GUI shows the right units, but the scale is still linear.
- The incoming modulation is an un-normalized range (0 to 10000). It should really just be between -1 and 1.
Here's another version:
import("stdfaust.lib");
// scale takes something in [0,1] and remaps to whatever you want.
// Here we have scale(0)==freqMin and scale(1)==freqMax
scale(x) = it.interpolate_linear(x, log(freqMin), log(freqMax)) : exp
with {
freqMin = 8;
freqMax = 20050;
};
// NO GUI
myfilter(_cutoff) = fi.lowpass(1, cutoff)
with {
cutoff = _cutoff : aa.clip(0, 1) : scale;
};
myfilter_ui = myfilter(cutoff)
with {
// this is not in Hertz!
cutoff = hslider("cutoff", .05, 0, 1, .01);
};
modulation = button("gate") : si.smoo : it.interpolate_linear(_, 0, 0.7);
process = modulation, _ : ["cutoff":+ -> myfilter_ui] <: _, _;
That one's modulation works well because everything is normalized between 0 and 1. Additionally, the custom scale function works as intended. The problem is that what the GUI shows is just [0-1], not [freqMin, freqMax].
This looks great, thanks @DBraun ! What is needed to move it forward?