Exemplo n.º 1
0
 def split_at_offset(self, offset):
     from abjad.tools import timespantools
     offset = durationtools.Offset(offset)
     result = timespantools.TimespanInventory()
     if self._start_offset < offset < self._stop_offset:
         left_divisions, right_divisions = None, None
         if self.divisions is not None:
             left_divisions, right_divisions = sequencetools.split_sequence(
                 self.divisions,
                 [offset - self.start_offset],
                 overhang=True,
                 )
         left = new(
             self,
             start_offset=self._start_offset,
             stop_offset=offset,
             divisions=left_divisions,
             )
         right = new(
             self,
             start_offset=offset,
             stop_offset=self._stop_offset,
             divisions=right_divisions,
             )
         if left.duration:
             result.append(left)
         if right.duration:
             result.append(right)
     else:
         result.append(new(self))
     return result
Exemplo n.º 2
0
 def split_at_offset(self, offset):
     offset = abjad.Offset(offset)
     result = abjad.TimespanList()
     if self._start_offset < offset < self._stop_offset:
         left_divisions, right_divisions = None, None
         if self.divisions is not None:
             left_divisions, right_divisions = abjad.split_sequence(
                 self.divisions,
                 [offset - self.start_offset],
                 overhang=True,
             )
         left = abjad.new(
             self,
             start_offset=self._start_offset,
             stop_offset=offset,
             divisions=left_divisions,
         )
         right = abjad.new(
             self,
             start_offset=offset,
             stop_offset=self._stop_offset,
             divisions=right_divisions,
         )
         if left.duration:
             result.append(left)
         if right.duration:
             result.append(right)
     else:
         result.append(abjad.new(self))
     return result
Exemplo n.º 3
0
 def _get_lilypond_format(self, context=None):
     import abjad
     result = []
     if self.hide:
         return result
     markup = self.markup
     if markup.direction is not None:
         markup = abjad.new(
             markup,
             direction=None,
             )
     if isinstance(context, str):
         pass
     elif context is not None:
         context = context.lilypond_type
     else:
         context = self._lilypond_type
     pieces = markup._get_format_pieces()
     first_line = r'\set {!s}.instrumentName = {!s}'
     first_line = first_line.format(context, pieces[0])
     result.append(first_line)
     result.extend(pieces[1:])
     short_markup = self.short_markup
     if short_markup.direction is not None:
         short_markup = abjad.new(
             short_markup,
             direction=None,
             )
     pieces = short_markup._get_format_pieces()
     first_line = r'\set {!s}.shortInstrumentName = {!s}'
     first_line = first_line.format(context, pieces[0])
     result.append(first_line)
     result.extend(pieces[1:])
     return result
Exemplo n.º 4
0
 def new(
     self,
     first=None,
     last=None,
     only=None,
     default=None,
     **kwargs
     ):
     first = first or self.first
     last = last or self.last
     only = only or self.only
     default = default or self.default
     if first is not None:
         first = new(first, **kwargs)
     if last is not None:
         last = new(last, **kwargs)
     if only is not None:
         only = new(only, **kwargs)
     if default is not None:
         default = new(default, **kwargs)
     result = new(
         self,
         first=first,
         last=last,
         only=only,
         default=default,
         )
     return result
Exemplo n.º 5
0
 def _iterate(self, state=None):
     queue = state[0]
     # get first event
     previous_offset, previous_event, next_event = 0.0, None, None
     while not previous_event and not queue.empty():
         (_, index), iterator = queue.get()
         try:
             previous_event = next(iterator)
             previous_event = new(previous_event, _iterator=iterator)
         except StopIteration:
             continue
         queue.put(((previous_event.delta, index), iterator))
         break
     while not queue.empty():
         (next_offset, index), iterator = queue.get()
         try:
             next_event = next(iterator)
             next_event = new(next_event, _iterator=iterator)
         except StopIteration:
             continue
         queue.put(((next_offset + next_event.delta, index), iterator))
         delta = next_offset - previous_offset
         previous_event = new(previous_event, delta=delta)
         yield previous_event
         previous_event = next_event
         previous_offset = next_offset
         next_event = None
     if not next_event:
         yield previous_event
Exemplo n.º 6
0
 def _iterate(self, state=None):
     queue = state[0]
     # get first event
     previous_offset, previous_event, next_event = 0.0, None, None
     while not previous_event and not queue.empty():
         (_, index), iterator = queue.get()
         try:
             previous_event = next(iterator)
             previous_event = new(previous_event, _iterator=iterator)
         except StopIteration:
             continue
         queue.put(((previous_event.delta, index), iterator))
         break
     while not queue.empty():
         (next_offset, index), iterator = queue.get()
         try:
             next_event = next(iterator)
             next_event = new(next_event, _iterator=iterator)
         except StopIteration:
             continue
         queue.put(((next_offset + next_event.delta, index), iterator))
         delta = next_offset - previous_offset
         previous_event = new(previous_event, delta=delta)
         yield previous_event
         previous_event = next_event
         previous_offset = next_offset
         next_event = None
     if not next_event:
         yield previous_event
 def split_at_offset(self, offset):
     offset = abjad.Offset(offset)
     result = abjad.TimespanList()
     if self._start_offset < offset < self._stop_offset:
         left_divisions, right_divisions = None, None
         if self.divisions is not None:
             left_divisions, right_divisions = abjad.split_sequence(
                 self.divisions,
                 [offset - self.start_offset],
                 overhang=True,
                 )
         left = abjad.new(
             self,
             start_offset=self._start_offset,
             stop_offset=offset,
             divisions=left_divisions,
             )
         right = abjad.new(
             self,
             start_offset=offset,
             stop_offset=self._stop_offset,
             divisions=right_divisions,
             )
         if left.duration:
             result.append(left)
         if right.duration:
             result.append(right)
     else:
         result.append(abjad.new(self))
     return result
