Skip to content

Dimension-Mapping Controller

Description

Create a (one- or multi-dimensional) controller by mapping dimensions to it from the dimensions of other controller(s)

(make-controller 'dimension-mapping ... )

Lisp Syntax and Default Values

The 'dimension-mapping controller can be created using the following Lisp syntax:

(make-controller 'dimension-mapping dimension 
         (list    (list controller1 index1 dim11 dim12 ...)
                  (list controller2 index2 dim21 dim22 ...)
                  ... ))

Parameters

The 'dimension-mapping controller takes the following arguments:

  • dimension: number of dimensions of the output controller.
  • controllerN: input controller N.
  • indexI: index I on input controller N.
  • dimIJ: series of dimension(s) J on which controllerN[indexI] will be mapped.

This function takes a list of mapping lists lists as its final argument. The number of mapping lists lists depends on the number of output (and input) controllers.

Discussion

The dimension-mapping controller accepts a list of dimension mapping lists, each of them containing an input controller (of arbitrary dimension), a dimension index on the input controller and a set of mapped output dimensions. The indexed entry of the input controller will be then assigned to each of the specified dimensions of the dimension-mapping controller.

The following is a practical example that uses the dimension-mapping controller to map the 2 channels of a stereo sound file into two separate Modalys controllers:

(setq sf-ctl (make-controller 'sound-file 2 0 (const 44100) "my-sf.aiff" 0 my-sf-length 30 ))
(setq ch1-ctl (make-controller 'dimension-mapping 1 (list (list sf-ctl 0 0))))
(setq ch2-ctl (make-controller 'dimension-mapping 1 (list (list sf-ctl 1 0))))
Or we could take the input sound file controller and swap the left and right channels:

(setq sf-ctl (make-controller 'sound-file 2 0 (const 44100) "my-sf.aiff" 0 my-sf-length 30 ))
(setq swap-ctl (make-controller 'dimension-mapping 2
         (list    (list sf-ctl 0 1)
                  (list sf-ctl 1 0))))
We could also similarly use it to map two mono sound files controllers to the dimensions of a 2-dimensional controller:

(setq sf-ctl1 (make-controller 'sound-file 1 0 (const 44100) "my-sf1.aiff" 0 my-sf-length 30 ))
(setq sf-ctl2 (make-controller 'sound-file 1 0 (const 44100) "my-sf2.aiff" 0 my-sf-length 30 ))
(setq 2d-ctl (make-controller 'dimension-mapping 2
         (list    (list sf-ctl1 0 0)
                  (list sf-ctl2 0 1))))
An input controller can also be mapped to multiple dimensions of the output controller, such as in this example which mapsa mono sound file controller to all 4 dimensions of a 4-dimensional controller:

(setq sf-ctl (make-controller 'sound-file 1 0 (const 44100) "my-sf.aiff" 0 my-sf-length 30 ))
(setq 4d-ctl (make-controller 'dimension-mapping 4 (list (list sf-ctl 0 0 1 2 3))))
Naturally, this last example could have be achieved more efficiently using the spread controller, but it helps show how the dimension-mapping controller can be a versatile and handy function for mixing and matching data from different controllers.