SilenceMask

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=1]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjadext/rmakers/../../abjad/system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; "abjad.system.AbjadValueObject.AbjadValueObject" [URL="../api/abjadext/rmakers/../../abjad/system/AbjadValueObject.html#abjad.system.AbjadValueObject.AbjadValueObject", label="Abjad\nValue\nObject", target=_top]; "abjad.system.AbjadObject.AbjadObject" -> "abjad.system.AbjadValueObject.AbjadValueObject"; } subgraph "cluster_abjadext.rmakers" { graph [label="abjadext.rmakers"]; node [color=2]; "abjadext.rmakers.SilenceMask.SilenceMask" [URL="../api/abjadext/rmakers/SilenceMask.html#abjadext.rmakers.SilenceMask.SilenceMask", color=black, fontcolor=white, label="Silence\nMask", target=_top]; } subgraph cluster_builtins { graph [label=builtins]; node [color=3]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } "abjad.system.AbjadValueObject.AbjadValueObject" -> "abjadext.rmakers.SilenceMask.SilenceMask"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjadext.rmakers.SilenceMask.SilenceMask(pattern=None, *, template=None, use_multimeasure_rests=None)

Silence mask.

>>> pattern = abjad.index([0, 1, 7], 16)
>>> mask = abjadext.rmakers.SilenceMask(pattern)
>>> abjad.f(mask)
abjadext.rmakers.SilenceMask(
    pattern=abjad.index([0, 1, 7], period=16),
    )

With composite pattern:

>>> pattern_1 = abjad.index_all()
>>> pattern_2 = abjad.index_first(1)
>>> pattern_3 = abjad.index_last(1)
>>> pattern = pattern_1 ^ pattern_2 ^ pattern_3
>>> mask = abjadext.rmakers.SilenceMask(pattern)
>>> abjad.f(mask)
abjadext.rmakers.SilenceMask(
    pattern=abjad.Pattern(
        operator='xor',
        patterns=(
            abjad.index_all(),
            abjad.index_first(1),
            abjad.index_last(1),
            ),
        ),
    )
>>> rhythm_maker = abjadext.rmakers.NoteRhythmMaker(
...     division_masks=[
...         mask,
...         ],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> abjad.show(lilypond_file) 

With inverted composite pattern:

>>> pattern_1 = abjad.index_all()
>>> pattern_2 = abjad.index_first(1)
>>> pattern_3 = abjad.index_last(1)
>>> pattern = pattern_1 ^ pattern_2 ^ pattern_3
>>> pattern = ~pattern
>>> mask = abjadext.rmakers.SilenceMask(pattern)
>>> abjad.f(mask)
abjadext.rmakers.SilenceMask(
    pattern=abjad.Pattern(
        inverted=True,
        operator='xor',
        patterns=(
            abjad.index_all(),
            abjad.index_first(1),
            abjad.index_last(1),
            ),
        ),
    )
>>> rhythm_maker = abjadext.rmakers.NoteRhythmMaker(
...     division_masks=[
...         mask,
...         ],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> abjad.show(lilypond_file) 

Attributes Summary

__invert__ Inverts pattern.
pattern Gets pattern.
silence Makes silence mask that matches indices.
template Gets template.
use_multimeasure_rests Is true when silence mask should use multimeasure rests.

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.

__invert__()

Inverts pattern.

Return type:SilenceMask
(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.


Class & static methods

static silence(indices, period=None, inverted=None, use_multimeasure_rests=None)

Makes silence mask that matches indices.

Silences divisions 1 and 2:

>>> mask = abjadext.rmakers.silence([1, 2])
>>> mask
abjadext.rmakers.silence([1, 2])
>>> rhythm_maker = abjadext.rmakers.NoteRhythmMaker(
...     division_masks=[mask],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> abjad.show(lilypond_file) 

Silences divisions -1 and -2:

>>> mask = abjadext.rmakers.silence([-1, -2])
>>> mask
abjadext.rmakers.silence([-1, -2])
>>> rhythm_maker = abjadext.rmakers.NoteRhythmMaker(
...     division_masks=[
...         mask,
...         ],
...     )
>>> divisions = [(7, 16), (3, 8), (7, 16), (3, 8)]
>>> selections = rhythm_maker(divisions)
>>> lilypond_file = abjad.LilyPondFile.rhythm(
...     selections,
...     divisions,
...     )
>>> abjad.show(lilypond_file) 
Return type:SilenceMask

Read-only properties

pattern

Gets pattern.

Return type:Pattern
template

Gets template.

Return type:Optional[str]
use_multimeasure_rests

Is true when silence mask should use multimeasure rests.

Without multimeasure rests:

>>> mask = abjadext.rmakers.SilenceMask(
...     abjad.index([0, 1, 7], 16),
...     use_multimeasure_rests=False,
...     )
>>> mask.use_multimeasure_rests
False

With multimeasure rests:

>>> mask = abjadext.rmakers.SilenceMask(
...     abjad.index([0, 1, 7], 16),
...     use_multimeasure_rests=True,
...     )
>>> mask.use_multimeasure_rests
True
Return type:Optional[bool]