Horizontal Containers

Chain

A Chain is used to represent a sequence of notes or chords. It can contain other Chains. Within a Chain there are no simultaneous events: events cannot overlap. Events in a Chain have an offset, relative to the start of the Chain. This offset can be explicitely set (meaning someNote.offset is not None) or inferred to start exactly at the end of the previous item in the Chain.

When an item is appended to a Chain, the item becomes a child of the chain and the chain becomes its parent (see MEvent.parent)

Chain Reference
assets/notebook-reference-chain.png

Reference Notebook for the Chain class


Voice

A Voice is a subclass of Chain and all said before applies to it, with the following differences:

  • A Voice can contain a Chain, but a Voice cannot contain another Voice

  • A Voice does not have a time offset, its offset is always 0

  • A Voice is used to represent a UnquantizedPart or Instrument within a score. It includes multiple attributes and methods to customize its representation and playback.

maelzel.core.chain Module

Chain([items, offset, label, properties, ...])

A Chain is a sequence of Notes, Chords or other Chains

Voice([items, name, shortname, maxstaves])

A Voice is a sequence of non-overlapping objects.

digraph inheritance2c48aa06f9 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "Chain" [URL="api/maelzel.core.chain.Chain.html#maelzel.core.chain.Chain",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Chain is a sequence of Notes, Chords or other Chains"]; "MContainer" -> "Chain" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MContainer" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="An interface for any class which can be a parent"]; "MObj" -> "MContainer" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MObj" [URL="api/maelzel.core.mobj.MObj.html#maelzel.core.mobj.MObj",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="This is the base class for all core objects."]; "ABC" -> "MObj" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Voice" [URL="api/maelzel.core.chain.Voice.html#maelzel.core.chain.Voice",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Voice is a sequence of non-overlapping objects."]; "Chain" -> "Voice" [arrowsize=0.5,style="setlinewidth(0.5)"]; }