Exemplo n.º 8
0
 def _get_lilypond_format(self, context=None):
     import abjad
     result = []
     if self.hide:
         return result
     markup = self.markup
     if markup.direction is not None:
         markup = abjad.new(
             markup,
             direction=None,
         )
     if isinstance(context, str):
         pass
     elif context is not None:
         context = context.lilypond_type
     else:
         context = self._lilypond_type
     pieces = markup._get_format_pieces()
     first_line = r'\set {!s}.instrumentName = {!s}'
     first_line = first_line.format(context, pieces[0])
     result.append(first_line)
     result.extend(pieces[1:])
     short_markup = self.short_markup
     if short_markup.direction is not None:
         short_markup = abjad.new(
             short_markup,
             direction=None,
         )
     pieces = short_markup._get_format_pieces()
     first_line = r'\set {!s}.shortInstrumentName = {!s}'
     first_line = first_line.format(context, pieces[0])
     result.append(first_line)
     result.extend(pieces[1:])
     return result
Exemplo n.º 9
0
 def _apply_division_masks(self, selections):
     import abjad
     from abjad.tools import rhythmmakertools
     if not self.division_masks:
         return selections
     new_selections = []
     duration_specifier = self._get_duration_specifier()
     decrease_monotonic = duration_specifier.decrease_monotonic
     forbidden_duration = duration_specifier.forbidden_duration
     tie_specifier = self._get_tie_specifier()
     total_divisions = len(selections)
     division_masks = self.division_masks
     leaf_maker = abjad.LeafMaker(
         decrease_monotonic=decrease_monotonic,
         forbidden_duration=forbidden_duration,
         repeat_ties=tie_specifier.repeat_ties,
     )
     previous_divisions_consumed = self._previous_divisions_consumed()
     for i, selection in enumerate(selections):
         matching_division_mask = division_masks.get_matching_pattern(
             i + previous_divisions_consumed,
             total_divisions + previous_divisions_consumed,
             rotation=self.previous_state.get('rotation'),
         )
         if not matching_division_mask:
             new_selections.append(selection)
             continue
         duration = abjad.inspect(selection).get_duration()
         if isinstance(
                 matching_division_mask,
                 rhythmmakertools.SustainMask,
         ):
             leaf_maker = abjad.new(
                 leaf_maker,
                 use_multimeasure_rests=False,
             )
             new_selection = leaf_maker([0], [duration])
         else:
             use_multimeasure_rests = getattr(
                 matching_division_mask,
                 'use_multimeasure_rests',
                 False,
             )
             leaf_maker = abjad.new(
                 leaf_maker,
                 use_multimeasure_rests=use_multimeasure_rests,
             )
             new_selection = leaf_maker([None], [duration])
         for component in abjad.iterate(selection).components():
             abjad.detach(abjad.Tie, component)
         new_selections.append(new_selection)
     return new_selections
Exemplo n.º 10
0
    def __add__(self, argument):
        """
        Adds typed tuple to ``argument``.

        Returns new typed tuple.
        """
        import abjad
        if isinstance(argument, type(self)):
            items = argument._collection
            return abjad.new(self, items=self._collection[:] + items)
        elif isinstance(argument, type(self._collection)):
            items = argument[:]
            return abjad.new(self, items=self._collection[:] + items)
        raise NotImplementedError
Exemplo n.º 11
0
    def __add__(self, argument):
        """
        Adds typed tuple to ``argument``.

        Returns new typed tuple.
        """
        import abjad

        if isinstance(argument, type(self)):
            items = argument._collection
            return abjad.new(self, items=self._collection[:] + items)
        elif isinstance(argument, type(self._collection)):
            items = argument[:]
            return abjad.new(self, items=self._collection[:] + items)
        raise NotImplementedError
Exemplo n.º 12
0
 def rotate(self, n=0):
     counts = self.counts
     if counts is not None:
         counts = counts.rotate(n)
     return new(self,
         counts=counts,
         )
Exemplo n.º 13
0
 def _coerce_iterator_output(self, expr, state=None):
     from supriya.tools import patterntools
     if not isinstance(expr, patterntools.Event):
         expr = patterntools.NoteEvent(**expr)
     if not expr.get('uuid'):
         expr = new(expr, uuid=uuid.uuid4())
     return expr
Exemplo n.º 14
0
 def reverse(self):
     counts = self.counts
     if counts is not None:
         counts = counts.reverse()
     return new(self,
         counts=counts,
         )
Exemplo n.º 15
0
    def __call__(self, expr):
        r'''Calls specifier on `expr`.

        Returns none.
        '''
        if self.dynamic is None:
            return
        #print(expr)
        selector = self._get_selector()
        #print(selector)
        selections = selector(expr)
        #print(selections)
        for selection in selections:
            if isinstance(self.dynamic, abjad.spannertools.Hairpin):
                hairpin = abjad.new(self.dynamic)
                leaves = list(abjad.iterate(selection).by_leaf())
                if hairpin._attachment_test_all(leaves):
                    abjad.attach(hairpin, leaves)
            elif isinstance(self.dynamic, (str, abjad.indicatortools.Dynamic)):
                dynamic = abjad.indicatortools.Dynamic(self.dynamic)
                abjad.attach(dynamic, selection[0])
            else:
                message = 'invalid dynamic: {!r}.'
                message = message.format(self.dynamic)
                raise Exception(message)
Exemplo n.º 16
0
 def transpose(self, expr):
     import consort
     pitch_specifier = self.pitch_specifier or consort.PitchSpecifier(
         pitch_segments='C4',
         )
     pitch_specifier = pitch_specifier.transpose(expr)
     return abjad.new(self, pitch_specifier=pitch_specifier)
