Recherche Google
ModalysControllers > Scale Controller
page précédentepage suivante

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))

One common use is scaling the speed of an access so it can be used as an input force for another object, such as this one which scales speed values by a factor of 50:

(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)

Additionally, MIDI controllers always output values between 0 and 127, so we generally need to use a scale controller to apply those values meaningfully in Modalys. For example, if we wanted to use pitch bend to control the frequency of a sine wave (controller) between 220Hz and 440Hz, we could do the following:

(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))

Options

There are no special options for this controller.

page précédentepage suivante
A propos...©IRCAM 2014Réalisé avec Scenari