makers

Makers.


Functions

accelerando

Makes one accelerando (or ritardando) for each duration in durations.

even_division

Makes one even-division tuplet for each duration in durations.

incised

Makes one incised tuplet for each duration in durations.

multiplied_duration

Makes one leaf with multiplier for each duration in durations.

note

Makes one note for every duration in durations.

talea

Reads counts cyclically and makes one tuplet for each duration in durations.

tuplet

Makes one tuplet for each duration in durations.

abjadext.rmakers.makers.accelerando(durations, *interpolations, previous_state=None, spelling=Spelling(forbidden_note_duration=None, forbidden_rest_duration=None, increase_monotonic=False), state=None, tag=None)[source]

Makes one accelerando (or ritardando) for each duration in durations.

>>> def make_lilypond_file(pairs, interpolations):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.accelerando(durations, *interpolations)
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.feather_beam(voice)
...     rmakers.duration_bracket(voice)
...     rmakers.swap_length_1(voice)
...     score = lilypond_file["Score"]
...     abjad.override(score).TupletBracket.padding = 2
...     abjad.override(score).TupletBracket.bracket_visibility = True
...     return lilypond_file
... 

Makes accelerandi:

>>> pairs = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> interpolations = [[(1, 8), (1, 20), (1, 16)]]
>>> lilypond_file = make_lilypond_file(pairs, interpolations)
>>> abjad.show(lilypond_file)  

Makes ritardandi:

>>> pairs = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> interpolations = [[(1, 20), (1, 8), (1, 16)]]
>>> lilypond_file = make_lilypond_file(pairs, interpolations)
>>> abjad.show(lilypond_file)  

Makes accelerandi and ritardandi, alternatingly:

>>> pairs = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> interpolations = [[(1, 8), (1, 20), (1, 16)], [(1, 20), (1, 8), (1, 16)]]
>>> lilypond_file = make_lilypond_file(pairs, interpolations)
>>> abjad.show(lilypond_file)  

Populates short duration with single note:

>>> pairs = [(5, 8), (3, 8), (1, 8)]
>>> interpolations = [[(1, 8), (1, 20), (1, 16)]]
>>> lilypond_file = make_lilypond_file(pairs, interpolations)
>>> abjad.show(lilypond_file)  
Return type:

list[Tuplet]

abjadext.rmakers.makers.even_division(durations, denominators, *, denominator='from_counts', extra_counts=(0,), previous_state=None, spelling=Spelling(forbidden_note_duration=None, forbidden_rest_duration=None, increase_monotonic=False), state=None, tag=None)[source]

Makes one even-division tuplet for each duration in durations.

Basic example:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.even_division(durations, [8], extra_counts=[0, 0, 1])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.force_diminution(voice)
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = [(5, 16), (6, 16), (6, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Understanding the denominators argument to rmakers.even_division().

Fills tuplets with 16th notes and 8th notes, alternately:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.even_division(durations, [16, 8])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 16), (3, 8), (3, 4)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Fills tuplets with 8th notes:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.even_division(durations, [8])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 16), (3, 8), (3, 4)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

(Fills tuplets less than twice the duration of an eighth note with a single attack.)

Fills tuplets with quarter notes:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.even_division(durations, [4])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 16), (3, 8), (3, 4)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

(Fills tuplets less than twice the duration of a quarter note with a single attack.)

Fills tuplets with half notes:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.even_division(durations, [2])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 16), (3, 8), (3, 4)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

(Fills tuplets less than twice the duration of a half note with a single attack.)

Using rmakers.even_division() with the denominator keyword.

