Recherche Google
OpenMusic QuickStart
previous pagenext page

Programming a Simple Patch

This section describes all the stages that compose the programming of a simple patch. A patch, or program, is represented by this icon : . It is the place where almost all programming is done in OM. Patches must be added one the workspace, but you will also find existing tutorial patches on the Ircam workspaces if you decide to install and use them.

Adding a Patch in the Workspace

To add a patch in the workspace :

  • choose File / New Patch

  • press SHIFT + Cmd + 1.

Opening an Existing Patch

You can also open the patch that is provided in the OMWorkspace.

  1. Double click on the "patch" patch.

  2. The patch opens as a new window, called "patch editor", where all programming is done.

Programming Basic Computation with a Single Item : a Function

OM can perform any type of operation, be it musical or not. To understand the basic principles of programming, let's start with the most simple operation ever, an addition. To do so, we need to add the relevant operator in the patch editor. Operators in OM are called functions1. They are accessible via the Functions menu of the patch editor.

Adding a Function in the Patch
  1. Pick the om+ function in the Functions / Arithmetic sub menu, which gives access to the arithmetic operators.

  2. Click somewhere in the patch editor : om+  appears . The box has two inlets at the top, and one outlet at the bottom.

About Lisp

In Lisp, "arguments" are the things upon which a function operates. It can be any type of data. "Calling" a function means to evaluate it, or start the computation.

Programming Steps

1. Box Size

To increase the size of the box, hover the mouse over it and dragg its lower-right corner.

2. Viewing Default Values

Default values are assigned to the arguments2 of a function. To display default values, hover the mouse over inlets.

New values must be assigned to the function.

3. Displaying Default Values

To display values permanently press SHIFT while hovering the mouse over the inlets.

Data boxes appear connected to the function's inlets.

4. Manipulating Data Boxes

Data boxes can be resized like the om+ box, and dragged in the editor.

To adjust their size automatically, press i

5. Entering Values

To modify the default values :

  1. double click in the box,

  2. press Enter or click in the patch editor to validate .

You can also click on the corresponding inlet to display the editable text box and enter a new value.

It will remain hidden.

6. Evaluation

The result of the computation is displayed in the Listener.

Viewing Results

To evaluate om+ :

  • select the box and press v
  • Cmd click on its outlet

Saving

To save the patch :

  • click somewhere in its editor and press Cmd+ s
  • choose File / Save .
  1. Function

    A  portion of code within a larger program, which performs a specific task. Operates upon 0 or more parameters and returns a value.

  2. Argument

    An argument represents a parameter upon which a function operates. For instance a function (OM+ x y), has two arguments : x and y.

previous pagenext page
About...(c) Ircam - Centre PompidouMade with Scenari