EvenDivisionRhythmMaker

class rhythmmakertools.EvenDivisionRhythmMaker(denominators=[8], beam_specifier=None, burnish_specifier=None, logical_tie_masks=None, division_masks=None, duration_spelling_specifier=None, extra_counts_per_division=None, preferred_denominator='from_counts', tie_specifier=None, tuplet_spelling_specifier=None)

Even division rhythm-maker.

>>> import abjad
>>> from abjad.tools import rhythmmakertools

Object model of a partially evaluated function that accepts a (possibly empty) list of divisions as input and returns a list of selections as output (structured one selection per input division).

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" [color=1, group=0, label=AbjadValueObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.abctools.AbjadValueObject.AbjadValueObject"; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_rhythmmakertools { graph [label=rhythmmakertools]; "abjad.tools.rhythmmakertools.EvenDivisionRhythmMaker.EvenDivisionRhythmMaker" [color=black, fontcolor=white, group=2, label=<<B>EvenDivisionRhythmMaker</B>>, shape=box, style="filled, rounded"]; "abjad.tools.rhythmmakertools.RhythmMaker.RhythmMaker" [color=3, group=2, label=RhythmMaker, shape=box]; "abjad.tools.rhythmmakertools.RhythmMaker.RhythmMaker" -> "abjad.tools.rhythmmakertools.EvenDivisionRhythmMaker.EvenDivisionRhythmMaker"; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" -> "abjad.tools.rhythmmakertools.RhythmMaker.RhythmMaker"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Attribute summary

beam_specifier Gets beam specifier.
burnish_specifier Gets burnish specifier.
denominators Gets denominators.
division_masks Gets division masks.
duration_spelling_specifier Gets duration spelling specifier.
extra_counts_per_division Gets extra counts per division.
logical_tie_masks Gets logical tie masks.
preferred_denominator Gets preferred denominator.
tie_specifier Gets tie specifier.
tuplet_spelling_specifier Gets tuplet spelling specifier.
__call__(divisions[, rotation]) Calls even division rhythm-maker on divisions.
__copy__(*arguments) Copies Abjad value object.
__eq__(argument) Is true when all initialization values of Abjad value object equal the initialization values of argument.
__format__([format_specification]) Formats Abjad object.
__hash__() Hashes Abjad value object.
__illustrate__([divisions]) Illustrates rhythm-maker.
__ne__(argument) Is true when Abjad object does not equal argument.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

(RhythmMaker).beam_specifier

Gets beam specifier.

Set to beam specifier or none.

EvenDivisionRhythmMaker.burnish_specifier

Gets burnish specifier.

Forces the first leaf and the last two leaves to be rests:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     burnish_specifier=rhythmmakertools.BurnishSpecifier(
...         left_classes=[abjad.Rest],
...         left_counts=[1],
...         right_classes=[abjad.Rest],
...         right_counts=[2],
...         outer_divisions_only=True,
...         ),
...     )
>>> divisions = [(3, 8), (4, 8), (3, 8), (4, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Burnishing outer divisions also works when given a single division:

>>> divisions = [(7, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Forces the first leaf of every division to be a rest:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     burnish_specifier=rhythmmakertools.BurnishSpecifier(
...         left_classes=[abjad.Rest],
...         left_counts=[1],
...         ),
...     )
>>> divisions = [(3, 8), (4, 8), (3, 8), (4, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Returns burnish specifier or none.

EvenDivisionRhythmMaker.denominators

Gets denominators.

Fills divisions with 16th notes:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     )
>>> divisions = [(3, 16), (3, 8), (3, 4)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Fills divisions with 8th notes:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[8],
...     )
>>> divisions = [(3, 16), (3, 8), (3, 4)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Fills divisions less than twice the duration of an eighth note with a single attack.

Fills divisions with quarter notes:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[4],
...     )
>>> divisions = [(3, 16), (3, 8), (3, 4)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Divisions less than twice the duration of a quarter note are filled with a single attack.

Fills divisions with half notes:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[2],
...     )
>>> divisions = [(3, 16), (3, 8), (3, 4)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Fills divisions less than twice the duration of a half note with a single attack.

Returns tuple of nonnegative integer powers of two.

EvenDivisionRhythmMaker.division_masks

Gets division masks.

No division masks:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker()
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences every other division:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     division_masks=[
...         abjad.silence_every([0], period=2),
...         ],
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Sustains every other division:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     division_masks=[
...         abjad.sustain_every([0], period=2),
...         ],
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences every output division:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     division_masks=abjad.silence_all(),
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Set to division masks or none.

(RhythmMaker).duration_spelling_specifier

Gets duration spelling specifier.

Set to duration spelling specifier or none.

EvenDivisionRhythmMaker.extra_counts_per_division

Gets extra counts per division.

Treats overly large and overly small values of extra_counts_per_division modularly. Denote by unprolated_note_count the number of unprolated notes included in any division (as though extra_counts_per_division were set to zero). Then the actual number of extra counts included per division is given by two formulas:

  • The actual number of extra counts included per division is given by extra_counts_per_division % unprolated_note_count when extra_counts_per_division is positive.
  • The actual number of extra counts included per division is given by the formula extra_counts_per_division % ceiling(unprolated_note_count / 2) when extra_counts_per_division is negative.

These formulas ensure that:

  • even very large and very small values of extra_counts_per_division produce valid output, and that
  • the values given as the rhythm-maker’s denominators are always respected. A very large value of extra_counts_per_division, for example, never causes a 16-denominated division to result 32nd or 64th note rhythms; 16-denominated divisions always produce 16th note rhythms.

Four missing counts per division:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[-4],
...     )
>>> divisions = [(1, 16), (2, 16), (3, 16), (4, 16), (5, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Three missing counts per division:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[-3],
...     )
>>> divisions = [(1, 16), (2, 16), (3, 16), (4, 16), (5, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Two missing counts per division:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[-2],
...     )
>>> divisions = [(1, 16), (2, 16), (3, 16), (4, 16), (5, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

One missing count per division:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[-1],
...     )
>>> divisions = [(1, 16), (2, 16), (3, 16), (4, 16), (5, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Neither missing nor extra counts per division:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=None,
...     )
>>> divisions = [(1, 16), (2, 16), (3, 16), (4, 16), (5, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

One extra count per division:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[1],
...     )
>>> divisions = [(1, 16), (2, 16), (3, 16), (4, 16), (5, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Two extra counts per division:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[2],
...     )
>>> divisions = [(1, 16), (2, 16), (3, 16), (4, 16), (5, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Three extra counts per division:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[3],
...     )
>>> divisions = [(1, 16), (2, 16), (3, 16), (4, 16), (5, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Four extra counts per division:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[4],
...     )
>>> divisions = [(1, 16), (2, 16), (3, 16), (4, 16), (5, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Returns (possibly empty) tuple of integers or none.

EvenDivisionRhythmMaker.logical_tie_masks

Gets logical tie masks.

No logical tie masks:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker()
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences every third logical tie:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     logical_tie_masks=[
...         abjad.silence_every([0], period=3),
...         ],
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences every logical tie except the first two and last two:

>>> pattern_1 = abjad.index_all()
>>> pattern_2 = abjad.index_first(2)
>>> pattern_3 = abjad.index_last(2)
>>> pattern = pattern_1 ^ pattern_2 ^ pattern_3
>>> mask = abjad.silence(pattern)
>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     logical_tie_masks=mask,
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

With ties across divisions:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     tie_specifier=rhythmmakertools.TieSpecifier(
...         tie_across_divisions=True,
...         ),
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences every fourth logical tie:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     logical_tie_masks=abjad.silence_every(
...         indices=[3],
...         period=4,
...         ),
...     tie_specifier=rhythmmakertools.TieSpecifier(
...         tie_across_divisions=True,
...         ),
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silencing the fourth logical tie produces two rests. Silencing the eighth logical tie produces only one rest.

Returns patterns or none.

EvenDivisionRhythmMaker.preferred_denominator

Gets preferred denominator.

No preferred denominator:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[4],
...     preferred_denominator=None,
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Expresses tuplet ratios in the usual way with numerator and denominator relatively prime.

Preferred denominator equal to 4:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[4],
...     preferred_denominator=4,
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Preferred denominator equal to 8:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[4],
...     preferred_denominator=8,
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Preferred denominator equal to 16:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[4],
...     preferred_denominator=16,
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Preferred denominator taken from count of elements in tuplet:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[4],
...     preferred_denominator='from_counts',
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Defaults to none.

Set to none or positive integer.

Returns none or positive integer.

(RhythmMaker).tie_specifier

Gets tie specifier.

Set to tie specifier or none.

EvenDivisionRhythmMaker.tuplet_spelling_specifier

Gets tuplet spelling specifier.

Note

not yet implemented.

Returns tuplet spelling specifier or none.

Special methods

EvenDivisionRhythmMaker.__call__(divisions, rotation=None)

Calls even division rhythm-maker on divisions.

Fills divisions with alternating eighth and sixteenth notes:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[8, 16],
...     )
>>> divisions = [(3, 8), (3, 8), (3, 8), (3, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Adds extra counts per division according to a pattern of three elements:

>>> rhythm_maker = rhythmmakertools.EvenDivisionRhythmMaker(
...     denominators=[16],
...     extra_counts_per_division=[0, 1, 2],
...     )
>>> divisions = [(3, 8), (3, 8), (3, 8), (3, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Returns list of of selections.

(AbjadValueObject).__copy__(*arguments)

Copies Abjad value object.

Returns new Abjad value object.

(AbjadValueObject).__eq__(argument)

Is true when all initialization values of Abjad value object equal the initialization values of argument.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

(RhythmMaker).__illustrate__(divisions=((3, 8), (4, 8), (3, 16), (4, 16)))

Illustrates rhythm-maker.

Returns LilyPond file.

(AbjadObject).__ne__(argument)

Is true when Abjad object does not equal argument. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.