Example #1
0
    def test_tie_break(self):
        print('test tie break')
        a = Note(DiatonicPitch(3, 'a'), Duration(1, 8))
        b = Note(DiatonicPitch(3, 'b'), Duration(1, 8))
        c = Note(DiatonicPitch(3, 'c'), Duration(1, 8))
        d = Note(DiatonicPitch(3, 'a'), Duration(1, 8))
        sub_beam = Beam([b, c])

        tuplet = Tuplet(Duration(1, 8), 2, [a, d])
        a.tie()
        assert a.is_tied_to
        assert d.is_tied_from

        tuplet.add(sub_beam, 1)

        assert not a.is_tied_to
        assert not d.is_tied_from
Example #2
0
    def test_dilation(self):
        print('test dilation')

        a = Note(DiatonicPitch(3, 'a'), Duration(1, 8))
        b = Note(DiatonicPitch(3, 'b'), Duration(1, 8))
        c = Note(DiatonicPitch(3, 'c'), Duration(1, 8))
        d = Note(DiatonicPitch(3, 'd'), Duration(1, 8))
        e = Note(DiatonicPitch(3, 'e'), Duration(1, 8))

        tuplet = Tuplet(Duration(1, 8), 2, [a, b, c])
        sub_beam = Beam([tuplet])

        beam = Beam([d, sub_beam, e])

        AbstractNote.print_structure(beam)

        f = Note(DiatonicPitch(3, 'f'), Duration(1, 8))
        tuplet.add(f, 2)

        AbstractNote.print_structure(beam)

        print('end test dilation')