.. _moduleTreeNode:

music21.tree.node
=================

.. WARNING: DO NOT EDIT THIS FILE:
   AUTOMATICALLY GENERATED.
   PLEASE EDIT THE .py FILE DIRECTLY.

.. automodule:: music21.tree.node

ElementNode
-----------

.. autoclass:: music21.tree.node.ElementNode

.. rubric:: :class:`~music21.tree.node.ElementNode` bases

- :class:`~music21.tree.core.AVLNode`
- :class:`~music21.common.objects.SlottedObjectMixin`

.. rubric:: :class:`~music21.tree.node.ElementNode` read-only properties

.. autoattribute:: music21.tree.node.ElementNode.highestPosition

.. autoattribute:: music21.tree.node.ElementNode.lowestPosition

.. rubric:: :class:`~music21.tree.node.ElementNode` methods

.. automethod:: music21.tree.node.ElementNode.updateEndTimes

.. automethod:: music21.tree.node.ElementNode.updateIndices

Methods inherited from :class:`~music21.tree.core.AVLNode`:

.. hlist::
   :columns: 3

   - :meth:`~music21.tree.core.AVLNode.debug`
   - :meth:`~music21.tree.core.AVLNode.moveAttributes`
   - :meth:`~music21.tree.core.AVLNode.rebalance`
   - :meth:`~music21.tree.core.AVLNode.rotateLeftLeft`
   - :meth:`~music21.tree.core.AVLNode.rotateLeftRight`
   - :meth:`~music21.tree.core.AVLNode.rotateRightLeft`
   - :meth:`~music21.tree.core.AVLNode.rotateRightRight`
   - :meth:`~music21.tree.core.AVLNode.update`

.. rubric:: :class:`~music21.tree.node.ElementNode` instance variables

.. attribute:: ElementNode.endTimeHigh

	
	The highest endTime of any node in the subtree rooted on this node.
	

.. attribute:: ElementNode.endTimeLow

	
	The lowest endTime of any node in the subtree rooted on this node.
	

.. attribute:: ElementNode.payloadElementIndex

	
	The index in a stream of the element stored in the payload of this node.
	

.. attribute:: ElementNode.subtreeElementsStartIndex

	
	The lowest element index of an element in the payload of any node of the
	subtree rooted on this node.
	

.. attribute:: ElementNode.subtreeElementsStopIndex

	
	The highest element index of an element in the payload of any node of the
	subtree rooted on this node.
	

Instance variables inherited from :class:`~music21.tree.core.AVLNode`:

.. hlist::
   :columns: 3

   - :attr:`~music21.tree.core.AVLNode.balance`
   - :attr:`~music21.tree.core.AVLNode.height`
   - :attr:`~music21.tree.core.AVLNode.leftChild`
   - :attr:`~music21.tree.core.AVLNode.payload`
   - :attr:`~music21.tree.core.AVLNode.position`
   - :attr:`~music21.tree.core.AVLNode.rightChild`

OffsetNode
----------

.. autoclass:: music21.tree.node.OffsetNode

.. rubric:: :class:`~music21.tree.node.OffsetNode` bases

- :class:`~music21.tree.node.ElementNode`
- :class:`~music21.tree.core.AVLNode`
- :class:`~music21.common.objects.SlottedObjectMixin`

.. rubric:: :class:`~music21.tree.node.OffsetNode` read-only properties

Read-only properties inherited from :class:`~music21.tree.node.ElementNode`:

.. hlist::
   :columns: 3

   - :attr:`~music21.tree.node.ElementNode.highestPosition`
   - :attr:`~music21.tree.node.ElementNode.lowestPosition`

.. rubric:: :class:`~music21.tree.node.OffsetNode` methods

.. automethod:: music21.tree.node.OffsetNode.payloadEndTimes

.. automethod:: music21.tree.node.OffsetNode.updateEndTimes

.. automethod:: music21.tree.node.OffsetNode.updateIndices