Exemplo n.º 17
0
 def resolve_target_timespans(
     self,
     segment_timespan,
     timespan_quantization=None,
     ):
     import consort
     assert isinstance(segment_timespan, timespantools.Timespan)
     timespan_identifier = self.timespan_identifier
     if timespan_identifier is None:
         target_timespans = timespantools.TimespanInventory([
             segment_timespan,
             ])
     elif isinstance(self.timespan_identifier, timespantools.Timespan):
         if timespan_identifier.stop_offset == Infinity:
             timespan_identifier = new(
                 timespan_identifier,
                 stop_offset=segment_timespan.stop_offset,
                 )
         segment_timespan = timespantools.Timespan(start_offset=0)
         target_timespans = segment_timespan & timespan_identifier
     else:
         if isinstance(timespan_identifier, consort.RatioPartsExpression):
             mask_timespans = timespan_identifier(segment_timespan)
         else:
             mask_timespans = timespan_identifier
         target_timespans = timespantools.TimespanInventory()
         for mask_timespan in mask_timespans:
             available_timespans = segment_timespan & mask_timespan
             target_timespans.extend(available_timespans)
     if timespan_quantization is not None:
         target_timespans.round_offsets(
             timespan_quantization,
             must_be_well_formed=True,
             )
     return target_timespans
    def align(self):
        r"""Aligns all inflections to a minimum interval of zero.

        ::

            >>> import consort
            >>> inflection = consort.RegisterInflection.zigzag().align()
            >>> print(format(inflection))
            consort.tools.RegisterInflection(
                inflections=pitchtools.IntervalSegment(
                    (
                        pitchtools.NumberedInterval(0),
                        pitchtools.NumberedInterval(9),
                        pitchtools.NumberedInterval(3),
                        pitchtools.NumberedInterval(12),
                        ),
                    item_class=pitchtools.NumberedInterval,
                    ),
                ratio=mathtools.Ratio((1, 1, 1)),
                )

        Emits new register inflection.
        """
        minimum = sorted(self.inflections, key=lambda x: x.semitones)[0]
        inflections = (_ - minimum for _ in self.inflections)
        return new(self, inflections=inflections)
    def rotate(self, n=1):
        r"""Rotates register inflection by `n`.

        ::

            >>> import consort
            >>> inflection = consort.RegisterInflection.zigzag().rotate(1)
            >>> print(format(inflection))
            consort.tools.RegisterInflection(
                inflections=pitchtools.IntervalSegment(
                    (
                        pitchtools.NumberedInterval(6),
                        pitchtools.NumberedInterval(-6),
                        pitchtools.NumberedInterval(3),
                        pitchtools.NumberedInterval(-3),
                        ),
                    item_class=pitchtools.NumberedInterval,
                    ),
                ratio=mathtools.Ratio((1, 1, 1)),
                )

        Emits new register inflection.
        """
        return new(
            self,
            inflections=sequencetools.rotate_sequence(self.inflections, n),
            ratio=sequencetools.rotate_sequence(self.ratio, n),
        )
