sustain_every

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

Makes sustain mask that matches indices at period.

Sustains every second division:

>>> mask = rhythmmakertools.sustain_every(indices=[1], period=2)
>>> f(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) 

Sustains every second and third division:

>>> mask = rhythmmakertools.sustain_every(indices=[1, 2], period=3)
>>> f(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.