Scaling Values / Normalization in Quartz Composer, and "Fader Throws" - Tutorial
Problem: One is receiving external, number generating sources into QC that generator ranges or 0~1, but you want that 0~1 range to "scale" to correspond to any arbitrary range.
Maybe you want that top of the range to hit 1000, and the bottom 0. One take might be to simply multiply the incoming values (from OSC, artnet, etc.), by 1000.
However, what if you do not want the starting range to be 0? Furthermore, what if you don't want the actual slope of movement to be linear as a fader (or other controller element) is manipulated? The solution to this dilemma is the Interpolation patch.
When the Interpolation patch is pulled onto the Editor surface, one sees a start value, an end value, tension, various loop settings, and interpolation styles. What isn't so obvious is that by "control+left clicking (one finger clicking)", one can access a menu that allows one to reconfigure the Interpolation patch with a new port; "Patch Time".
The concept of Patch Time is simple. As patch time progresses from 0 to 1, when the Interpolation patch is in Repeat Mode :Loop, every value from the start value, to the end value assigned to the patch is swept through, linearly. One can change this curve by changing the interpolation type. This is especially useful for controlling from various fader based control surfaces, where a Quadratic or other curve may be deemed to be more useful.
In Repeat Mode "Loop", when time passes 1, the value sweep will start over again. If your start value is 0, and your end value 5, scrubbing timebase from 0 to 1 would give you values 0 through 5; likewise, scrubbing between 1 and 2 would do the same (and so on). If this isn't desired, one can shift Repeat Mode to "None".
The best part of this is that, while multiplication easily "scales" a range from 0 to 1, the implementation of the interpolation patch allows one to start with any arbitrary start value, negative or otherwise, in an extremely quick way that avoids extra patches.
An example is available in the Box widget on the sidebar.