NoteRhythmMaker

class rhythmmakertools.NoteRhythmMaker(beam_specifier=None, burnish_specifier=None, division_masks=None, duration_spelling_specifier=None, logical_tie_masks=None, tie_specifier=None, tuplet_spelling_specifier=None)

Note rhythm-maker.

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

Makes notes equal to the duration of input divisions. Adds ties where necessary:

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

Usage follows the two-step configure-once / call-repeatedly pattern shown here.

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.NoteRhythmMaker.NoteRhythmMaker" [color=black, fontcolor=white, group=2, label=<<B>NoteRhythmMaker</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.NoteRhythmMaker.NoteRhythmMaker"; } 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.
division_masks Gets division masks.
duration_spelling_specifier Gets duration spelling specifier.
logical_tie_masks Gets logical tie masks.
tie_specifier Gets tie specifier.
tuplet_spelling_specifier Gets tuplet spelling specifier.
__call__(divisions[, rotation]) Calls note 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 note rhythm-maker.
__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.

Read-only properties

NoteRhythmMaker.beam_specifier

Gets beam specifier.

Beams each division:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     beam_specifier=rhythmmakertools.BeamSpecifier(
...         beam_each_division=True,
...         ),
...     )
>>> divisions = [(5, 32), (5, 32)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Beams divisions together:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     beam_specifier=rhythmmakertools.BeamSpecifier(
...         beam_divisions_together=True,
...         ),
...     )
>>> divisions = [(5, 32), (5, 32)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Makes no beams:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     beam_specifier=rhythmmakertools.BeamSpecifier(
...         beam_divisions_together=False,
...         beam_each_division=False,
...         ),
...     )
>>> divisions = [(5, 32), (5, 32)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Returns beam specifier.

NoteRhythmMaker.burnish_specifier

Gets burnish specifier.

Burnishes nothing:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker()
>>> divisions = [(5, 8), (2, 8), (2, 8), (5, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Forces leaves of first division to be rests:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     burnish_specifier=rhythmmakertools.BurnishSpecifier(
...         left_classes=[abjad.Rest],
...         left_counts=[1],
...         outer_divisions_only=True,
...         ),
...     )
>>> divisions = [(5, 8), (2, 8), (2, 8), (5, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Forces leaves of first two divisions to be rests:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     burnish_specifier=rhythmmakertools.BurnishSpecifier(
...         left_classes=[abjad.Rest],
...         left_counts=[2],
...         outer_divisions_only=True,
...         ),
...     )
>>> divisions = [(5, 8), (2, 8), (2, 8), (5, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Forces leaves of first and last divisions to rests:

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

Note

Currently only works when outer_divisions_only is true.

Returns burnish specifier or none.

NoteRhythmMaker.division_masks

Gets division masks.

No division masks:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker()
>>> 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.NoteRhythmMaker(
...     division_masks=[
...         rhythmmakertools.SilenceMask(
...             pattern=abjad.index_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.NoteRhythmMaker(
...     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) 

Silences every output division and uses multimeasure rests:

>>> mask = rhythmmakertools.SilenceMask(
...     pattern=abjad.index_all(),
...     use_multimeasure_rests=True,
...     )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_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) 

Silences every other output division except for the first and last:

>>> pattern_1 = abjad.index_every([0], period=2)
>>> pattern_2 = abjad.index([0, -1])
>>> pattern = pattern_1 & ~pattern_2
>>> mask = rhythmmakertools.SilenceMask(
...     pattern=pattern,
...     )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[mask],
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8), (2, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Set to masks or none.

NoteRhythmMaker.duration_spelling_specifier

Gets duration spelling specifier.

Spells durations with the fewest number of glyphs:

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

Forbids notes with written duration greater than or equal to 1/2:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     duration_spelling_specifier=rhythmmakertools.DurationSpellingSpecifier(
...         forbidden_written_duration=(1, 2),
...         ),
...     )
>>> divisions = [(5, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Spells all divisions metrically when spell_metrically is true:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     duration_spelling_specifier=rhythmmakertools.DurationSpellingSpecifier(
...         spell_metrically=True,
...         ),
...     )
>>> divisions = [(3, 4), (6, 16), (9, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Spells only unassignable durations metrically when spell_metrically is 'unassignable':

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     duration_spelling_specifier=rhythmmakertools.DurationSpellingSpecifier(
...         spell_metrically='unassignable',
...         ),
...     )
>>> divisions = [(3, 4), (6, 16), (9, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

9/16 is spelled metrically because it is unassignable. The other durations are spelled with the fewest number of symbols possible.

Spells durations with custom partition table:

>>> partition_table = rhythmmakertools.PartitionTable([
...     (5, [3, 2]),
...     (9, [3, 3, 3]),
...     ])
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     duration_spelling_specifier=rhythmmakertools.DurationSpellingSpecifier(
...         spell_metrically=partition_table,
...         ),
...     )
>>> divisions = [(5, 16), (9, 16), (10, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Rewrites meter:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     duration_spelling_specifier=rhythmmakertools.DurationSpellingSpecifier(
...         rewrite_meter=True,
...         ),
...     )
>>> divisions = [(3, 4), (6, 16), (9, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Returns duration spelling specifier or none.

NoteRhythmMaker.logical_tie_masks

Gets logical tie masks.

No logical tie masks:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker()
>>> 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 logical tie:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     logical_tie_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) 

Silences all logical ties:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     logical_tie_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 masks or none.

NoteRhythmMaker.tie_specifier

Gets tie specifier.

Does not tie across divisions:

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

Ties across divisions:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     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) 

Patterns ties across divisions:

>>> pattern = abjad.Pattern(
...     indices=[0],
...     period=2,
...     )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     tie_specifier=rhythmmakertools.TieSpecifier(
...         tie_across_divisions=pattern,
...         ),
...     )
>>> divisions = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Uses Messiaen-style ties:

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

Strips all ties:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     tie_specifier=rhythmmakertools.TieSpecifier(
...         strip_ties=True,
...         ),
...     )
>>> divisions = [(7, 16), (1, 4), (5, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Spells durations metrically and then strips all ties:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     duration_spelling_specifier=rhythmmakertools.DurationSpellingSpecifier(
...         spell_metrically=True,
...         ),
...     tie_specifier=rhythmmakertools.TieSpecifier(
...         strip_ties=True,
...         ),
...     )
>>> divisions = [(7, 16), (1, 4), (5, 16)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Returns tie specifier.

NoteRhythmMaker.tuplet_spelling_specifier

Gets tuplet spelling specifier.

Spells tuplets as diminutions:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker()
>>> divisions = [(5, 14), (3, 7)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Spells tuplets as augmentations:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     tuplet_spelling_specifier=rhythmmakertools.TupletSpellingSpecifier(
...         is_diminution=False,
...         ),
...     )
>>> divisions = [(5, 14), (3, 7)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Returns tuplet spelling specifier or none.

Special methods

NoteRhythmMaker.__call__(divisions, rotation=None)

Calls note rhythm-maker on divisions.

Calls rhythm-maker on divisions:

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker()
>>> divisions = [(5, 8), (3, 8)]
>>> result = rhythm_maker(divisions)
>>> for x in result:
...     x
... 
Selection([Note("c'2"), Note("c'8")])
Selection([Note("c'4.")])

Returns list of selections. Each selection holds one or more notes.

(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.

NoteRhythmMaker.__format__(format_specification='')

Formats note rhythm-maker.

Set format_specification to ‘’ or ‘storage’.

>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker()
>>> f(rhythm_maker)
rhythmmakertools.NoteRhythmMaker()

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.

NoteRhythmMaker.__repr__()

Gets interpreter representation.

>>> rhythmmakertools.NoteRhythmMaker()
NoteRhythmMaker()

Returns string.