SilenceMask

class rhythmmakertools.SilenceMask(pattern=None, use_multimeasure_rests=None)

Silence mask.

>>> import abjad
>>> from abjad.tools import rhythmmakertools
>>> pattern = abjad.index_every([0, 1, 7], period=16)
>>> mask = rhythmmakertools.SilenceMask(pattern)
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(
        indices=[0, 1, 7],
        period=16,
        ),
    )

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.SilenceMask.SilenceMask" [color=black, fontcolor=white, group=2, label=<<B>SilenceMask</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" -> "abjad.tools.rhythmmakertools.SilenceMask.SilenceMask"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

pattern Gets pattern.
silence([indices, inverted]) Makes silence mask that matches indices.
silence_all([inverted, use_multimeasure_rests]) Makes silence that matches all indices.
silence_every(indices[, period, inverted, …]) Makes silence mask that matches indices at period.
silence_except([indices]) Makes silence mask that matches all indices except indices.
silence_first([n, inverted, …]) Makes silence mask that matches the first n indices.
silence_last([n, inverted, …]) Makes silence mask that matches the last n indices.
use_multimeasure_rests Is true when silence mask should use multimeasure rests.
__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 Abjad object.
__hash__() Hashes Abjad value object.
__ne__(argument) Is true when Abjad object does not equal argument.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

SilenceMask.pattern

Gets pattern.

Returns pattern.

SilenceMask.use_multimeasure_rests

Is true when silence mask should use multimeasure rests.

Without multimeasure rests:

>>> mask = rhythmmakertools.SilenceMask(
...     abjad.index_every([0, 1, 7], period=16),
...     use_multimeasure_rests=False,
...     )
>>> mask.use_multimeasure_rests
False

With multimeasure rests:

>>> mask = rhythmmakertools.SilenceMask(
...     abjad.index_every([0, 1, 7], period=16),
...     use_multimeasure_rests=True,
...     )
>>> mask.use_multimeasure_rests
True

Set to true, false or none.

Class & static methods

static SilenceMask.silence(indices=None, inverted=None)

Makes silence mask that matches indices.

Silences divisions 1 and 2:

>>> mask = abjad.silence([1, 2])
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(
        indices=[1, 2],
        ),
    )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[mask],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences divisions -1 and -2:

>>> mask = abjad.silence([-1, -2])
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(
        indices=[-1, -2],
        ),
    )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[
...         mask,
...         ],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Works with pattern input:

>>> pattern_1 = abjad.index_all()
>>> pattern_2 = abjad.index_first()
>>> pattern_3 = abjad.index_last()
>>> pattern = pattern_1 ^ pattern_2 ^ pattern_3
>>> mask = abjad.silence(pattern)
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(
        operator='xor',
        patterns=(
            abjad.Pattern(
                indices=[0],
                period=1,
                ),
            abjad.Pattern(
                indices=[0],
                ),
            abjad.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 = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Works with pattern input and inverted flag:

>>> pattern_1 = abjad.index_all()
>>> pattern_2 = abjad.index_first()
>>> pattern_3 = abjad.index_last()
>>> pattern = pattern_1 ^ pattern_2 ^ pattern_3
>>> mask = abjad.silence(pattern, inverted=True)
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(
        inverted=True,
        operator='xor',
        patterns=(
            abjad.Pattern(
                indices=[0],
                period=1,
                ),
            abjad.Pattern(
                indices=[0],
                ),
            abjad.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 = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Returns silence mask.

static SilenceMask.silence_all(inverted=None, use_multimeasure_rests=None)

Makes silence that matches all indices.

Silences all divisions:

>>> mask = abjad.silence_all()
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(
        indices=[0],
        period=1,
        ),
    )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[mask],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences all divisions with multimeasure rests:

>>> mask = abjad.silence_all(
...     use_multimeasure_rests=True,
...     )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[mask],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Returns silence mask.

static SilenceMask.silence_every(indices, period=None, inverted=None, use_multimeasure_rests=None)

Makes silence mask that matches indices at period.

Silences every second division:

>>> mask = abjad.silence_every(indices=[1], period=2)
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.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 = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences every second and third division:

>>> mask = abjad.silence_every(indices=[1, 2], period=3)
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.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 = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences every division except the last:

>>> mask = abjad.silence_every(indices=[-1], inverted=True)
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(
        indices=[-1],
        inverted=True,
        ),
    )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[mask],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Returns silence mask.

static SilenceMask.silence_except(indices=None)

Makes silence mask that matches all indices except indices.

Silences divisions except 1 and 2:

>>> mask = abjad.silence_except([1, 2])
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(
        indices=[1, 2],
        inverted=True,
        ),
    )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[mask],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences divisions except -1 and -2:

>>> mask = abjad.silence_except([-1, -2])
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(
        indices=[-1, -2],
        inverted=True,
        ),
    )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[
...         mask,
...         ],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Works with pattern input:

>>> pattern_1 = abjad.index_all()
>>> pattern_2 = abjad.index_first()
>>> pattern_3 = abjad.index_last()
>>> pattern = pattern_1 ^ pattern_2 ^ pattern_3
>>> mask = abjad.silence_except(pattern)
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(
        inverted=True,
        operator='xor',
        patterns=(
            abjad.Pattern(
                indices=[0],
                period=1,
                ),
            abjad.Pattern(
                indices=[0],
                ),
            abjad.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 = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Equivalent to silence(..., inverted=True).

Returns silence mask.

static SilenceMask.silence_first(n=1, inverted=None, use_multimeasure_rests=None)

Makes silence mask that matches the first n indices.

Silences first division:

>>> mask = abjad.silence_first()
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(
        indices=[0],
        ),
    )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[mask],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences first two divisions:

>>> mask = abjad.silence_first(n=2)
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(
        indices=[0, 1],
        ),
    )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[mask],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences no first divisions:

>>> mask = abjad.silence_first(n=0)
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(),
    )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[mask],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Returns silence mask.

static SilenceMask.silence_last(n=1, inverted=None, use_multimeasure_rests=None)

Makes silence mask that matches the last n indices.

Silences last division:

>>> mask = abjad.silence_last()
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.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 = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences last two divisions:

>>> mask = abjad.silence_last(n=2)
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.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 = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Silences no last divisions:

>>> mask = abjad.silence_last(n=0)
>>> f(mask)
rhythmmakertools.SilenceMask(
    pattern=abjad.Pattern(),
    )
>>> rhythm_maker = rhythmmakertools.NoteRhythmMaker(
...     division_masks=[mask],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> show(lilypond_file) 

Returns silence mask.

Special methods

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

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

(AbjadObject).__ne__(argument)

Is true when Abjad object does not equal argument. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.