Skip to content

Delay Controller

Description

A controller whose output is that of an input controller delayed in time.

Syntax and Default Values

The 'delay controller can be created using the following Lisp or mlys.lua syntax:

(make-controller 'delay
                  dimension
                  delay
                  input)

In Modalys for Max, this object is named mlys.delay:

[mlys.delay @name MyDelay @delay 0.5]

Connect another controller as input to the first inlet.

The delay parameter can be accessed dynamically through a message to modalys~, ex: {MyDelay@delay 0.3}
💡If a second inlet is given, you can connect another controller to command the delay parameter.

modalys.create_controller{kind="delay",
                          input=<some controller>,
                          delay=0.5}

Parameters

The 'delay controller takes three arguments:

  • dimension: number of dimensions of the input and output controllers (automatic in mlys.lua and Modalys for Max).
  • delay: a controller (or numerical value) expressing the delay time in seconds.
  • input: controller to be delayed.

The number of dimensions should be the same as that of the input controller.

The delay time can be either a constant or dynamic controller, or else be given as a numerical value.

Discussion

The following shows a very simple example of using the delay controller to delay a simple envelope by half a second (as shown in the graph, at the top of this page):

(setq my-env (make-controller 'envelope 1 '((0 0.0) (0.2 1.0) (0.4 0)) ))
(setq my-delay (make-controller 'delay 1 0.5 my-env))
As you can see, this controller allows another controller to be delayed by a given (optionally dynamically variable) delay time. It does not alter that controller, but rather creates a new controller. This can be useful for many operations, such as delaying a force controller used for sympathetic resonance. The following example show precisely that, with a 1/4 second delay applied to the force controller:

(setq speed-ctl (make-controller 'access-speed 1 my-string-plk))
(setq delay-ctl (make-controller 'delay 1 (const 0.25) speed-ctl))
(make-connection 'force my-plate-hit delay-ctl)

★     ★
★