OM# Documentation

CLASS-ARRAY

CLASS-ARRAY provides powerful means to set the contents of a 2D array. The array is initialized by a number of columns (called “fields”) and a number of rows (called “elements”, sometimes abreviated “elts”).

→ See also 2D-ARRAY for a simple 2D data storage and representation utility.

The main parameters of the CLASS-ARRAY object are:

Given these two initialization parameters, each field can then be initialized individually using the box keyword-inputs (see below).

Array field initialization

In order to set a CLASS-ARRAY field, add a keywork input to the class and select the corresponding field name.

Note: If the box was never evaluated before, the fields in :field-names might not be readily available from the keyword input choice. In this case (and in any case) it is also possible to create a field with the last option in the input menu, :add field.

Each field will be filled at evaluating the CLASS-ARRAY box with the number of elements specified in :num-elts, according to a set of rules depending in the type of input data:

Copy and transformation

When copying a CLASS-ARRAY to another box, it is possible to reset some of the box inputs and transform the array contents accordingly:

Data access

In-pace modification

The functions in the package “Basic Tools / Class-Array and Components” include utilities for in-place, destructive modification of a CLASS-ARRAY. They all use the COMPONENT structure representing one column, or element of the array, as returned by get-comp, or created by new-comp. add-comp and remove-comp add or remove these components, while comp-list and comp-field both have an optional input allowing to replace the component values by new ones, inside the original array.

Further reading and use cases

CLASS-ARRAY as a data structure was designed and use mostly used in the OMChroma project, as a control structure for sound synthesis processes.

→ Read more in: OMChroma: Compositional Control of Sound Synthesis.