Exemplo n.º 20
0
def test_new_02():

    old_aggregate = Aggregate(
        pitch_segment=abjad.PitchSegment("c d e f"),
        ratio=abjad.Ratio([1, 2, 3]),
    )

    assert format(old_aggregate) == abjad.String.normalize(
        r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            ratio=abjad.Ratio((1, 2, 3)),
            )
        """
    )

    new_aggregate = abjad.new(old_aggregate, ratio=(4, 5))

    assert new_aggregate is not old_aggregate
    assert new_aggregate != old_aggregate
    assert format(old_aggregate) == abjad.String.normalize(
        r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            ratio=abjad.Ratio((1, 2, 3)),
            )
        """
    )
    assert format(new_aggregate) == abjad.String.normalize(
        r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            ratio=abjad.Ratio((4, 5)),
            )
        """
    )
    def reverse(self):
        r'''Reverses register inflection.

        ::

            >>> inflection = consort.RegisterInflection.zigzag().reverse()
            >>> print(format(inflection))
            consort.tools.RegisterInflection(
                inflections=abjad.IntervalSegment(
                    (
                        abjad.NumberedInterval(6),
                        abjad.NumberedInterval(-3),
                        abjad.NumberedInterval(3),
                        abjad.NumberedInterval(-6),
                        ),
                    item_class=abjad.NumberedInterval,
                    ),
                ratio=abjad.Ratio((1, 1, 1)),
                )

        Emits new register inflection.
        '''
        return abjad.new(
            self,
            inflections=reversed(self.inflections),
            ratio=reversed(self.ratio),
            )
    def rotate(self, n=1):
        r'''Rotates register inflection by `n`.

        ::

            >>> inflection = consort.RegisterInflection.zigzag().rotate(1)
            >>> print(format(inflection))
            consort.tools.RegisterInflection(
                inflections=abjad.IntervalSegment(
                    (
                        abjad.NumberedInterval(6),
                        abjad.NumberedInterval(-6),
                        abjad.NumberedInterval(3),
                        abjad.NumberedInterval(-3),
                        ),
                    item_class=abjad.NumberedInterval,
                    ),
                ratio=abjad.Ratio((1, 1, 1)),
                )

        Emits new register inflection.
        '''
        import consort
        return abjad.new(
            self,
            inflections=consort.rotate(self.inflections, n),
            ratio=consort.rotate(self.ratio, n),
            )
Exemplo n.º 23
0
 def _coerce_iterator_output(self, expr, state=None):
     from supriya.tools import patterntools
     if not isinstance(expr, patterntools.Event):
         expr = patterntools.NoteEvent(**expr)
     if not expr.get('uuid'):
         expr = new(expr, uuid=uuid.uuid4())
     return expr
Exemplo n.º 24
0
    def transpose(self, expr):
        r"""
        Transposes music specifier.

        ..  container:: example

            >>> music_specifier = tsmakers.MusicSpecifier()
            >>> transposed_music_specifier = music_specifier.transpose('-M2')
            >>> print(abjad.storage(transposed_music_specifier))
            tsmakers.MusicSpecifier()

        Returns new music specifier.
        """
        if isinstance(expr, str):
            try:
                pitch = abjad.NamedPitch(expr)
                expr = abjad.NamedPitch("C4") - pitch
            except Exception:
                expr = abjad.NamedInterval(expr)
        pitch_handler = self.pitch_handler
        if pitch_handler is not None:
            pitch_handler = pitch_handler.transpose(expr)
        return abjad.new(
            self,
            pitch_handler=pitch_handler,
        )
Exemplo n.º 25
0
    def transpose(self, n=0):
        r'''Transposes all pitch-classes in pitch-class set by index `n`.

        ..  container:: example

            >>> set_ = abjad.PitchClassSet(
            ...     items=[-2, -1.5, 6, 7, -1.5, 7],
            ...     item_class=abjad.NumberedPitchClass,
            ...     )

            >>> for n in range(12):
            ...     print(n, set_.transpose(n))
            ...
            0 PC{6, 7, 10, 10.5}
            1 PC{7, 8, 11, 11.5}
            2 PC{0, 0.5, 8, 9}
            3 PC{1, 1.5, 9, 10}
            4 PC{2, 2.5, 10, 11}
            5 PC{0, 3, 3.5, 11}
            6 PC{0, 1, 4, 4.5}
            7 PC{1, 2, 5, 5.5}
            8 PC{2, 3, 6, 6.5}
            9 PC{3, 4, 7, 7.5}
            10 PC{4, 5, 8, 8.5}
            11 PC{5, 6, 9, 9.5}

        Returns new pitch-class set.
        '''
        import abjad
        items = (pitch_class + n for pitch_class in self)
        return abjad.new(self, items=items)
Exemplo n.º 26
0
    def __copy__(self, *arguments):
        r'''Copies Abjad value object.

        Returns new Abjad value object.
        '''
        import abjad
        return abjad.new(self)
Exemplo n.º 27
0
    def transpose(self, n=0):
        """
        Transposes all pitch-classes in pitch-class set by index `n`.

        ..  container:: example

            >>> set_ = abjad.PitchClassSet(
            ...     items=[-2, -1.5, 6, 7, -1.5, 7],
            ...     item_class=abjad.NumberedPitchClass,
            ...     )

            >>> for n in range(12):
            ...     print(n, set_.transpose(n))
            ...
            0 PC{6, 7, 10, 10.5}
            1 PC{7, 8, 11, 11.5}
            2 PC{0, 0.5, 8, 9}
            3 PC{1, 1.5, 9, 10}
            4 PC{2, 2.5, 10, 11}
            5 PC{0, 3, 3.5, 11}
            6 PC{0, 1, 4, 4.5}
            7 PC{1, 2, 5, 5.5}
            8 PC{2, 3, 6, 6.5}
            9 PC{3, 4, 7, 7.5}
            10 PC{4, 5, 8, 8.5}
            11 PC{5, 6, 9, 9.5}

        Returns new pitch-class set.
        """
        import abjad

        items = (pitch_class + n for pitch_class in self)
        return abjad.new(self, items=items)
Exemplo n.º 28
0
    def __copy__(self, *arguments):
        """
        Copies Abjad value object.

        Returns new Abjad value object.
        """
        import abjad
        return abjad.new(self)
Exemplo n.º 29
0
    def transpose(self, n=0):
        r'''Transposes pitch set by index `n`.

        Returns new pitch set.
        '''
        import abjad
        items = (pitch.transpose(n=n) for pitch in self)
        return abjad.new(self, items=items)
Exemplo n.º 30
0
    def invert(self, axis):
        r'''Inverts pitch set about `axis`.

        Returns new pitch set.
        '''
        import abjad
        items = (pitch.invert(axis) for pitch in self)
        return abjad.new(self, items=items)
Exemplo n.º 31
0
def make_final_markup():
    place_markup = abjad.Markup('Austin, TX')
    date_markup = abjad.Markup('Feb. 2006')
    final_markup = abjad.Markup.right_column([place_markup, date_markup])
    final_markup = final_markup.italic()
    final_markup = final_markup.with_color('black')
    final_markup = abjad.new(final_markup, direction=Down)
    return final_markup
Exemplo n.º 32
0
 def _get_lilypond_format_bundle(self, component=None):
     import abjad
     bundle = abjad.LilyPondFormatBundle()
     markup = self._get_markup()
     markup = abjad.new(markup, direction=abjad.Up)
     markup_format_pieces = markup._get_format_pieces()
     bundle.right.markup.extend(markup_format_pieces)
     return bundle
    def rotate(self, rotation):
        r'''Rotates pitch specifier.

        ::

            >>> pitch_specifier = consort.PitchSpecifier(
            ...     pitch_segments=(
            ...         "c' e' g'",
            ...         "fs' gs'",
            ...         "b",
            ...         ),
            ...     ratio=(1, 2, 3),
            ...     )
            >>> rotated_pitch_specifier = pitch_specifier.rotate(1)
            >>> print(format(rotated_pitch_specifier))
            consort.tools.PitchSpecifier(
                pitch_segments=(
                    abjad.PitchSegment(
                        (
                            abjad.NamedPitch('b'),
                            ),
                        item_class=abjad.NamedPitch,
                        ),
                    abjad.PitchSegment(
                        (
                            abjad.NamedPitch("c'"),
                            abjad.NamedPitch('f'),
                            abjad.NamedPitch('a'),
                            ),
                        item_class=abjad.NamedPitch,
                        ),
                    abjad.PitchSegment(
                        (
                            abjad.NamedPitch("fs'"),
                            abjad.NamedPitch("e'"),
                            ),
                        item_class=abjad.NamedPitch,
                        ),
                    ),
                ratio=abjad.Ratio((3, 1, 2)),
                )

        Returns new pitch specifier.
        '''
        import consort
        rotation = int(rotation)
        pitch_segments = tuple(
            _.rotate(rotation, stravinsky=True)
            for _ in self.pitch_segments
            )
        pitch_segments = consort.rotate(pitch_segments, rotation)
        ratio = consort.rotate(self.ratio, rotation)
        return abjad.new(
            self,
            pitch_segments=pitch_segments,
            ratio=ratio,
            )
Exemplo n.º 34
0
    def __mul__(self, argument):
        """
        Multiplies typed tuple by ``argument``.

        Returns new typed tuple.
        """
        import abjad
        items = self._collection * argument
        return abjad.new(self, items=items)
def test_AbsolutePitchHandler_01():
    pitch_handler = consort.AbsolutePitchHandler()
    segment_maker = consort.SegmentMaker(
        discard_final_silence=True,
        desired_duration_in_seconds=1,
        omit_stylesheets=True,
        score_template=templatetools.GroupedStavesScoreTemplate(
            staff_count=1,
            ),
        settings=consort.MusicSetting(
            timespan_maker=consort.FloodedTimespanMaker(),
            v1=abjad.new(music_specifier, pitch_handler=pitch_handler),
            ),
        tempo=abjad.MetronomeMark((1, 4), 60),
        permitted_time_signatures=((1, 4),),
        )
    lilypond_file, metadata = segment_maker(segment_metadata=segment_metadata)
    assert format(lilypond_file) == abjad.String.normalize(
        r'''
        \version "2.19.65"
        \language "english"

        #(ly:set-option 'relative-includes #t)

        \score {
            \context Score = "Grouped Staves Score" <<
                \tag #'time
                \context TimeSignatureContext = "Time Signature Context" {
                    {
                        \tempo 4=60
                        \time 1/4
                        s1 * 1/4
                    }
                }
                \context StaffGroup = "Grouped Staves Staff Group" <<
                    \context Staff = "Staff 1" {
                        \context Voice = "Voice 1" {
                            {
                                % [Voice 1] Measure 1
                                {
                                    c'16 [
                                    \set stemLeftBeamCount = 2
                                    \set stemRightBeamCount = 2
                                    c'16
                                    \set stemLeftBeamCount = 2
                                    \set stemRightBeamCount = 2
                                    c'16
                                    \set stemLeftBeamCount = 2
                                    c'16 ]
                                }
                            }
                        }
                    }
                >>
            >>
        }
        ''')
Exemplo n.º 36
0
    def rotate(self, rotation):
        r'''Rotates pitch specifier.

        ::

            >>> pitch_specifier = consort.PitchSpecifier(
            ...     pitch_segments=(
            ...         "c' e' g'",
            ...         "fs' gs'",
            ...         "b",
            ...         ),
            ...     ratio=(1, 2, 3),
            ...     )
            >>> rotated_pitch_specifier = pitch_specifier.rotate(1)
            >>> print(format(rotated_pitch_specifier))
            consort.tools.PitchSpecifier(
                pitch_segments=(
                    pitchtools.PitchSegment(
                        (
                            pitchtools.NamedPitch('b'),
                            ),
                        item_class=pitchtools.NamedPitch,
                        ),
                    pitchtools.PitchSegment(
                        (
                            pitchtools.NamedPitch("c'"),
                            pitchtools.NamedPitch('f'),
                            pitchtools.NamedPitch('a'),
                            ),
                        item_class=pitchtools.NamedPitch,
                        ),
                    pitchtools.PitchSegment(
                        (
                            pitchtools.NamedPitch("fs'"),
                            pitchtools.NamedPitch("e'"),
                            ),
                        item_class=pitchtools.NamedPitch,
                        ),
                    ),
                ratio=mathtools.Ratio((3, 1, 2)),
                )

        Returns new pitch specifier.
        '''
        rotation = int(rotation)
        pitch_segments = tuple(
            _.rotate(rotation, transpose=True)
            for _ in self.pitch_segments
            )
        pitch_segments = sequencetools.rotate_sequence(
            pitch_segments, rotation)
        ratio = sequencetools.rotate_sequence(self.ratio, rotation)
        return new(
            self,
            pitch_segments=pitch_segments,
            ratio=ratio,
            )
Exemplo n.º 37
0
def test_AbsolutePitchHandler_02():
    pitch_handler = consort.AbsolutePitchHandler(
        pitch_specifier=consort.PitchSpecifier(pitch_segments=("c' e' g'",), ratio=(1,))
    )
    segment_maker = consort.SegmentMaker(
        discard_final_silence=True,
        desired_duration_in_seconds=1,
        omit_stylesheets=True,
        score_template=templatetools.GroupedStavesScoreTemplate(staff_count=1),
        settings=consort.MusicSetting(
            timespan_maker=consort.FloodedTimespanMaker(), v1=new(music_specifier, pitch_handler=pitch_handler)
        ),
        tempo=indicatortools.Tempo((1, 4), 60),
        permitted_time_signatures=((1, 4),),
    )
    lilypond_file, metadata = segment_maker(segment_metadata=segment_metadata)
    assert format(lilypond_file) == systemtools.TestManager.clean_string(
        r"""
        \version "2.19.44"
        \language "english"

        #(ly:set-option 'relative-includes #t)

        \score {
            \context Score = "Grouped Staves Score" <<
                \tag #'time
                \context TimeSignatureContext = "Time Signature Context" {
                    {
                        \tempo 4=60
                        \time 1/4
                        s1 * 1/4
                    }
                }
                \context StaffGroup = "Grouped Staves Staff Group" <<
                    \context Staff = "Staff 1" {
                        \context Voice = "Voice 1" {
                            {
                                % [Voice 1] Measure 1
                                {
                                    c'16 [
                                    \set stemLeftBeamCount = 2
                                    \set stemRightBeamCount = 2
                                    e'16
                                    \set stemLeftBeamCount = 2
                                    \set stemRightBeamCount = 2
                                    g'16
                                    \set stemLeftBeamCount = 2
                                    c'16 ]
                                }
                            }
                        }
                    }
                >>
            >>
        }
        """
    )
Exemplo n.º 38
0
def test_new_03():

    old_aggregate = Aggregate(pitch_segment=abjad.PitchSegment("c d e f"))

    assert format(old_aggregate) == abjad.String.normalize(
        r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            )
        """
    )

    new_aggregate = abjad.new(
        old_aggregate, pitch_segment="af bf df", ratio=(5, 4)
    )

    assert new_aggregate is not old_aggregate
    assert new_aggregate != old_aggregate
    assert format(old_aggregate) == abjad.String.normalize(
        r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            )
        """
    )
    assert format(new_aggregate) == abjad.String.normalize(
        r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('af'),
                    abjad.NamedPitch('bf'),
                    abjad.NamedPitch('df'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            ratio=abjad.Ratio((5, 4)),
            )
        """
    )