With denominator=None. Expresses tuplet ratios in the usual way with numerator and denominator relatively prime:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.even_division(
...         durations, [16], extra_counts=[4], denominator=None
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

With denominator=4:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.even_division(
...         durations, [16], extra_counts=[4], denominator=4
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

With denominator=8:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.even_division(
...         durations, [16], extra_counts=[4], denominator=8
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

With denominator=16:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.even_division(
...         durations, [16], extra_counts=[4], denominator=16
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

With denominator="from_counts":

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.even_division(
...         durations, [16], extra_counts=[4], denominator="from_counts"
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Using rmakers.even_division() with the extra_counts keyword.

Adds extra counts to tuplets according to a pattern of three elements:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.even_division(durations, [16], extra_counts=[0, 1, 2])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 8), (3, 8), (3, 8), (3, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Modular handling of positive values. Denote by unprolated_note_count the number counts included in a tuplet when extra_counts is set to zero. Then extra counts equals extra_counts % unprolated_note_count when extra_counts is positive.

This is likely to be intuitive; compare with the handling of negative values, below.

For positive extra counts, the modulus of transformation of a tuplet with six notes is six:

>>> import math
>>> unprolated_note_count = 6
>>> modulus = unprolated_note_count
>>> extra_counts = list(range(12))
>>> labels = []
>>> for count in extra_counts:
...     modular_count = count % modulus
...     label = rf"\markup {{ {count:3} becomes {modular_count:2} }}"
...     labels.append(label)
... 

Which produces the following pattern of changes:

>>> def make_lilypond_file(pairs, extra_counts):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.even_division(durations, [16], extra_counts=extra_counts)
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = 12 * [(6, 16)]
>>> lilypond_file = make_lilypond_file(pairs, extra_counts)
>>> staff = lilypond_file["Staff"]
>>> abjad.override(staff).TextScript.staff_padding = 7
>>> leaves = abjad.select.leaves(staff)
>>> groups = abjad.select.group_by_measure(leaves)
>>> for group, label in zip(groups, labels):
...     markup = abjad.Markup(label)
...     abjad.attach(markup, group[0], direction=abjad.UP)
... 
>>> abjad.show(lilypond_file)  

This modular formula ensures that rhythm-maker denominators are always respected: a very large number of extra counts never causes a 16-denominated tuplet to result in 32nd- or 64th-note rhythms.

Modular handling of negative values. Denote by unprolated_note_count the number of counts included in a tuplet when extra_counts is set to zero. Further, let modulus = ceiling(unprolated_note_count / 2). Then extra counts equals -(abs(extra_counts) % modulus) when extra_counts is negative.

For negative extra counts, the modulus of transformation of a tuplet with six notes is three:

>>> import math
>>> unprolated_note_count = 6
>>> modulus = math.ceil(unprolated_note_count / 2)
>>> extra_counts = [0, -1, -2, -3, -4, -5, -6, -7, -8]
>>> labels = []
>>> for count in extra_counts:
...     modular_count = -(abs(count) % modulus)
...     label = rf"\markup {{ {count:3} becomes {modular_count:2} }}"
...     labels.append(label)
... 

Which produces the following pattern of changes:

>>> def make_lilypond_file(pairs, extra_counts):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.even_division(durations, [16], extra_counts=extra_counts)
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = 9 * [(6, 16)]
>>> lilypond_file = make_lilypond_file(pairs, extra_counts)
>>> staff = lilypond_file["Staff"]
>>> abjad.override(staff).TextScript.staff_padding = 8
>>> leaves = abjad.select.leaves(staff)
>>> groups = abjad.select.group_by_measure(leaves)
>>> for group, label in zip(groups, labels):
...     markup = abjad.Markup(label)
...     abjad.attach(markup, group[0], direction=abjad.UP)
... 
>>> abjad.show(lilypond_file)  

This modular formula ensures that rhythm-maker denominators are always respected: a very small number of extra counts never causes a 16-denominated tuplet to result in 8th- or quarter-note rhythms.

Return type:

list[Tuplet]

abjadext.rmakers.makers.incised(durations, *, body_ratio=(1,), extra_counts=(), fill_with_rests=False, outer_tuplets_only=False, prefix_counts=(), prefix_talea=(), spelling=Spelling(forbidden_note_duration=None, forbidden_rest_duration=None, increase_monotonic=False), suffix_counts=(), suffix_talea=(), tag=None, talea_denominator=None)[source]

Makes one incised tuplet for each duration in durations.

Set prefix_talea=[-1] with prefix_counts=[1] to incise a rest at the start of each tuplet:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.incised(
...         durations,
...         prefix_talea=[-1],
...         prefix_counts=[1],
...         talea_denominator=16,
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = 4 * [(5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Set prefix_talea=[-1] with prefix_counts=[2] to incise 2 rests at the start of each tuplet:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.incised(
...         durations,
...         prefix_talea=[-1],
...         prefix_counts=[2],
...         talea_denominator=16,
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = 4 * [(5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Set prefix_talea=[1] with prefix_counts=[1] to incise 1 note at the start of each tuplet:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.incised(
...         durations,
...         prefix_talea=[1],
...         prefix_counts=[1],
...         talea_denominator=16,
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = 4 * [(5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Set prefix_talea=[1] with prefix_counts=[2] to incise 2 notes at the start of each tuplet:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.incised(
...         durations,
...         prefix_talea=[1],
...         prefix_counts=[2],
...         talea_denominator=16,
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = 4 * [(5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Incise rests at the beginning and end of each tuplet like this:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.incised(
...         durations,
...         extra_counts=[1],
...         prefix_talea=[-1],
...         prefix_counts=[1],
...         suffix_talea=[-1],
...         suffix_counts=[1],
...         talea_denominator=16,
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = 4 * [(5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Set body_ratio=(1, 1) to divide the middle part of each tuplet 1:1:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.incised(
...         durations,
...         body_ratio=(1, 1),
...         talea_denominator=16,
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = 4 * [(5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Set body_ratio=(1, 1, 1) to divide the middle part of each tuplet 1:1:1:

TODO. Allow nested tuplets to clean up notation:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.incised(
...         durations,
...         body_ratio=(1, 1, 1),
...         talea_denominator=16,
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = 4 * [(5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  
Return type:

list[Tuplet]

abjadext.rmakers.makers.multiplied_duration(durations, prototype=<class 'abjad.score.Note'>, *, duration=(1, 1), spelling=Spelling(forbidden_note_duration=None, forbidden_rest_duration=None, increase_monotonic=False), tag=None)[source]

Makes one leaf with multiplier for each duration in durations.

>>> time_signatures = rmakers.time_signatures([(1, 4), (3, 16), (5, 8), (1, 3)])
>>> durations = [abjad.Duration(_) for _ in time_signatures]
>>> components = rmakers.multiplied_duration(durations)
>>> lilypond_file = rmakers.example(components, time_signatures)
>>> abjad.show(lilypond_file)  

Makes multiplied-duration whole notes when duration is unset:

>>> time_signatures = rmakers.time_signatures([(1, 4), (3, 16), (5, 8), (1, 3)])
>>> durations = [abjad.Duration(_) for _ in time_signatures]
>>> components = rmakers.multiplied_duration(durations)
>>> lilypond_file = rmakers.example(components, time_signatures)
>>> abjad.show(lilypond_file)  

Makes multiplied-duration half notes when duration=(1, 2):

>>> time_signatures = rmakers.time_signatures([(1, 4), (3, 16), (5, 8), (1, 3)])
>>> durations = [abjad.Duration(_) for _ in time_signatures]
>>> components = rmakers.multiplied_duration(durations, duration=(1, 2))
>>> lilypond_file = rmakers.example(components, time_signatures)
>>> abjad.show(lilypond_file)  

Makes multiplied-duration quarter notes when duration=(1, 4):

>>> time_signatures = rmakers.time_signatures([(1, 4), (3, 16), (5, 8), (1, 3)])
>>> durations = [abjad.Duration(_) for _ in time_signatures]
>>> components = rmakers.multiplied_duration(durations, duration=(1, 4))
>>> lilypond_file = rmakers.example(components, time_signatures)
>>> abjad.show(lilypond_file)  

Makes multiplied-duration notes when prototype is unset:

>>> time_signatures = rmakers.time_signatures([(1, 4), (3, 16), (5, 8), (1, 3)])
>>> durations = [abjad.Duration(_) for _ in time_signatures]
>>> components = rmakers.multiplied_duration(durations)
>>> lilypond_file = rmakers.example(components, time_signatures)
>>> abjad.show(lilypond_file)  

Makes multiplied-duration rests when prototype=abjad.Rest:

>>> time_signatures = rmakers.time_signatures([(1, 4), (3, 16), (5, 8), (1, 3)])
>>> durations = [abjad.Duration(_) for _ in time_signatures]
>>> components = rmakers.multiplied_duration(durations, abjad.Rest)
>>> lilypond_file = rmakers.example(components, time_signatures)
>>> abjad.show(lilypond_file)  

Makes multiplied-duration multimeasures rests when prototype=abjad.MultimeasureRest:

>>> time_signatures = rmakers.time_signatures([(1, 4), (3, 16), (5, 8), (1, 3)])
>>> durations = [abjad.Duration(_) for _ in time_signatures]
>>> components = rmakers.multiplied_duration(durations, abjad.MultimeasureRest)
>>> lilypond_file = rmakers.example(components, time_signatures)
>>> abjad.show(lilypond_file)  

Makes multiplied-duration skips when prototype=abjad.Skip:

>>> time_signatures = rmakers.time_signatures([(1, 4), (3, 16), (5, 8), (1, 3)])
>>> durations = [abjad.Duration(_) for _ in time_signatures]
>>> components = rmakers.multiplied_duration(durations, abjad.Skip)
>>> lilypond_file = rmakers.example(components, time_signatures)
>>> abjad.show(lilypond_file)  
Return type:

list[Leaf]

abjadext.rmakers.makers.note(durations, *, spelling=Spelling(forbidden_note_duration=None, forbidden_rest_duration=None, increase_monotonic=False), tag=None)[source]

Makes one note for every duration in durations.

Silences every other logical tie:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     container = abjad.Container(components)
...     logical_ties = abjad.select.logical_ties(container)
...     logical_ties = abjad.select.get(logical_ties, [0], 2)
...     rmakers.force_rest(logical_ties)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Forces rest at every logical tie:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     container = abjad.Container(components)
...     logical_ties = abjad.select.logical_ties(container)
...     rmakers.force_rest(logical_ties)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(4, 8), (3, 8), (4, 8), (5, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Force-rests every other note, except for the first and last:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     container = abjad.Container(components)
...     logical_ties = abjad.select.logical_ties(container)
...     logical_ties = abjad.select.get(logical_ties, [0], 2)[1:-1]
...     rmakers.force_rest(logical_ties)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(4, 8), (3, 8), (4, 8), (3, 8), (2, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Beams the notes in each duration:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     lilypond_file = rmakers.example(components, time_signatures)
...     voice = lilypond_file["Voice"]
...     logical_ties = abjad.select.logical_ties(voice, pitched=True)
...     rmakers.beam(logical_ties)
...     return lilypond_file
... 
>>> pairs = [(5, 32), (5, 32)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Beams notes grouped by durations:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     lilypond_file = rmakers.example(components, time_signatures)
...     voice = lilypond_file["Voice"]
...     logical_ties = abjad.select.logical_ties(voice)
...     rmakers.beam_groups(logical_ties)
...     return lilypond_file
... 
>>> pairs = [(5, 32), (5, 32)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Makes no beams:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     container = abjad.Container(components)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(5, 32), (5, 32)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Does not tie across durations:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     container = abjad.Container(components)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Ties across durations:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     container = abjad.Container(components)
...     logical_ties = abjad.select.logical_ties(container)[:-1]
...     leaves = [abjad.select.leaf(_, -1) for _ in logical_ties]
...     rmakers.tie(leaves)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Ties across every other logical tie:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     container = abjad.Container(components)
...     logical_ties = abjad.select.logical_ties(container)[:-1]
...     logical_ties = abjad.select.get(logical_ties, [0], 2)
...     leaves = [abjad.select.leaf(_, -1) for _ in logical_ties]
...     rmakers.tie(leaves)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(4, 8), (3, 8), (4, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Strips all ties:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     container = abjad.Container(components)
...     rmakers.untie(container)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(7, 16), (1, 4), (5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Spells tuplets as diminutions:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     container = abjad.Container(components)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(5, 14), (3, 7)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Spells tuplets as augmentations:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     container = abjad.Container(components)
...     rmakers.force_augmentation(container)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(5, 14), (3, 7)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Forces rest in logical tie 0:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     container = abjad.Container(components)
...     logical_tie = abjad.select.logical_tie(container, 0)
...     rmakers.force_rest(logical_tie)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(5, 8), (2, 8), (2, 8), (5, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Forces rests in first two logical ties:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     container = abjad.Container(components)
...     logical_tie = abjad.select.logical_ties(container)[:2]
...     rmakers.force_rest(logical_tie)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(5, 8), (2, 8), (2, 8), (5, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Forces rests in first and last logical ties:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     container = abjad.Container(components)
...     logical_ties = abjad.select.logical_ties(container)
...     logical_ties = abjad.select.get(logical_ties, [0, -1])
...     rmakers.force_rest(logical_ties)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(5, 8), (2, 8), (2, 8), (5, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Rewrites meter:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     nested_music = rmakers.note(durations)
...     components = abjad.sequence.flatten(nested_music)
...     voice = rmakers.wrap_in_time_signature_staff(components, time_signatures)
...     rmakers.rewrite_meter(voice)
...     components = abjad.mutate.eject_contents(voice)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(3, 4), (6, 16), (9, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  
Return type:

list[Leaf | Tuplet]

abjadext.rmakers.makers.talea(durations, counts, denominator, *, advance=0, end_counts=(), extra_counts=(), preamble=(), previous_state=None, read_talea_once_only=False, spelling=Spelling(forbidden_note_duration=None, forbidden_rest_duration=None, increase_monotonic=False), state=None, tag=None)[source]

Reads counts cyclically and makes one tuplet for each duration in durations.

Repeats talea of 1/16, 2/16, 3/16, 4/16:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.talea(durations, [1, 2, 3, 4], 16)
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 8), (4, 8), (3, 8), (4, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Using rmakers.talea() with the extra_counts keyword.

>>> def make_lilypond_file(pairs, extra_counts):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.talea(
...         durations,
...         [1, 2, 3, 4],
...         16,
...         extra_counts=extra_counts,
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.swap_trivial(voice)
...     return lilypond_file
... 

#1. Set extra_counts=[0, 1] to add one extra count to every other tuplet:

>>> pairs = [(3, 8), (4, 8), (3, 8), (4, 8)]
>>> lilypond_file = make_lilypond_file(pairs, extra_counts=[0, 1])
>>> abjad.show(lilypond_file)  

#2. Set extra_counts=[0, 2] to add two extra counts to every other tuplet:

>>> pairs = [(3, 8), (4, 8), (3, 8), (4, 8)]
>>> lilypond_file = make_lilypond_file(pairs, extra_counts=[0, 2])
>>> abjad.show(lilypond_file)  

#3. Set extra_counts=[0, -1] to remove one count from every other tuplet:

>>> pairs = [(3, 8), (4, 8), (3, 8), (4, 8)]
>>> lilypond_file = make_lilypond_file(pairs, extra_counts=[0, -1])
>>> abjad.show(lilypond_file)  

Reading talea once only. Set read_talea_once_only=True to raise an exception if input durations exceed that of a single reading of talea. The effect is to ensure that a talea is long enough to cover all durations without repeating. Useful when, for example, interpolating from short durations to long durations.

Using rmakers.talea() with the preamble keyword.

Preamble less than total duration:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.talea(durations, [8, -4, 8], 32, preamble=[1, 1, 1, 1])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 8), (4, 8), (3, 8), (4, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Preamble more than total duration; ignores counts:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.talea(
...         durations, [8, -4, 8], 32, preamble=[32, 32, 32, 32]
...     )
...     container = abjad.Container(tuplets)
...     rmakers.beam(container)
...     rmakers.extract_trivial(container)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(3, 8), (4, 8), (3, 8), (4, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Using rmakers.talea() with the end_counts keyword.

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.talea(durations, [8, -4, 8], 32, end_counts=[1, 1, 1, 1])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 8), (4, 8), (3, 8), (4, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

REGRESSION. End counts leave 5-durated tie in tact:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.talea(durations, [6], 16, end_counts=[1])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  
Return type:

list[Tuplet]

abjadext.rmakers.makers.tuplet(durations, tuplet_ratios, *, denominator=None, spelling=Spelling(forbidden_note_duration=None, forbidden_rest_duration=None, increase_monotonic=False), tag=None)[source]

Makes one tuplet for each duration in durations.

Makes tuplets with 3:2 ratios:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(3, 2)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(1, 2), (3, 8), (5, 16), (5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Makes tuplets with alternating 1:-1 and 3:1 ratios:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, -1), (3, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(1, 2), (3, 8), (5, 16), (5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Beams each tuplet:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 1, 1, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(5, 8), (3, 8), (6, 8), (4, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Beams each tuplet:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 1, 1, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(5, 8), (3, 8), (6, 8), (4, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Beams tuplets together:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 1, 2, 1, 1), (3, 1, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     rmakers.beam_groups(tuplets)
...     return lilypond_file
... 
>>> pairs = [(5, 8), (3, 8), (6, 8), (4, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Ties nothing:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(2, 3), (1, -2, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(1, 2), (3, 8), (5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Ties across all tuplets:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(2, 3), (1, -2, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     tuplets = abjad.select.tuplets(voice)[:-1]
...     leaves = [abjad.select.leaf(_, -1) for _ in tuplets]
...     rmakers.tie(leaves)
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(1, 2), (3, 8), (5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Ties across every other tuplet:

>>> def make_lilypond_file(durations):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(2, 3), (1, -2, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     tuplets = abjad.select.tuplets(voice)[:-1]
...     tuplets = abjad.select.get(tuplets, [0], 2)
...     leaves = [abjad.select.leaf(_, -1) for _ in tuplets]
...     rmakers.tie(leaves)
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(1, 2), (3, 8), (5, 16), (5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Makes diminished tuplets:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(2, 1)])
...     container = abjad.Container(tuplets)
...     rmakers.force_diminution(container)
...     rmakers.beam(container)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(2, 8), (2, 8), (4, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Makes augmented tuplets:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(2, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.force_augmentation(voice)
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(2, 8), (2, 8), (4, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Makes diminished tuplets and does not rewrite dots:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.force_diminution(voice)
...     return lilypond_file
... 
>>> pairs = [(2, 8), (3, 8), (7, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Makes diminished tuplets and rewrites dots:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.rewrite_dots(voice)
...     rmakers.force_diminution(voice)
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(2, 8), (3, 8), (7, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Makes augmented tuplets and does not rewrite dots:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.force_augmentation(voice)
...     return lilypond_file
... 
>>> pairs = [(2, 8), (3, 8), (7, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Makes augmented tuplets and rewrites dots:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.rewrite_dots(voice)
...     rmakers.force_augmentation(voice)
...     return lilypond_file
... 
>>> pairs = [(2, 8), (3, 8), (7, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Leaves trivializable tuplets as-is when trivialize is false:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(3, -2), (1,), (-2, 3), (1, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.rewrite_dots(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 8), (3, 8), (3, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Rewrites trivializable tuplets when trivialize is true. Measures 2 and 4 contain trivial tuplets with 1:1 ratios. To remove these trivial tuplets, set extract_trivial as shown in the next example:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(3, -2), (1,), (-2, 3), (1, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.trivialize(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 8), (3, 8), (3, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

REGRESSION: Ignores trivialize and respects rewrite_dots when both are true. Measures 2 and 4 are first rewritten as trivial but then supplied again with nontrivial prolation when removing dots. The result is that measures 2 and 4 carry nontrivial prolation with no dots:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(3, -2), (1,), (-2, 3), (1, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.trivialize(voice)
...     rmakers.rewrite_dots(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 8), (3, 8), (3, 8), (3, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Leaves trivial tuplets as-is when extract_trivial is false:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(2, 3), (1, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     tuplets = abjad.select.tuplets(voice)[:-1]
...     leaves = [abjad.select.leaf(_, -1) for _ in tuplets]
...     rmakers.tie(leaves)
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 8), (2, 8), (3, 8), (2, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Extracts trivial tuplets when extract_trivial is true. Measures 2 and 4 in the example below now contain only a flat list of notes:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(2, 3), (1, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     tuplets = abjad.select.tuplets(voice)[:-1]
...     leaves = [abjad.select.leaf(_, -1) for _ in tuplets]
...     rmakers.tie(leaves)
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 8), (2, 8), (3, 8), (2, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Note

Flattening trivial tuplets makes it possible subsequently to rewrite the meter of the untupletted notes.

REGRESSION: Very long ties are preserved when extract_trivial is true:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(2, 3), (1, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     notes = abjad.select.notes(voice)[:-1]
...     rmakers.tie(notes)
...     return lilypond_file
... 
>>> pairs = [(3, 8), (2, 8), (3, 8), (2, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Force-rests every other tuplet:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(4, 1)])
...     container = abjad.Container(tuplets)
...     tuplets = abjad.select.tuplets(container)
...     tuplets = abjad.select.get(tuplets, [1], 2)
...     rmakers.force_rest(tuplets)
...     rmakers.rewrite_rest_filled(container)
...     rmakers.extract_trivial(container)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(3, 8), (4, 8), (3, 8), (4, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Tuplet numerators and denominators are reduced to numbers that are relatively prime when denominator is set to none. This means that ratios like 6:4 and 10:8 do not arise:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 4)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.rewrite_dots(voice)
...     return lilypond_file
... 
>>> pairs = [(2, 16), (4, 16), (6, 16), (8, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

The preferred denominator of each tuplet is set in terms of a unit duration when denominator is set to a duration. The setting does not affect the first tuplet:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 4)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.rewrite_dots(voice)
...     rmakers.denominator(voice, (1, 16))
...     return lilypond_file
... 
>>> pairs = [(2, 16), (4, 16), (6, 16), (8, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Sets the preferred denominator of each tuplet in terms 32nd notes. The setting affects all tuplets:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 4)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.rewrite_dots(voice)
...     rmakers.denominator(voice, (1, 32))
...     return lilypond_file
... 
>>> pairs = [(2, 16), (4, 16), (6, 16), (8, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Sets the preferred denominator each tuplet in terms 64th notes. The setting affects all tuplets:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 4)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.rewrite_dots(voice)
...     rmakers.denominator(voice, (1, 64))
...     return lilypond_file
... 
>>> pairs = [(2, 16), (4, 16), (6, 16), (8, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

The preferred denominator of each tuplet is set directly when denominator is set to a positive integer. This example sets the preferred denominator of each tuplet to 8. Setting does not affect the third tuplet:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 4)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.rewrite_dots(voice)
...     rmakers.denominator(voice, 8)
...     return lilypond_file
... 
>>> pairs = [(2, 16), (4, 16), (6, 16), (8, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Sets the preferred denominator of each tuplet to 12. Setting affects all tuplets:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 4)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.rewrite_dots(voice)
...     rmakers.denominator(voice, 12)
...     return lilypond_file
... 
>>> pairs = [(2, 16), (4, 16), (6, 16), (8, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Sets the preferred denominator of each tuplet to 13. Setting does not affect any tuplet:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, 4)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.rewrite_dots(voice)
...     rmakers.denominator(voice, 13)
...     return lilypond_file
... 
>>> pairs = [(2, 16), (4, 16), (6, 16), (8, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  
>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tag = abjad.Tag("TUPLET_RHYTHM_MAKER")
...     tuplets = rmakers.tuplet(durations, [(3, 2)], tag=tag)
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice, tag=tag)
...     return lilypond_file
... 
>>> pairs = [(1, 2), (3, 8), (5, 16), (5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Makes tuplets with 3:2 ratios:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(3, 2)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(1, 2), (3, 8), (5, 16), (5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Makes tuplets with alternating 1:-1 and 3:1 ratios:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1, -1), (3, 1)])
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     return lilypond_file
... 
>>> pairs = [(1, 2), (3, 8), (5, 16), (5, 16)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Makes length-1 tuplets:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.tuplet(durations, [(1,)])
...     container = abjad.Container(tuplets)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(1, 5), (1, 4), (1, 6), (7, 9)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  
Return type:

list[Tuplet]