1. Annotations

Annotate components with user-specific information.

Annotations do not impact formatting.

1.1. Creating annotations

Create annotations like this:

>>> annotation_1 = indicatortools.Annotation('is inner voice', True)

1.2. Attaching annotations to a component

Attach annotations to any component with attach():

>>> note = Note("c'4")
>>> attach(annotation_1, note)
>>> annotation_2 = indicatortools.Annotation('is phrase-initial', False)
>>> attach(annotation_2, note)

1.3. Getting the annotations attached to a component

Use the inspector to get all the annotations attached to a component:

>>> annotations = inspect_(note).get_indicators(indicatortools.Annotation)
>>> for annotation in annotations: annotation
Annotation(name='is inner voice', value=True)
Annotation(name='is phrase-initial', value=False)

1.4. Detaching annotations from a component

Use detach() to detach annotations from a component:

>>> detach(annotation_1, note)
(Annotation(name='is inner voice', value=True),)

1.5. Inspecting annotation name

Use name to get the name of any annotation:

>>> annotation_2.name
'is phrase-initial'

1.6. Inspecting annotation value

Use value to get the value of any annotation:

>>> annotation_2.value

1.7. Getting the value of an annotation in a single call

Use the inspector to the get the value of an annotation in a single call:

>>> inspect_(note).get_annotation('is phrase-initial')