Exemplo n.º 39
0
    def __mul__(self, argument):
        """
        Multiplies typed tuple by ``argument``.

        Returns new typed tuple.
        """
        import abjad

        items = self._collection * argument
        return abjad.new(self, items=items)
Exemplo n.º 40
0
 def add_rhythms(self, score, rhythm_maker, durations):
     selection = abjad.select(score).components(abjad.Voice)
     counts = list(rhythm_maker.talea.counts)
     for voice in selection:
         print(counts)
         rhythm_maker = abjad.new(rhythm_maker, talea__counts=counts)
         rhythm = rhythm_maker(durations)
         voice.extend(rhythm)
         counts = counts[1:] + [counts[0]]
     return score
Exemplo n.º 41
0
def add_rhythms(score, rhythm_maker, durations):
    selection = abjad.select(score).components(abjad.Voice)
    counts = list(rhythm_maker.talea.counts)
    for voice in selection:
        print(counts)
        rhythm_maker = abjad.new(rhythm_maker, talea__counts=counts)
        rhythm = rhythm_maker(durations)
        voice.extend(rhythm)
        counts = counts[1:] + [counts[0]]
    return score
Exemplo n.º 42
0
 def _iterate(self, state=None):
     if self.key:
         for _ in self._loop(self._repetitions):
             for i, x in enumerate(self._pattern):
                 if i == 0:
                     x = new(x, **{self.key: True})
                 yield x
     else:
         for _ in self._loop(self._repetitions):
             yield from self._pattern