Methods inherited from :class:`~music21.tree.core.AVLNode`:

.. hlist::
   :columns: 3

   - :meth:`~music21.tree.core.AVLNode.debug`
   - :meth:`~music21.tree.core.AVLNode.moveAttributes`
   - :meth:`~music21.tree.core.AVLNode.rebalance`
   - :meth:`~music21.tree.core.AVLNode.rotateLeftLeft`
   - :meth:`~music21.tree.core.AVLNode.rotateLeftRight`
   - :meth:`~music21.tree.core.AVLNode.rotateRightLeft`
   - :meth:`~music21.tree.core.AVLNode.rotateRightRight`
   - :meth:`~music21.tree.core.AVLNode.update`

.. rubric:: :class:`~music21.tree.node.OffsetNode` instance variables

.. attribute:: OffsetNode.payload

	
	The contents of the node at this point.  Usually a list of ElementTimespans
	or PitchedTimespans.
	
	>>> score = tree.makeExampleScore()
	>>> scoreTree = tree.fromStream.asTimespans(score, flatten=True,
	...                  classList=(note.Note, chord.Chord))
	>>> print(scoreTree.rootNode.debug())
	<OffsetNode 3.0 Indices:0,5,6,12 Length:1>
	L: <OffsetNode 1.0 Indices:0,2,3,5 Length:1>
	L: <OffsetNode 0.0 Indices:0,0,2,2 Length:2>
	R: <OffsetNode 2.0 Indices:3,3,5,5 Length:2>
	R: <OffsetNode 5.0 Indices:6,8,9,12 Length:1>
	L: <OffsetNode 4.0 Indices:6,6,8,8 Length:2>
	R: <OffsetNode 6.0 Indices:9,9,11,12 Length:2>
	R: <OffsetNode 7.0 Indices:11,11,12,12 Length:1>
	
	>>> scoreTree.rootNode.payload
	[<PitchedTimespan (3.0 to 4.0) <music21.note.Note F>>]
	
	>>> scoreTree.rootNode.leftChild.payload
	[<PitchedTimespan (1.0 to 2.0) <music21.note.Note D>>]
	
	>>> for x in scoreTree.rootNode.leftChild.rightChild.payload:
	...     x
	...
	<PitchedTimespan (2.0 to 3.0) <music21.note.Note E>>
	<PitchedTimespan (2.0 to 4.0) <music21.note.Note G#>>
	
	>>> scoreTree.rootNode.rightChild.payload
	[<PitchedTimespan (5.0 to 6.0) <music21.note.Note A>>]
	

.. attribute:: OffsetNode.payloadElementsStartIndex

	
	The timespan start index (i.e., the first x where s[x] is found in this Node's payload)
	of only those timespans stored in the payload of this node.
	

.. attribute:: OffsetNode.payloadElementsStopIndex

	
	The timespan stop index (i.e., the last x where s[x] is found in this Node's payload)
	of only those timespans stored in the payload of this node.
	

Instance variables inherited from :class:`~music21.tree.node.ElementNode`:

.. hlist::
   :columns: 3

   - :attr:`~music21.tree.node.ElementNode.endTimeHigh`
   - :attr:`~music21.tree.node.ElementNode.endTimeLow`
   - :attr:`~music21.tree.node.ElementNode.payloadElementIndex`
   - :attr:`~music21.tree.node.ElementNode.subtreeElementsStartIndex`
   - :attr:`~music21.tree.node.ElementNode.subtreeElementsStopIndex`

Instance variables inherited from :class:`~music21.tree.core.AVLNode`:

.. hlist::
   :columns: 3

   - :attr:`~music21.tree.core.AVLNode.balance`
   - :attr:`~music21.tree.core.AVLNode.height`
   - :attr:`~music21.tree.core.AVLNode.leftChild`
   - :attr:`~music21.tree.core.AVLNode.payload`
   - :attr:`~music21.tree.core.AVLNode.position`
   - :attr:`~music21.tree.core.AVLNode.rightChild`