Ceci est une ancienne révision du document !


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:

  • qvalue is an integer, such that 1 / qvalue defines a rational fraction of the quarter note.
    This is the abstract time unit in which the extent is expressed
  • qtempo is an integer. Defines a tempo expressed as a frequency of the quarter note per minute (e.g. q.n. = 60).
    Gives an interpretation of Qvalue in the physical time.
  • offset is an integer.
    Time offset of the container from the beginning of its super-container. offset is expressed in the time scale defined by the qvalue slot of the super-container.
  • extent is an integer. Expresses the duration of the container, in the time scale defined by the qvalue.

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.

<P><CENTER><IMG SRC="D05.gif" WIDTH="230" HEIGHT="96" ALIGN="BOTTOM"

BORDER="0" NATURALSIZEFLAG="3"></CENTER></P>

<br><br>

<P><CENTER><IMG SRC="d04.gif" WIDTH="505" HEIGHT="166" ALIGN="BOTTOM"

BORDER="0" NATURALSIZEFLAG="3"></CENTER></P>

<P>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.</P>

<P>Here is an example where we use some musical subclasses of

container and simple-container.</P>

<P><CODE>voice</CODE> is a subclass of <CODE>container</CODE>.

It defines a musical voice in a score. Its <CODE>inside</CODE>

slot is a list of <CODE>measure</CODE>, another <CODE>container</CODE>.

The <CODE>inside</CODE> slot of measures are either single <CODE>notes</CODE>

(<CODE>simple-container</CODE>), <CODE>chords</CODE>, or <CODE>groups</CODE>

(<CODE>container</CODE>). <CODE>Groups</CODE> are groups of chords

or notes that belong to a beat (e.g. three chords making up a

triplet).</P>

<P>The next picture shows the instantiation tree starting from

<CODE>voice</CODE>. The arrows express the <CODE>inside</CODE>

slot of the object they start from.</P>

<P><CENTER><IMG SRC="d02.gif" WIDTH="421" HEIGHT="212" ALIGN="BOTTOM"

BORDER="0" NATURALSIZEFLAG="3"></CENTER></P>

<br>

<P>Here is an example of a measure :</P>

<P><CENTER><IMG SRC="I13.gif" WIDTH="378" HEIGHT="117" ALIGN="BOTTOM"

BORDER="0" NATURALSIZEFLAG="3"></CENTER></P>

<P>and the instantiation tree showing the values for <CODE>qvalue,

offset </CODE>and <CODE>extent</CODE> slots.</P>

<P><CENTER><IMG SRC="D06.gif" WIDTH="476" HEIGHT="322"></CENTER></P>

<P>Here is another example where we superpose the previous voice

and an audio file which lasts 1230 ms.</P>

<P><CENTER><IMG SRC="D07.gif" WIDTH="284" HEIGHT="264"</CENTER>

 


openmusic/dev-resources/containers.1296236580.txt.gz · Dernière modification: 2011/01/28 18:43 par jean-admin