Exemplo n.º 43
0
def test_new_02():

    old_aggregate = Aggregate(pitch_segment=abjad.PitchSegment('c d e f'),
                              ratio=abjad.Ratio([1, 2, 3]))

    assert format(old_aggregate) == abjad.String.normalize(r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            ratio=abjad.Ratio((1, 2, 3)),
            )
        """)

    new_aggregate = abjad.new(
        old_aggregate,
        ratio=(4, 5),
    )

    assert new_aggregate is not old_aggregate
    assert new_aggregate != old_aggregate
    assert format(old_aggregate) == abjad.String.normalize(r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            ratio=abjad.Ratio((1, 2, 3)),
            )
        """)
    assert format(new_aggregate) == abjad.String.normalize(r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            ratio=abjad.Ratio((4, 5)),
            )
        """)
Exemplo n.º 44
0
    def __call__(self, argument):
        """
        Calls retrograde on `argument`.

        ..  container:: example

            Gets retrograde pitch classes:

            >>> retrograde = abjad.Retrograde()
            >>> segment = abjad.PitchClassSegment([0, 1, 4, 7])
            >>> retrograde(segment)
            PitchClassSegment([7, 4, 1, 0])

        ..  container:: example

            Does not retrograde single pitches or pitch-classes:

            >>> retrogresion = abjad.Retrograde()
            >>> pitch_class = abjad.NumberedPitchClass(6)
            >>> retrograde(pitch_class)
            NumberedPitchClass(6)

        ..  container:: example

            Periodic retrograde:

            ..  todo:: Deprecated.

            >>> retrograde = abjad.Retrograde(period=3)
            >>> segment = abjad.PitchSegment("c' d' e' f' g' a' b' c''")
            >>> retrograde(segment)
            PitchSegment("e' d' c' a' g' f' c'' b'")

        Returns new object with type equal to that of `argument`.
        """
        import abjad
        if isinstance(argument, (abjad.Pitch, abjad.PitchClass)):
            return argument
        if not isinstance(argument, (
                abjad.PitchSegment,
                abjad.PitchClassSegment,
        )):
            argument = abjad.PitchSegment(argument)
        if not self.period:
            return type(argument)(reversed(argument))
        result = abjad.new(argument, items=())
        for shard in abjad.sequence(argument).partition_by_counts(
            [self.period],
                cyclic=True,
                overhang=True,
        ):
            shard = type(argument)(shard)
            shard = type(argument)(reversed(shard))
            result = result + shard
        return result
Exemplo n.º 45
0
    def pitch_class_segment(self, **keywords) -> "Expression":
        r"""
        Makes pitch-class segment subclass expression.
        ..  container:: example
            Makes expression to apply alpha transform to pitch-class segment:
            >>> mccartney.PitchClassSegment([-2, -1.5, 6, 7, -1.5, 7])
            PitchClassSegment([10, 10.5, 6, 7, 10.5, 7])
            >>> segment = mccartney.PitchClassSegment([-2, -1.5, 6, 7, -1.5, 7])
            >>> abjad.show(segment, strict=89) # doctest: +SKIP
            ..  container:: example expression
                >>> expression = mccartney.Expression(name='J')
                >>> expression = expression.pitch_class_segment()
                >>> expression = expression.alpha()
                >>> expression([-2, -1.5, 6, 7, -1.5, 7])
                PitchClassSegment([11, 11.5, 7, 6, 11.5, 6])
                >>> segment = expression([-2, -1.5, 6, 7, -1.5, 7])
                >>> markup = expression.get_markup()
                >>> abjad.show(segment, figure_name=markup) # doctest: +SKIP
                ..  docs::
                    >>> lilypond_file = segment.__illustrate__(
                    ...     figure_name=markup,
                    ...     )
                    >>> abjad.f(lilypond_file[abjad.Staff])
                    \new Staff
                    {
                        \new Voice
                        {
                            b'8
                            ^ \markup {
                                \concat
                                    {
                                        A
                                        \bold
                                            J
                                    }
                                }
                            bqs'8
                            g'8
                            fs'8
                            bqs'8
                            fs'8
                            \bar "|." %! SCORE_1
                            \override Score.BarLine.transparent = ##f
                        }
                    }
        """
        from .pitchclasses import PitchClassSegment

        class_ = PitchClassSegment
        callback = self._make_initializer_callback(class_,
                                                   module_names=["mccartney"],
                                                   string_template="{}",
                                                   **keywords)
        expression = self.append_callback(callback)
        return abjad.new(expression, proxy_class=class_)
Exemplo n.º 46
0
 def _get_lilypond_format_bundle(self, component=None):
     bundle = abjad.LilyPondFormatBundle()
     if not self.hide:
         if self.tweaks:
             tweaks = self.tweaks._list_format_contributions()
             bundle.after.markup.extend(tweaks)
         markup = self._get_markup()
         markup = abjad.new(markup, direction=abjad.Up)
         markup_format_pieces = markup._get_format_pieces()
         bundle.after.markup.extend(markup_format_pieces)
     return bundle
Exemplo n.º 47
0
def test_new_01():

    old_aggregate = Aggregate(
        pitch_segment=abjad.PitchSegment("c d e f"),
        ratio=abjad.Ratio([1, 2, 3]),
    )

    assert abjad.storage(old_aggregate) == abjad.String.normalize(r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            ratio=abjad.Ratio((1, 2, 3)),
            )
        """)

    new_aggregate = abjad.new(old_aggregate)

    assert new_aggregate is not old_aggregate
    assert new_aggregate == old_aggregate
    assert abjad.storage(old_aggregate) == abjad.String.normalize(r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            ratio=abjad.Ratio((1, 2, 3)),
            )
        """)
    assert abjad.storage(new_aggregate) == abjad.String.normalize(r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            ratio=abjad.Ratio((1, 2, 3)),
            )
        """)
