def _attach_notehead(tie, intensity, size=0.75, outline=True): gray = Handler._intensity_to_grayscale(intensity) fill = Handler._make_circle_markup(size, gray) if outline: outline = Handler._make_circle_outline_markup(size) circle = abjad.Markup.combine([fill, outline]) Handler._markup_to_notehead(tie.head, circle) else: Handler._markup_to_notehead(tie.head, fill)
def _handle_voice(self, voice, current_stage): last_force = None last_position = None last_string_index = None for tie, offset_start, offset_end, i, count \ in self._iterate_logical_ties(voice): if tie.is_pitched: force_start, force_end = \ PickingHandler._get_value( self._force_envelopes, self._force_envelope_patterns, current_stage, offset_start, offset_end, last_force, ) position_start, position_end = \ PickingHandler._get_value( self._position_envelopes, self._position_envelope_patterns, current_stage, offset_start, offset_end, last_position, ) scrape = self._cycle_next(self._scrape_patterns, current_stage) tremolo = self._cycle_next(self._tremolo_patterns, current_stage) if tremolo: style = 'dashed-line' elif scrape: style = 'dotted-line' else: style = None if tremolo or scrape: EnvelopeHandler._attach_glissando( tie.head, style=style, color=scheme_rgb_color( grayscale_to_rgb( Handler._intensity_to_grayscale(force_start))), ) self._hidden_grace_after(tie.tail) grace_container = \ abjad.inspect(tie.tail).get_after_grace_container() if grace_container is not None and \ len(grace_container) > 0: self._set_y_offset(grace_container[0], position_end) if count - 1 != i: Handler._attach_glissando( grace_container[0], style=style, color=scheme_rgb_color( grayscale_to_rgb( Handler._intensity_to_grayscale( force_start))), ) self._set_y_offset(tie.head, position_start) PickingHandler._attach_notehead(tie, force_start) if not tie.is_trivial: for note in tie[1:]: if tremolo or scrape: self._add_gliss_skip(note) self._hide_note_head(note) string_index = self._cycle_next(self._string_index_patterns, current_stage) if last_string_index and string_index != last_string_index: self._attach_string_index(string_index, tie) last_force = force_end last_position = position_end last_string_index = string_index else: last_force = None last_position = None last_string_index = None
def _handle_voice(self, voice, current_stage): # skip if no data if (self._air_pressure_envelopes is None or self._air_pressure_envelopes[current_stage] is None) and \ (self._air_pressure_envelope_patterns is None or self._air_pressure_envelope_patterns[current_stage] is None): return last_air_pressure = None last_lip_pressure = None for tie, offset_start, offset_end, i, count in \ Handler._iterate_logical_ties(voice): if tie.is_pitched: air_pressure_start, air_pressure_end = \ EnvelopeHandler._get_value( self._air_pressure_envelopes, self._air_pressure_envelope_patterns, current_stage, offset_start, offset_end, last_air_pressure, ) lip_pressure_start, lip_pressure_end = \ EnvelopeHandler._get_value( self._lip_pressure_envelopes, self._lip_pressure_envelope_patterns, current_stage, offset_start, offset_end, last_lip_pressure, ) staccato = EmbouchureHandler._cycle_next( self._staccato_patterns, current_stage) if not staccato: vibrato = EmbouchureHandler._cycle_next( self._vibrato_patterns, current_stage) fluttertongue = EmbouchureHandler._cycle_next( self._fluttertongue_patterns, current_stage) if vibrato: style = 'zigzag' elif fluttertongue: style = 'dashed-line' else: style = None # create lines EnvelopeHandler._attach_glissando( tie.head, style=style, color=scheme_rgb_color( grayscale_to_rgb( Handler._intensity_to_grayscale( lip_pressure_start))), ) EnvelopeHandler._hidden_grace_after(tie.tail) grace_container = abjad.inspect(tie.tail)\ .get_after_grace_container() if grace_container is not None and \ len(grace_container) > 0: self._set_y_offset(grace_container[0], air_pressure_end) if count - 1 != i: Handler._attach_glissando( grace_container[0], style=style, color=scheme_rgb_color( grayscale_to_rgb( Handler._intensity_to_grayscale( lip_pressure_start))), ) self._set_y_offset(tie.head, air_pressure_start) EnvelopeHandler._attach_notehead(tie, lip_pressure_start) if not tie.is_trivial: for note in tie[1:]: EmbouchureHandler._add_gliss_skip(note) EmbouchureHandler._hide_note_head(note) last_air_pressure = air_pressure_end last_lip_pressure = lip_pressure_end else: last_air_pressure = None last_lip_pressure = None
def _handle_voice(self, voice, current_stage): last_force = None last_position = None last_string_index = None for tie, offset_start, offset_end, i, count \ in self._iterate_logical_ties(voice): if tie.is_pitched: force_start, force_end = \ PickingHandler._get_value( self._force_envelopes, self._force_envelope_patterns, current_stage, offset_start, offset_end, last_force, ) position_start, position_end = \ PickingHandler._get_value( self._position_envelopes, self._position_envelope_patterns, current_stage, offset_start, offset_end, last_position, ) scrape = self._cycle_next(self._scrape_patterns, current_stage) tremolo = self._cycle_next(self._tremolo_patterns, current_stage) if tremolo: style = 'dashed-line' elif scrape: style = 'dotted-line' else: style = None if tremolo or scrape: EnvelopeHandler._attach_glissando( tie.head, style=style, color=scheme_rgb_color( grayscale_to_rgb( Handler._intensity_to_grayscale(force_start) ) ), ) self._hidden_grace_after(tie.tail) grace_container = \ abjad.inspect(tie.tail).get_after_grace_container() if grace_container is not None and \ len(grace_container) > 0: self._set_y_offset(grace_container[0], position_end) if count - 1 != i: Handler._attach_glissando( grace_container[0], style=style, color=scheme_rgb_color( grayscale_to_rgb( Handler._intensity_to_grayscale( force_start) ) ), ) self._set_y_offset(tie.head, position_start) PickingHandler._attach_notehead(tie, force_start) if not tie.is_trivial: for note in tie[1:]: if tremolo or scrape: self._add_gliss_skip(note) self._hide_note_head(note) string_index = self._cycle_next( self._string_index_patterns, current_stage ) if last_string_index and string_index != last_string_index: self._attach_string_index(string_index, tie) last_force = force_end last_position = position_end last_string_index = string_index else: last_force = None last_position = None last_string_index = None
def _handle_voice(self, voice, current_stage): if (self._height_envelopes is None or self._height_envelopes[current_stage] is None) and \ (self._height_envelope_patterns is None or self._height_envelope_patterns[current_stage] is None): return last_height = None last_pressure = None for tie, offset_start, offset_end, i, count in \ Handler._iterate_logical_ties(voice): if tie.is_pitched: height_start, height_end = \ EnvelopeHandler._get_value( self._height_envelopes, self._height_envelope_patterns, current_stage, offset_start, offset_end, last_height, ) pressure_start, pressure_end = \ EnvelopeHandler._get_value( self._pressure_envelopes, self._pressure_envelope_patterns, current_stage, offset_start, offset_end, last_pressure, ) staccato = Handler._cycle_next(self._staccato_patterns, current_stage) if not staccato: sweep = Handler._cycle_next(self._sweep_patterns, current_stage) tremolo = Handler._cycle_next(self._tremolo_patterns, current_stage) if sweep: style = 'zigzag' elif tremolo: style = 'dashed-line' else: style = None Handler._attach_glissando( tie.head, style=style, color=scheme_rgb_color( grayscale_to_rgb( Handler._intensity_to_grayscale( pressure_start))), ) Handler._hidden_grace_after(tie.tail) grace_container = abjad.inspect(tie.tail)\ .get_after_grace_container() if grace_container is not None and \ len(grace_container) > 0: self._set_y_offset(grace_container[0], height_end) if count - 1 != i: Handler._attach_glissando( grace_container[0], style=style, color=scheme_rgb_color( grayscale_to_rgb( Handler._intensity_to_grayscale( pressure_start))), ) jete = Handler._cycle_next(self._jete_patterns, current_stage) if jete: BowingHandler._add_jete(tie.head) self._set_y_offset(tie.head, height_start) EnvelopeHandler._attach_notehead(tie, pressure_start) if not tie.is_trivial: for note in tie[1:]: Handler._add_gliss_skip(note) Handler._hide_note_head(note) last_height = height_end last_pressure = pressure_end else: last_height = None last_pressure = None
def _handle_voice(self, voice, current_stage): if (self._height_envelopes is None or self._height_envelopes[current_stage] is None) and \ (self._height_envelope_patterns is None or self._height_envelope_patterns[current_stage] is None): return last_height = None last_pressure = None for tie, offset_start, offset_end, i, count in \ Handler._iterate_logical_ties(voice): if tie.is_pitched: height_start, height_end = \ EnvelopeHandler._get_value( self._height_envelopes, self._height_envelope_patterns, current_stage, offset_start, offset_end, last_height, ) pressure_start, pressure_end = \ EnvelopeHandler._get_value( self._pressure_envelopes, self._pressure_envelope_patterns, current_stage, offset_start, offset_end, last_pressure, ) staccato = Handler._cycle_next(self._staccato_patterns, current_stage) if not staccato: sweep = Handler._cycle_next(self._sweep_patterns, current_stage) tremolo = Handler._cycle_next(self._tremolo_patterns, current_stage) if sweep: style = 'zigzag' elif tremolo: style = 'dashed-line' else: style = None Handler._attach_glissando( tie.head, style=style, color=scheme_rgb_color( grayscale_to_rgb( Handler._intensity_to_grayscale(pressure_start) ) ), ) Handler._hidden_grace_after(tie.tail) grace_container = abjad.inspect(tie.tail)\ .get_after_grace_container() if grace_container is not None and \ len(grace_container) > 0: self._set_y_offset(grace_container[0], height_end) if count - 1 != i: Handler._attach_glissando( grace_container[0], style=style, color=scheme_rgb_color( grayscale_to_rgb( Handler._intensity_to_grayscale( pressure_start) ) ), ) jete = Handler._cycle_next(self._jete_patterns, current_stage) if jete: BowingHandler._add_jete(tie.head) self._set_y_offset(tie.head, height_start) EnvelopeHandler._attach_notehead(tie, pressure_start) if not tie.is_trivial: for note in tie[1:]: Handler._add_gliss_skip(note) Handler._hide_note_head(note) last_height = height_end last_pressure = pressure_end else: last_height = None last_pressure = None