Exemplo n.º 1
0
    def __call__(self, q_events):
        r'''Calls concatenating grace handler.
        '''
        from abjad.tools import quantizationtools

        grace_events, final_event = q_events[:-1], q_events[-1]

        if isinstance(final_event, quantizationtools.PitchedQEvent):
            pitches = final_event.pitches
        else:
            pitches = ()

        if grace_events:
            grace_container = scoretools.GraceContainer()
            for q_event in grace_events:
                if isinstance(q_event, quantizationtools.PitchedQEvent):
                    if len(q_event.pitches) == 1:
                        leaf = scoretools.Note(q_event.pitches[0],
                                               self.grace_duration)
                    else:
                        leaf = scoretools.Chord(q_event.pitches,
                                                self.grace_duration)
                else:
                    leaf = scoretools.Rest(self.grace_duration)
                grace_container.append(leaf)
        else:
            grace_container = None

        return pitches, grace_container
Exemplo n.º 2
0
 def grace(self, music):
     r'''Handles LilyPond ``\grace`` command.
     '''
     assert isinstance(music, scoretools.Container)
     leaves = music[:]
     music[:] = []
     return scoretools.GraceContainer(leaves)
Exemplo n.º 3
0
 def grace(self, music):
     r'''Handles LilyPond ``\grace`` command.
     '''
     return scoretools.GraceContainer(music[:])
Exemplo n.º 4
0
 def appoggiatura(self, music):
     r'''Handles LilyPond ``\appoggiatura`` command.
     '''
     grace = scoretools.GraceContainer(music[:])
     grace.kind = 'appoggiatura'
     return grace
Exemplo n.º 5
0
 def slashed_grace_container(self, music):
     r'''Handles LilyPond ``\slahsedGrace`` command.
     '''
     grace = scoretools.GraceContainer(music[:])
     grace.kind = 'slashedGrace'
     return grace