Exemplo n.º 48
0
 def _is_equivalent_under_transposition(self, argument):
     import abjad
     if not isinstance(argument, type(self)):
         return False
     if not len(self) == len(argument):
         return False
     difference = -(abjad.NamedPitch(argument[0], 4) -
                    abjad.NamedPitch(self[0], 4))
     new_pitches = (x + difference for x in self)
     new_pitches = abjad.new(self, items=new_pitches)
     return argument == new_pitches
Exemplo n.º 49
0
 def _coerce_iterator_output(self, expr, state):
     from supriya.tools import patterntools
     expr = super(Pbus, self)._coerce_iterator_output(expr)
     kwargs = {}
     if expr.get('target_node') is None:
         kwargs['target_node'] = state['group_uuid']
     if (isinstance(expr, patterntools.NoteEvent) and
         expr.get('out') is None):
         kwargs['out'] = state['bus_uuid']
     expr = new(expr, **kwargs)
     return expr
Exemplo n.º 50
0
 def _coerce_iterator_output(self, expr, state):
     from supriya.tools import patterntools
     expr = super(Pbus, self)._coerce_iterator_output(expr)
     kwargs = {}
     if expr.get('target_node') is None:
         kwargs['target_node'] = state['group_uuid']
     if (isinstance(expr, patterntools.NoteEvent) and
         expr.get('out') is None):
         kwargs['out'] = state['bus_uuid']
     expr = new(expr, **kwargs)
     return expr
Exemplo n.º 51
0
def make_final_markup():
    r'''Makes final markup.

    Returns markup.
    '''
    place_markup = abjad.Markup('Cambridge, MA – Madison, WI – Palo Alto, CA.')
    date_markup = abjad.Markup('Nov. 2015 – Jul. 2016.')
    final_markup = abjad.Markup.right_column([place_markup, date_markup])
    final_markup = final_markup.italic()
    final_markup = final_markup.with_color('black')
    final_markup = abjad.new(final_markup, direction=Down)
    return final_markup
