OpenMusic

Visual Programming | Computer-Assisted Composition

Containers and simple containers

In OM, every musical object is an instance of some subclass of either simple-container (atomic objects) or container (compound object).

This is the (partial) inheritance tree starting at simple-container:

.. and this is the class definitions:

  (defclas simple-container ()
    ((parent :initform nil)
     (Qvalue :initform 1)
     (QTempo :initform 60)
     (offset :initform 0)
     (extent :initform 1)))
	
  (defclas container (simple-container)
    ((inside :initform nil)))

The slot inside in a container stores a list of sub-containers that are either instances of container (nodes of the container tree) or simple-container (leaves of the container tree).

These sub-containers are positioned and dimensioned in time.

All the slots that give the time specification (QValue, Qtempo, offset, extent) are defined in the class simple-container (remember that a container is also a simple-container).

Subcontainers are really sub-trees of the container tree. They define a local time scale, in the following way:

The following pictures show the container tree-structure. The slots offset, qvalue and extent are drawn inside or outside the container rectangle, depending on the time scale in which they are expressed.

Using the qvalue mechanism, a local time scale can be defined at each level of the container tree. This helps maintaining complex container structures where some parts could belong to score level time scales while other could belong to audio level time scales, while still restraining to integer computation. Restraining to integer computation is very important for rhythm quantization issues.

Here is an example where we use some musical subclasses of container and simple-container:

Voice is a subclass of container. It defines a musical voice in a score. Its inside slot is a list of measures, another container. The inside slot of measures are either single notes (simple-container), chords or groups (container). Groups are groups of chords or notes that belong to a beat (e.g. three chords making a triplet).

The next picture shows the instantiation tree starting from voice. The arrows express the inside` slot of the object they start from.

Here is an example of a measure:

… and the instantiation tree showing the values for qvalue, offset and extent slots

Here is another example where we superpose the previous voice and an audio file which lasts 1230 ms.