Skip to content

Sine Controller

Description

Outputs a sine-wave in each dimension.

Syntax and Default Values

The sine controller can be created using the following Lisp, mlys (Max) or mlys.lua syntax:

(make-controller 'sine
                  dimension
                  frequency
                  phase)

The dimension and phase parameters are mandatory in Lisp.

[mlys.sine @name MySine @frequency 440 @phase 30]

• The frequency is always 1 and the period is 0 (updated every sample).
frequency and phase cannot be changed dynamically.

local sine = create_controller{ kind="sine", name="MySine",
                                frequency=440}
--or:
local myfreqs = create_controller{kind="dynamic",name="MyFreqs",
                                  value={55,110,220}}
local myphases  = create_controller{kind="dynamic",name="MyPhases",
                                    value={0,30,45}}
local sine = create_controller{kind="sine",name="MySine",
                               frequency=myfreqs,phase=myphases}

• The controller's dimension is based on frequency's.
• The frequency and phase parameters can be either controllers, or numerical values, in latter case some dynamic controllers are created automatically (controllable via MySine@freq {value} {time} and MySine@phase {value} {time} messsages.)
• The phase parameter must have the same dimension as frequency, and if not provided, it is set to zero(s) by default.

Parameters

The sine controller takes 3 arguments:

  • dimension: dimension of the output controller (automatic in Max environment)
  • frequency: controller defining the frequency of the sine wave.
  • phase: initial phase of the sine wave (in degrees).

The frequency controller determines frequency (or frequencies) of the output sine-wave(s). The dimension of this controller must equal the dimension of the sine-wave controller whose frequency it determines.

The initial phase parameter should be given, even if it is zero. Naturally, a cosine may be made by providing an initial phase of 90 degrees. Currently the phase parameter seems to only apply to the first dimension of the controller. This is a bug.

The sine controller is updated every synthesis sample period.

Discussion

A basic sine controller (at 440 Hz, for example) may be created like this:

(setq my-sine (make-controller 'sine 1 (const 440) 0))
Although one-dimensional sine controllers are most often used, they may have multiple dimensions such as in this example (whose graph is shown, above, for one second of time):

(setq my-sine (make-controller 'sine 3 (const 1 2 5) 0))
Sine wave controllers are often useful to add modulation to other Modalys controllers. For example, if one wanted to add vibrato to the pitch of a plucked or bowed string synthesis, one could slightly vary the position of the access on the string where a finger makes contact with it using a sine controller.

Sine controllers can also be used to make synthesis, that can be used to resonate objects, as shown in Example 5.


★     ★