Exemplo n.º 1
0
 def _get_annotations(self, leaf):
     inspector = inspect_(leaf)
     bend_after = None
     prototype = indicatortools.BendAfter
     if inspector.has_indicator(prototype):
         bend_after = inspector.get_indicator(prototype)
     return bend_after
Exemplo n.º 2
0
 def _get_annotations(self, leaf):
     inspector = inspect_(leaf)
     bend_after = None
     prototype = indicatortools.BendAfter
     if inspector.has_indicator(prototype):
         bend_after = inspector.get_indicator(prototype)
     return bend_after
Exemplo n.º 3
0
 def _previous_leaf_changes_current_pitch(leaf):
     previous_leaf = inspect_(leaf).get_leaf(n=-1)
     if (isinstance(leaf, scoretools.Note)
             and isinstance(previous_leaf, scoretools.Note)
             and leaf.written_pitch == previous_leaf.written_pitch):
         return False
     elif (isinstance(leaf, scoretools.Chord)
           and isinstance(previous_leaf, scoretools.Chord)
           and leaf.written_pitches == previous_leaf.written_pitches):
         return False
     return True
Exemplo n.º 4
0
 def _previous_leaf_changes_current_pitch(leaf):
     previous_leaf = inspect_(leaf).get_leaf(n=-1)
     if (isinstance(leaf, scoretools.Note) and
         isinstance(previous_leaf, scoretools.Note) and
         leaf.written_pitch == previous_leaf.written_pitch):
         return False
     elif (isinstance(leaf, scoretools.Chord) and
         isinstance(previous_leaf, scoretools.Chord) and
         leaf.written_pitches == previous_leaf.written_pitches):
         return False
     return True
Exemplo n.º 5
0
 def _get_lilypond_format_bundle(self, leaf):
     lilypond_format_bundle = self._get_basic_lilypond_format_bundle(leaf)
     prototype = (scoretools.Chord, scoretools.Note)
     if not self._is_my_last_leaf(leaf) and isinstance(leaf, prototype):
         if self.include_tied_leaves:
             string = r'\glissando'
             lilypond_format_bundle.right.spanner_starts.append(string)
         else:
             logical_tie = inspect_(leaf).get_logical_tie()
             if leaf is logical_tie[-1]:
                 string = r'\glissando'
                 lilypond_format_bundle.right.spanner_starts.append(string)
     return lilypond_format_bundle
Exemplo n.º 6
0
 def _is_last_in_tie_chain(leaf):
     logical_tie = inspect_(leaf).get_logical_tie()
     return leaf is logical_tie[-1]
Exemplo n.º 7
0
 def _is_last_in_tie_chain(leaf):
     logical_tie = inspect_(leaf).get_logical_tie()
     return leaf is logical_tie[-1]
 def apply_action(self, action: CompositionAction):
     for voice, note in zip(self.voices, action.notes_per_voice):
         # Hashable notes are only for state representation
         voice.append(Note(str(note)))
     self.current_duration = inspect_(self.voices[0]).get_duration()