def _copy_keyword_args(self, new): Spanner._copy_keyword_args(self, new) new._direction = self.direction new._include_rests = self.include_rests new._shape_string = self.shape_string new._start_dynamic = self.start_dynamic new._stop_dynamic = self.stop_dynamic
def __init__( self, durations=None, include_long_duration_notes=False, include_long_duration_rests=False, isolated_nib_direction=None, use_stemlets=False, vertical_direction=None, ): Spanner.__init__( self, ) if durations: durations = tuple(durationtools.Duration(x) for x in durations) self._durations = durations self._include_long_duration_notes = bool(include_long_duration_notes) self._include_long_duration_rests = bool(include_long_duration_rests) assert isolated_nib_direction in (Left, Right, None) self._isolated_nib_direction = isolated_nib_direction if self._durations is not None: self._span_points = mathtools.cumulative_sums(self.durations)[1:] else: self._span_points = [self._get_duration()] self._use_stemlets = bool(use_stemlets) assert vertical_direction in (Up, Down, Center, None) self._vertical_direction = vertical_direction
def __init__( self, descriptor='<', direction=None, include_rests=False, overrides=None, ): Spanner.__init__( self, overrides=overrides, ) direction = stringtools.expr_to_tridirectional_lilypond_symbol( direction) self._direction = direction self._include_rests = include_rests start_dynamic, shape_string, stop_dynamic = \ self._parse_descriptor(descriptor) self._descriptor = descriptor assert shape_string in ('<', '>') self._shape_string = shape_string if start_dynamic is not None: start_dynamic = indicatortools.Dynamic(start_dynamic) self._start_dynamic = start_dynamic if stop_dynamic is not None: stop_dynamic = indicatortools.Dynamic(stop_dynamic) self._stop_dynamic = stop_dynamic
def __init__( self, overrides=None, ): Spanner.__init__( self, overrides=overrides, )
def __init__( self, components=None, overrides=None, ): Spanner.__init__( self, components, overrides=overrides, )
def __init__( self, color='white', overrides=None, ): Spanner.__init__( self, overrides=overrides, ) self._color = color
def __init__(self, lines=5, overrides=None): Spanner.__init__(self, overrides=overrides) if isinstance(lines, int) and 0 < lines: self._lines = lines elif isinstance(lines, (tuple, list)) and all(isinstance(x, (int, float)) for x in lines): self._lines = tuple(lines) else: message = "must be integer or a sequence of integers: {!r}." message = message.format(lines) raise ValueError(message) self._lines = lines
def __init__( self, clef='percussion', overrides=None, ): Spanner.__init__( self, overrides=overrides, ) clef = indicatortools.Clef(clef) self._clef = clef
def __init__( self, include_tied_leaves=False, overrides=None, ): Spanner.__init__( self, overrides=overrides, ) assert isinstance(include_tied_leaves, bool), repr(include_tied_leaves) self._include_tied_leaves = include_tied_leaves
def __init__( self, components=None, mark='', overrides=None, ): Spanner.__init__( self, components, overrides=overrides, ) self.mark = mark
def __init__( self, overrides=None, pitch=None, ): Spanner.__init__( self, overrides=overrides, ) if pitch is not None: pitch = pitchtools.NamedPitch(pitch) self._pitch = pitch
def __init__( self, overrides=None, interval=None, ): Spanner.__init__( self, overrides=overrides, ) if interval is not None: interval = pitchtools.NamedInterval(interval) self._interval = interval
def __init__( self, components=None, overrides=None, ): Spanner.__init__( self, components, overrides=overrides, ) self.kind = 'sustain' self.style = 'mixed'
def __init__( self, interval=None, overrides=None, ): Spanner.__init__( self, overrides=overrides, ) if interval is not None: interval = pitchtools.NamedInterval(interval) self._interval = interval
def __init__( self, components=[], direction=None, overrides=None, ): Spanner.__init__( self, components, overrides=overrides, ) self.direction = direction
def __init__( self, minimum_duration=None, overrides=None, ): Spanner.__init__( self, overrides=overrides, ) if minimum_duration is not None: minimum_duration = durationtools.Duration(minimum_duration) self._minimum_duration = minimum_duration
def __init__( self, direction=None, overrides=None, ): Spanner.__init__( self, overrides=overrides, ) direction = stringtools.arg_to_tridirectional_lilypond_symbol( direction) self._direction = direction
def __init__( self, overrides=None, start=1, stop=0, ): Spanner.__init__( self, overrides=overrides, ) assert isinstance(start, (int, type(None))) self._start = start assert isinstance(stop, (int, type(None))) self._stop = stop
def __init__( self, direction=None, overrides=None, use_messiaen_style_ties=None, ): Spanner.__init__( self, overrides=overrides, ) direction = stringtools.expr_to_tridirectional_lilypond_symbol( direction) self._direction = direction self._use_messiaen_style_ties = use_messiaen_style_ties
def __init__( self, interval=None, is_harmonic=False, overrides=None, pitch=None, ): Spanner.__init__( self, overrides=overrides, ) self._interval = interval self._is_harmonic = bool(is_harmonic) if pitch is not None: pitch = pitchtools.NamedPitch(pitch) self._pitch = pitch
def _format_after_leaf(self, leaf): result = [] result.extend(Spanner._format_after_leaf(self, leaf)) if self._is_my_last_leaf(leaf): string = r'\ottava #{}'.format(self.stop) result.append(string) return result
def _format_before_leaf(self, leaf): result = [] result.extend(Spanner._format_before_leaf(self, leaf)) if self._is_my_first_leaf(leaf): string = r'\ottava #{}'.format(self.start) result.append(string) return result
def __init__( self, allow_repeated_pitches=False, allow_ties=False, overrides=None, parenthesize_repeated_pitches=False, ): Spanner.__init__( self, overrides=overrides, ) allow_ties = bool(allow_ties) allow_repeated_pitches = bool(allow_repeated_pitches) parenthesize_repeated_pitches = bool(parenthesize_repeated_pitches) self._allow_ties = allow_ties self._allow_repeated_pitches = allow_repeated_pitches self._parenthesize_repeated_pitches = parenthesize_repeated_pitches
def _format_after_leaf(self, leaf): result = Spanner._format_after_leaf(self, leaf) if self._is_my_last_leaf(leaf): next_leaf = leaf._get_leaf(1) if ( next_leaf is None or not inspect_(next_leaf).has_spanner(type(self)) ): result.append(r'<> \)') return result
def __init__( self, lines=5, overrides=None, ): Spanner.__init__( self, overrides=overrides, ) if isinstance(lines, int) and 0 < lines: self._lines = lines elif isinstance(lines, (tuple, list)) \ and all(isinstance(x, (int, float)) for x in lines): self._lines = tuple(lines) else: message = 'must be integer or a sequence of integers: {!r}.' message = message.format(lines) raise ValueError(message) self._lines = lines
def __init__( self, kind='sustain', overrides=None, style='mixed', ): Spanner.__init__( self, overrides=overrides, ) if not kind in list(self._kinds.keys()): message = 'kind must be in {!r}.' message = message.format(list(self._kinds.keys())) raise ValueError(message) self._kind = kind if not style in self._styles: message = 'style must be in {!r}.' message = message.format(self._styles) raise ValueError(message) self._style = style
def __init__( self, durations=None, include_long_duration_notes=False, include_long_duration_rests=False, isolated_nib_direction=None, use_stemlets=False, vertical_direction=None, ): Spanner.__init__( self, ) if durations: durations = tuple(durationtools.Duration(x) for x in durations) self._durations = durations self._include_long_duration_notes = bool(include_long_duration_notes) self._include_long_duration_rests = bool(include_long_duration_rests) assert isolated_nib_direction in (Left, Right, None) self._isolated_nib_direction = isolated_nib_direction self._use_stemlets = bool(use_stemlets) assert vertical_direction in (Up, Down, Center, None) self._vertical_direction = vertical_direction
def _format_before_leaf(self, leaf): import consort result = [] if self._is_my_first_leaf(leaf): result.extend(Spanner._format_before_leaf(self, leaf)) if isinstance(self._color, consort.Color): string = r'\colorSpan #-4 #4 {}'.format( self._color._lilypond_format, ) else: string = r"\colorSpan #-4 #4 #(x11-color '{})" string = string.format(self._color) result.append(string) return result
def __init__( self, lines=5, forbid_restarting=None, overrides=None, ): Spanner.__init__( self, overrides=overrides, ) if isinstance(lines, int) and 0 < lines: self._lines = lines elif isinstance(lines, (tuple, list)) \ and all(isinstance(x, (int, float)) for x in lines): self._lines = tuple(lines) else: message = 'must be integer or a sequence of integers: {!r}.' message = message.format(lines) raise ValueError(message) self._lines = lines if forbid_restarting is not None: forbid_restarting = bool(forbid_restarting) self._forbid_restarting = forbid_restarting
def _format_before_leaf(self, leaf): result = [] result.extend(Spanner._format_before_leaf(self, leaf)) if self._is_my_first_leaf(leaf): result.append(r"\ottava #%s" % self.start) return result
def _format_after_leaf(self, leaf): result = [] result.extend(Spanner._format_after_leaf(self, leaf)) if self._is_my_last_leaf(leaf): result.append(r"\ottava #%s" % self.stop) return result
def __init__(self, components=None, start=1, stop=0, overrides=None): Spanner.__init__(self, components, overrides=overrides) self.start = start self.stop = stop
def _copy_keyword_args(self, new): Spanner._copy_keyword_args(self, new) new._allow_repeated_pitches = self.allow_repeated_pitches new._allow_ties = self.allow_ties new._parenthesize_repeated_pitches = self.parenthesize_repeated_pitches
def _copy_keyword_args(self, new): Spanner._copy_keyword_args(self, new) new._direction = self.direction