Exemplo n.º 52
0
def test_new_03():

    old_aggregate = Aggregate(pitch_segment=abjad.PitchSegment('c d e f'), )

    assert format(old_aggregate) == abjad.String.normalize(r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            )
        """)

    new_aggregate = abjad.new(
        old_aggregate,
        pitch_segment='af bf df',
        ratio=(5, 4),
    )

    assert new_aggregate is not old_aggregate
    assert new_aggregate != old_aggregate
    assert format(old_aggregate) == abjad.String.normalize(r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            )
        """)
    assert format(new_aggregate) == abjad.String.normalize(r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('af'),
                    abjad.NamedPitch('bf'),
                    abjad.NamedPitch('df'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            ratio=abjad.Ratio((5, 4)),
            )
        """)
Exemplo n.º 53
0
 def __init__(self,
              commands: typing.Sequence["CommandTyping"] = None,
              **keywords) -> None:
     commands_: typing.List[CommandTyping] = []
     for command in commands or []:
         if isinstance(command, (Command, Suite)):
             command_ = abjad.new(command, **keywords)
             commands_.append(command_)
             continue
         message = "\n  Must contain only commands, maps, suites."
         message += f"\n  Not {type(command).__name__}: {command!r}."
         raise Exception(message)
     self._commands = tuple(commands_)
Exemplo n.º 54
0
 def sequence(self, **keywords) -> "Expression":
     """
     Makes sequence expression.
     """
     name = keywords.pop("name", None)
     expression = Expression(name=name)
     callback = expression._make_initializer_callback(
         Sequence,
         module_names=["mccartney"],
         string_template="{}",
         **keywords)
     expression_ = expression.append_callback(callback)
     return abjad.new(expression_, proxy_class=Sequence)
Exemplo n.º 55
0
def test_new_05():

    old_aggregate = Aggregate(pitch_segment=abjad.PitchSegment("c d e f"))

    assert abjad.storage(old_aggregate) == abjad.String.normalize(r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            )
        """)

    new_aggregate = abjad.new(old_aggregate,
                              ratio=[4, 5],
                              pitch_segment__rotate=2)

    assert new_aggregate is not old_aggregate
    assert new_aggregate != old_aggregate
    assert abjad.storage(old_aggregate) == abjad.String.normalize(r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            )
        """)
    assert abjad.storage(new_aggregate) == abjad.String.normalize(r"""
        test_new.Aggregate(
            pitch_segment=abjad.PitchSegment(
                (
                    abjad.NamedPitch('e'),
                    abjad.NamedPitch('f'),
                    abjad.NamedPitch('c'),
                    abjad.NamedPitch('d'),
                    ),
                item_class=abjad.NamedPitch,
                ),
            ratio=abjad.Ratio((4, 5)),
            )
        """)
Exemplo n.º 56
0
 def _handle_last(self, expr, state):
     from supriya.tools import patterntools
     _, group_uuids, _ = state
     delta = expr.delta
     delta += (self._release_time or 0)
     expr = new(expr, delta=delta)
     events = []
     for group_uuid in group_uuids:
         group_event = patterntools.GroupEvent(
             uuid=group_uuid,
             is_stop=True,
         )
         events.append(group_event)
     return expr, events
Exemplo n.º 57
0
    def multiply(self, n):
        r'''Multiplies pitch-class set by `n`.

        ..  container:: example

            >>> abjad.PitchClassSet(
            ...     [-2, -1.5, 6, 7, -1.5, 7],
            ...     ).multiply(5)
            PitchClassSet([2, 4.5, 6, 11])

        Returns new pitch-class set.
        '''
        import abjad
        items = (pitch_class.multiply(n) for pitch_class in self)
        return abjad.new(self, items=items)
Exemplo n.º 58
0
 def _iterate(self, state=None):
     event_pattern = iter(self._event_pattern)
     patterns = self._coerce_pattern_pairs(self._patterns)
     while True:
         try:
             event = next(event_pattern)
         except StopIteration:
             return
         template_dict = {}
         for name, pattern in patterns.items():
             try:
                 template_dict[name] = next(pattern)
             except StopIteration:
                 return
         yield new(event, **template_dict)
Exemplo n.º 59
0
 def __call__(self, execution_time, scheduled_time, communicate=True):
     if self._iterator is None:
         self._iterator = self._iterate_outer(
             pattern=self._pattern,
             server=self._server,
             timestamp=scheduled_time,
             uuids=self._uuids,
         )
     event_products, delta = next(self._iterator)
     node_free_ids, requests = set(), []
     for event_product in event_products:
         if not event_product.event:
             continue
         for request in event_product.requests:
             if isinstance(request, requesttools.NodeFreeRequest):
                 node_free_ids.update(request.node_ids)
             else:
                 requests.append(request)
         if event_product.is_stop:
             proxies = self._uuids[event_product.uuid]
             for proxy_id, proxy in proxies.items():
                 if isinstance(proxy, (
                         servertools.Bus,
                         servertools.BusGroup,
                 )):
                     allocator = servertools.Bus._get_allocator(
                         calculation_rate=proxy.calculation_rate,
                         server=self._server,
                     )
                     allocator.free(proxy_id)
             self._uuids.pop(event_product.uuid)
     if node_free_ids:
         node_free_ids = sorted(node_free_ids)
         request = requesttools.NodeFreeRequest(node_ids=node_free_ids)
         requests.append(request)
     consolidated_bundle = requesttools.RequestBundle(
         timestamp=scheduled_time,
         contents=requests,
     )
     if communicate:
         osc_bundle = consolidated_bundle.to_osc_bundle()
         osc_bundle = new(
             osc_bundle,
             timestamp=osc_bundle.timestamp + self._server.latency,
         )
         self._server.send_message(osc_bundle)
         return delta
     return consolidated_bundle, delta
Exemplo n.º 60
0
    def _is_equivalent_under_transposition(self, argument):
        r'''True if pitch set is equivalent to `argument` under transposition.
        Otherwise false.

        Returns true or false.
        '''
        import abjad
        if not isinstance(argument, type(self)):
            return False
        if not len(self) == len(argument):
            return False
        difference = -(abjad.NamedPitch(argument[0], 4) -
                       abjad.NamedPitch(self[0], 4))
        new_pitches = (x + difference for x in self)
        new_pitches = abjad.new(self, items=new_pitches)
        return argument == new_pitches