silence_last

rhythmmakertools.silence_last(n=1, inverted=None, use_multimeasure_rests=None)

Makes silence mask that matches the last n indices.

Example 1. Silences last division:

>>> mask = rhythmmakertools.silence_last()
>>> print(format(mask))
rhythmmakertools.SilenceMask(
    pattern=patterntools.Pattern(
        indices=(-1,),
        ),
    )
>>> 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. Silences last two divisions:

>>> mask = rhythmmakertools.silence_last(n=2)
>>> print(format(mask))
rhythmmakertools.SilenceMask(
    pattern=patterntools.Pattern(
        indices=(-2, -1),
        ),
    )
>>> 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 3. Silences no last divisions:

>>> mask = rhythmmakertools.silence_last(n=0)
>>> print(format(mask))
rhythmmakertools.SilenceMask(
    pattern=patterntools.Pattern(
        indices=(),
        ),
    )
>>> 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 silence mask.