Recherche Google
OpenMusic 6 – User ManualVisual Programming > Boxes and Patch Components > Function Boxes > Inputs and Outputs
previous pagenext page

Inputs and Outputs

A function box has a number – 0 or more – of inputs, which represent the arguments1 of the function, and one or more outputs, which return the result(s) of a computation.

Inputs

Using Default Values

The inputs of a box initially come with default values. Nevertheless, they seldom enable correct computations : their values must be reset by the user or they must be connected to other boxes' outputs.

  • A : the om+ box appears without visible values, and its default values are equal to 0. The evaluation returns 0.
  • B : two values have been connected to the same box.
An addition with and without the default values of OM+
An addition with and without the default values of OM+
Viewing Default Values
Tip : Editing Default Values

Default values can be set directly when typing the name of the function box – for instance : "om+ 5 7".

Getting Information

Information is provided by tooltips or in the available documentation.

Input Tooltips and Function Documentation

Outputs

Reminder

Outputs can be evaluated and used for connections with other boxes. Hence, one can evaluate either a whole function, or a specific output that may return a different result.

  • To evaluate a function box, elect it and press v .
  • To evaluate a specific output, Cmd click on it.

The result of the computation is given instantly in the Listener2 window.

Multiple outputs
Om// performs an euclidean division : its first output returns a quotient, its second output returns a rest. The evaluation of the "rest" output necessarily triggers the evaluation of the whole function.
Om// performs an euclidean division : its first output returns a quotient, its second output returns a rest. The evaluation of the "rest" output necessarily triggers the evaluation of the whole function.

A function box may have several outputs, which means that it can return multiple values.

  • If the box is evaluated, all the outputs are evaluated, but the Listener prints the result of the first output only.
  • If an output is evaluated, all the outputs are evaluated, but the Listener prints the results of the chosen output.

Each output can be connected and/or evaluated independently, which doesn't affect the behaviour of the function.

The outputs of om// have been evaluated successively.
The outputs of om// have been evaluated successively.
About Evaluation Specificites
Multiple Outputs : EvaluateOnce Mode
Om-random returns a random number between a minimum and a maximum value.
Om-random returns a random number between a minimum and a maximum value.

The " evaluate-once " mode is generally useful for multiple outputs function boxes : the result of a same evaluation is sent to all connected boxes. Otherwise, each of them will evaluate the function box separately :

  • the function can sometimes return a different result each time,
  • useless additional computations run.

Here, in the first case, om-random is on the standard evaluation mode and returns two different results to each input of list, as shown in the text box below. In the second case, it returns the same result.

More Information about EvalOnce and Other Evaluation Modes
  1. Argument

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

  2. Lisp Listener

    A Lisp communication interface displaying results of computations, warnings or error messages, and where Lisp expressions – programs – can be evaluated.

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