LeafDynMaker

class auxjad.LeafDynMaker[source]

Creates leaves and logical ties from list’s of pitches, durations, dynamics, and articulations. It is an extension of abjad.LeafMaker which can take optional list’s of dynamics and articulations.

Basic usage:

Usage is similar to abjad.LeafMaker:

>>> pitches = [0, 2, 4, 5, 7, 9]
>>> durations = [(1, 32), (2, 32), (3, 32), (4, 32), (5, 32), (6, 32)]
>>> dynamics = ['pp', 'p', 'mp', 'mf', 'f', 'ff']
>>> articulations = ['.', '>', '-', '_', '^', '+']
>>> maker = auxjad.LeafDynMaker()
>>> notes = maker(pitches, durations, dynamics, articulations)
>>> staff = abjad.Staff(notes)
>>> abjad.show(staff)
../_images/LeafDynMaker-iv96zmptned.png
pitches:

Tuple elements in pitches result in chords. None-valued elements in pitches result in rests:

>>> pitches = [5, None, (0, 2, 7)]
>>> durations = [(1, 4), (1, 8), (1, 16)]
>>> dynamics = ['p', None, 'f']
>>> articulations = ['staccato', None, 'tenuto']
>>> maker = auxjad.LeafDynMaker()
>>> notes = maker(pitches, durations, dynamics, articulations)
>>> staff = abjad.Staff(notes)
>>> abjad.show(staff)
../_images/LeafDynMaker-odpaavswk29.png
omit_repeated_dynamics:

Can omit repeated dynamics with the keyword argument omit_repeated_dynamics:

>>> pitches = [0, 2, 4, 5, 7, 9]
>>> durations = [(1, 32), (2, 32), (3, 32), (4, 32), (5, 32), (6, 32)]
>>> dynamics = ['pp', 'pp', 'mp', 'f', 'f', 'p']
>>> maker = auxjad.LeafDynMaker()
>>> notes = maker(pitches,
...               durations,
...               dynamics,
...               omit_repeated_dynamics=True,
...               )
>>> staff = abjad.Staff(notes)
>>> abjad.show(staff)
../_images/LeafDynMaker-jryhls4d6ic.png
dynamics and articulations:

The lengths dynamics and articulations can be shorter than the lengths of pitches and durations (whatever is the greatest):

>>> pitches = [0, 2, 4, 5, 7, 9, 11, 12]
>>> durations = (1, 4)
>>> dynamics = ['p', 'f', 'ff']
>>> articulations = ['.', '>']
>>> maker = auxjad.LeafDynMaker()
>>> notes = maker(pitches, durations, dynamics, articulations)
>>> staff = abjad.Staff(notes)
>>> abjad.show(staff)
../_images/LeafDynMaker-1losyp9vc1di.png
cyclic_dynamics and cyclic_articulations:

If the lengths of either dynamics and articulations are shorter than the lengths of pitches and durations (whatever is the greatest), use the optional keyword arguments cyclic_dynamics and cyclic_articulations to apply those parameters cyclically:

>>> pitches = [0, 2, 4, 5, 7, 9, 11, 12]
>>> durations = (1, 4)
>>> dynamics = ['p', 'f', 'ff']
>>> articulations = ['.', '>']
>>> maker = auxjad.LeafDynMaker()
>>> notes = maker(pitches,
...               durations,
...               dynamics,
...               articulations,
...               cyclic_dynamics=True,
...               cyclic_articulations=True,
...               )
>>> staff = abjad.Staff(notes)
>>> abjad.show(staff)
../_images/LeafDynMaker-x8zhyel42i.png
articulations and dynamics of length 1:

If the length of articulations or dynamics is 1, they will be applied only to the first element.

>>> pitches = [0, 2, 4, 5, 7, 9, 11, 12]
>>> durations = (1, 4)
>>> dynamics = 'p'
>>> articulations = '.'
>>> maker = auxjad.LeafDynMaker()
>>> notes = maker(pitches, durations, dynamics, articulations)
>>> staff = abjad.Staff(notes)
>>> abjad.show(staff)
../_images/LeafDynMaker-wwl4pcpmwhv232n7j7ws.png
cyclic_dynamics and cyclic_articulations of length 1:

To apply them to all elements, use the cyclic_dynamics and cyclic_articulations optioanl keywords.

>>> pitches = [0, 2, 4, 5, 7, 9, 11, 12]
>>> durations = (1, 4)
>>> dynamics = 'p'
>>> articulations = '.'
>>> maker = auxjad.LeafDynMaker()
>>> notes = maker(pitches,
...               durations,
...               dynamics,
...               articulations,
...               cyclic_articulations=True,
...               )
>>> staff = abjad.Staff(notes)
>>> abjad.show(staff)
../_images/LeafDynMaker-s5ic146v4qb.png
Accepted types:

Similarly to Abjad’s native classes, it accepts many types of elements in its input list’s:

>>> pitches = [0,
...            "d'",
...            'E4',
...            abjad.NumberedPitch(5),
...            abjad.NamedPitch("g'"),
...            abjad.NamedPitch('A4'),
...            ]
>>> durations = [(1, 32),
...              '2/32',
...              abjad.Duration('3/32'),
...              abjad.Duration(0.125),
...              abjad.Duration(5, 32),
...              abjad.Duration(6 / 32),
...              ]
>>> dynamics = ['p',
...             abjad.Dynamic('f'),
...             ]
>>> articulations = ['>',
...                  abjad.Articulation('-'),
...                  abjad.Articulation('.'),
...                  ]
>>> maker = auxjad.LeafDynMaker()
>>> notes = maker(pitches, durations, dynamics, articulations)
>>> staff = abjad.Staff(notes)
>>> abjad.show(staff)
../_images/LeafDynMaker-79n2uz1n8j3.png

Methods

__call__(pitches, durations[, dynamics, …])

Calls the leaf-maker on pitches, durations, dynamics, and articulations, returning an abjad.Selection.

__init__()

Initialises self.

__repr__()

Return repr(self).

Attributes

forbidden_note_duration

Gets forbidden written duration.

forbidden_rest_duration

Gets forbidden written duration.

increase_monotonic

Is true when durations increase monotonically.

skips_instead_of_rests

Is true when skips appear in place of rests.

tag

Gets tag.

use_multimeasure_rests

Is true when rests are multimeasure.

__call__(pitches, durations, dynamics=None, articulations=None, *, omit_repeated_dynamics: bool = False, cyclic_dynamics: bool = False, cyclic_articulations: bool = False)abjad.select.Selection[source]

Calls the leaf-maker on pitches, durations, dynamics, and articulations, returning an abjad.Selection.

__init__()None[source]

Initialises self.

property forbidden_note_duration: Optional[abjad.duration.Duration]

Gets forbidden written duration.

property forbidden_rest_duration: Optional[abjad.duration.Duration]

Gets forbidden written duration.

property increase_monotonic: Optional[bool]

Is true when durations increase monotonically.

property skips_instead_of_rests: Optional[bool]

Is true when skips appear in place of rests.

property tag: Optional[abjad.tag.Tag]

Gets tag.

Integer and string elements in pitches result in notes:

>>> maker = abjad.LeafMaker(tag=abjad.Tag("leaf_maker"))
>>> pitches = [2, 4, 'F#5', 'G#5']
>>> duration = abjad.Duration(1, 4)
>>> leaves = maker(pitches, duration)
>>> staff = abjad.Staff(leaves)
>>> abjad.show(staff) 
property use_multimeasure_rests: Optional[bool]

Is true when rests are multimeasure.