sustain_every

rhythmmakertools.sustain_every(indices, period, inverted=None)

Makes sustain mask that matches indices at period.

Example 1. Sustains every second division:

>>> mask = rhythmmakertools.sustain_every(indices=[1], period=2)
>>> print(format(mask))
rhythmmakertools.SustainMask(
    pattern=patterntools.Pattern(
        indices=(1,),
        period=2,
        ),
    )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[mask],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = rhythmmakertools.make_lilypond_file(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Example 2. Sustains every second and third division:

>>> mask = rhythmmakertools.sustain_every(indices=[1, 2], period=3)
>>> print(format(mask))
rhythmmakertools.SustainMask(
    pattern=patterntools.Pattern(
        indices=(1, 2),
        period=3,
        ),
    )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[mask],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = rhythmmakertools.make_lilypond_file(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Returns sustain mask.