def test_scoretools_Inspection_has_indicator_05():

    staff = abjad.Staff("c'2 d'2")
    stem_tremolo = abjad.StemTremolo(16)
    abjad.attach(stem_tremolo, staff[0])

    assert abjad.inspect(staff[0]).has_indicator(abjad.StemTremolo)
    assert not abjad.inspect(staff[1]).has_indicator(abjad.StemTremolo)
Пример #2
0
def test_Inspection_indicators_05():

    note = abjad.Note("c'4")
    stem_tremolo = abjad.StemTremolo(16)
    abjad.attach(stem_tremolo, note)
    stem_tremolos = abjad.inspect(note).indicators(abjad.StemTremolo)

    assert stem_tremolos[0] is stem_tremolo
Пример #3
0
 def test__add_stem_tremolo(self):
     voice = abjad.Voice("c'1")
     tie = abjad.inspect(voice[0]).get_logical_tie()
     self.handler._add_stem_tremolo(tie, tremolo_flags=32)
     prototype = abjad.StemTremolo(32)
     self.assertEqual(
         prototype,
         abjad.inspect(voice[0]).get_indicator(prototype=prototype))
Пример #4
0
def test_get_has_indicator_05():

    staff = abjad.Staff("c'2 d'2")
    stem_tremolo = abjad.StemTremolo(16)
    abjad.attach(stem_tremolo, staff[0])

    assert abjad.get.has_indicator(staff[0], abjad.StemTremolo)
    assert not abjad.get.has_indicator(staff[1], abjad.StemTremolo)
def test_scoretools_Inspection_get_indicator_13():

    note = abjad.Note("c'4")
    stem_tremolo = abjad.StemTremolo(16)
    abjad.attach(stem_tremolo, note)
    stem_tremolo = abjad.inspect(note).get_indicator(abjad.StemTremolo)

    assert stem_tremolo is stem_tremolo
def test_mutate__fuse_leaves_by_immediate_parent_10():
    """
    Fuse leaves in logical tie with same immediate parent, with an indicator at
    every leaf of the logical tie after fusing.
    """

    staff = abjad.Staff(r"c'16 ~ c'16 ~ c'16 ~ c'16 ~ c'16 r16 r16 r16 r4 r4")
    indicators = (
        abjad.BeforeGraceContainer("b'16"),
        abjad.Clef("alto"),
        abjad.TimeSignature((3, 4)),
        abjad.Articulation("staccato"),
        abjad.Articulation("accent"),
        abjad.StemTremolo(16),
    )
    for indicator in indicators:
        abjad.attach(indicator, staff[0])
    logical_tie = abjad.get.logical_tie(staff[0])
    result = abjad.mutate._fuse_leaves_by_immediate_parent(logical_tie)

    assert abjad.lilypond(staff) == abjad.String.normalize(
        r"""
        \new Staff
        {
            \grace {
                b'16
            }
            \time 3/4
            \clef "alto"
            c'4
            :16
            - \staccato
            - \accent
            ~
            c'16
            :16
            r16
            r16
            r16
            r4
            r4
        }
        """
    ), print(abjad.lilypond(staff))

    assert abjad.wf.wellformed(staff)
    assert len(result) == 1
def test_LilyPondParser__indicators__StemTremolo_01():

    target = abjad.Staff([abjad.Note(0, 1)])
    stem_tremolo = abjad.StemTremolo(4)
    abjad.attach(stem_tremolo, target[0])

    assert format(target) == abjad.String.normalize(r"""
        \new Staff
        {
            c'1
            :4
        }
        """)

    parser = abjad.parser.LilyPondParser()
    result = parser(format(target))
    assert format(target) == format(result) and target is not result
    stem_tremolos = abjad.inspect(result[0]).indicators(abjad.StemTremolo)
    assert 1 == len(stem_tremolos)
Пример #8
0
def _add_tremolos(selections):
    for leaf in abjad.Selection(selections).leaves(pitched=True):
        tremolo = abjad.StemTremolo(32)
        abjad.attach(tremolo, leaf)
Пример #9
0
 def attach(self, leaf: abjad.Chord, novent) -> None:
     abjad.attach(
         abjad.StemTremolo(32 * (2**leaf.written_duration.flag_count)),
         leaf)
Пример #10
0
     ),
     baca.selectors.leaf(0),
 ),
 evans.attach(
     "Voice 3",
     abjad.Articulation("snappizzicato"),
     baca.selectors.leaf(1),
 ),
 evans.attach(
     "Voice 3",
     abjad.Markup(r"\markup { slow bow }", direction=abjad.Up),
     baca.selectors.leaf(2),
 ),
 evans.attach(
     "Voice 4",
     abjad.StemTremolo(32),
     baca.selectors.leaf(2),
 ),
 evans.attach(
     "Voice 4",
     abjad.Dynamic("f"),
     baca.selectors.leaf(2),
 ),
 evans.attach(
     "Voice 4",
     abjad.LilyPondLiteral(
         r"^ \markup { clt. \raise #0.75 \baca-circle-very-wide-markup }",
         format_slot="after",
     ),
     baca.selectors.leaf(3),
 ),