OpenMusic

Visual Programming | Computer-Assisted Composition

Navigation : Previous | Next

Lambda Mode Examples: Lambda Patches

Predefined functions on “lambda” mode may not always be adapted for higher- order processes. Patch boxes can also be set on “lambda” evaluation mode : they can represent more flexible functional arguments.

Any patch designed to process data can be used as a lambda function and perform its process in a higher-order function.

Example

This patch converts a frequency (Hz) in a midicent value and rounds it to the closest fraction of a tone expressed in midicents. Note that a tone represents 200 midicents.

In this case, 479Hz = 7048. This value is rounded to the closest 1/4 tone, that is, 200/4 = 50.

—|—

The same patch box can be used on lambda mode with mapcar in order to process a list of input values. Mapcar applies a function to the items of one or more lists, successively.

—|—

The mapcar function

References :

Contents :

Navigation : Previous | Next