Scale Controller
Description
This is a controller which takes a controller as input and scales it from one range to another.
(make-controller 'scale ... )
Lisp Syntax and Default Values
The 'scale controller can be created using the following Lisp syntax:
(make-controller 'scale dimension in_min in_max out_min out_max controller)
Parameters
The 'scale controller takes six arguments:
- dimension: number of dimensions of the input and output controllers.
- in_min: lower range of input controller values.
- in_max: upper range of input controller values.
- out_min: lower range of output controller values.
- out_max: upper range of output controller values.
- controller: controller to be scaled.
The number of dimensions should be the same as that of the input controller.
The minimum and maximum values are provided as fixed values.
The input and output range is not clipped, therefore any out-of-range values will still be appropriately scaled, according to the multiplier derived form the given input and output ranges.
Discussion
Scaling controllers is a necessary and useful tool. The following example shows a break-point envelope controller that is scaled and inverted using the 'scale controller (a graph of the original and scaled envelopes is shown in the image, above):
(setq my-env (make-controller 'envelope 1 '((0 0.0) (0.2 1.0) (0.4 0.7) (1.2 0.7) (2 0))))
(setq my-scale (make-controller 'scale 0 0 1 2 -2 my-env))
(setq speed-ctl (make-controller 'access-speed 1 my-string-out))
(setq scaledspeed-ctl (make-controller 'scale 1 0 1 0 50 speed-ctl))
(make-connection 'force my-plate-acc scaledspeed-ctl)
(setq midi-ctl (make-controller 'midi-file 1 "my-midi-file.mid" 1 (list 'pitchbend)))
(setq scaledmidi-ctl (make-controller 'scale 1 0 127 220 440 midi-ctl))
(setq sine-ctl (make-controller 'sine 1 scaledmidi-ctl))