Skip to content

Set Mode Freq

Description

This allows the pitch of an individual mode to be altered dynamically.

(set-mode-freq ... )

Lisp Syntax and Default Values

The (set-mode-freq ... ) function can be called using the following Lisp syntax:

(set-mode-freq object_reference mode_number value)
or:

(set-mode-freq object_reference mode_number controller)

Parameters

The (set-mode-freq ... ) function requires three arguments:

  • object_reference: name of the object whose specified mode frequency will be controlled.
  • mode_number: the mode number whose pitch will be altered (starting from mode 0)
  • value, controller: a numerical value or a Modalys controller used to determine the pitch of the given mode(in Hz).

The mode-number must lie between zero and the number of modes in the object minus one.

Discussion

This function is used to set the frequency of a mode to a new value. The following example shows how you can use (get-info 'mode-frequency ... ) to obtain the frequency of a given mode, and then scale it dynamically using (set-mode-freq ... ):

(setq orig-freq-mode0 (get-info 'mode-frequency my-string 0))
(setq freq-env-mode0 (make-controller 'envelope 1
         (list    (list 0 orig-freq-mode0)
                  (list 1 (* 1.9 orig-freq-mode0))
                  (list 2 orig-freq-mode0))))
(set-mode-freq my-string 0 freq-env-mode0)
It is also possible to set the mode frequency with (set-info ... ), but in this case the frequency can only be static, not dynamic, as you can't use a controller for this function:

(set-info 'mode-frequency my-string 1 800)
This function is not yet implemented for Hybrids; an error message will be displayed if object is of hybrid type.

Options

Retro-Compatibility

Modalys also has an older syntax for this function:

(set-mode-freq! object_reference mode_number value)
The older function basically did the same thing without the convenience of optionally using a controller), so any older Modalys scripts using it should be updated to use the new syntax (without the exclamation point).