def test_ArtificialHarmonic_13():
    harm = auxjad.ArtificialHarmonic(r"<g c'>4")
    assert harm.written_pitches == abjad.PitchSegment(r"g c'")
    harm.written_pitches = r"a d'"
    assert harm.written_pitches == abjad.PitchSegment(r"a d'")
    with pytest.raises(ValueError):
        harm.written_pitches = r"a d' e'"
Ejemplo n.º 2
0
def test_PitchRandomiser_02():
    container = abjad.Container(r"c'4 d'4 e'4 f'4")
    randomiser = auxjad.PitchRandomiser(
        container,
        pitches=r"a b cs' ds' e'",
        weights=[1.0, 2.0, 1.0, 1.5, 1.3],
        omit_time_signatures=True,
        process_on_first_call=True,
        use_tenney_selector=True,
    )
    assert randomiser.pitches == abjad.PitchSegment(r"a b cs' ds' e'")
    assert randomiser.weights == [1.0, 2.0, 1.0, 1.5, 1.3]
    assert randomiser.omit_time_signatures
    assert randomiser.process_on_first_call
    assert randomiser.use_tenney_selector
    randomiser.pitches = abjad.PitchSegment(r"c' d' e' f'")
    randomiser.weights = [1, 2, 5, 8]
    randomiser.omit_time_signatures = False
    randomiser.process_on_first_call = False
    randomiser.use_tenney_selector = False
    assert randomiser.pitches == abjad.PitchSegment(r"c' d' e' f'")
    assert randomiser.weights == [1, 2, 5, 8]
    assert not randomiser.omit_time_signatures
    assert not randomiser.process_on_first_call
    assert not randomiser.use_tenney_selector
def test_ArtificialHarmonic_06():
    harm = auxjad.ArtificialHarmonic(r"<g c'>4")
    assert harm.written_pitches == abjad.PitchSegment(r"g c'")
    assert harm.written_duration == 1 / 4
    assert harm.style == "#'harmonic"
    assert not harm.is_parenthesized
    harm.written_pitches = [-5, 2]
    harm.written_duration = abjad.Duration(1, 8)
    harm.style = "#'harmonic-mixed"
    harm.is_parenthesized = True
    assert harm.written_pitches == abjad.PitchSegment(r"g d'")
    assert harm.written_duration == 1 / 8
    assert harm.style == "#'harmonic-mixed"
    assert harm.is_parenthesized
Ejemplo n.º 4
0
 def __init__(self, pitch_segment=None, ratio=None):
     if pitch_segment is not None:
         pitch_segment = abjad.PitchSegment(pitch_segment)
     self._pitch_segment = pitch_segment
     if ratio is not None:
         ratio = abjad.Ratio(ratio)
     self._ratio = ratio
Ejemplo n.º 5
0
    def voice_scale_degrees_in_open_position(self, scale_degrees):
        r'''Voices `scale_degrees` in open position.

        ..  container:: example

            >>> scale = abjad.tonalanalysistools.Scale(('c', 'major'))
            >>> scale_degrees = [1, 3, 'b5', 7, '#9']
            >>> segment = scale.voice_scale_degrees_in_open_position(
            ...     scale_degrees)
            >>> segment
            PitchSegment("c' e' gf' b' ds''")

        Return pitch segment.
        '''
        import abjad
        from abjad.tools import tonalanalysistools
        scale_degrees = [
            tonalanalysistools.ScaleDegree(x) for x in scale_degrees
        ]
        pitch_classes = [
            self.scale_degree_to_named_pitch_class(x) for x in scale_degrees
        ]
        pitches = [abjad.NamedPitch(pitch_classes[0])]
        for pitch_class in pitch_classes[1:]:
            pitch = abjad.NamedPitch(pitch_class)
            while pitch < pitches[-1]:
                pitch += 12
            pitches.append(pitch)
        pitches = abjad.PitchSegment(pitches)
        return pitches
Ejemplo n.º 6
0
 def __init__(self, pitch_segment=None, sequence=None):
     self._pitch_segment = pitch_segment or abjad.PitchSegment()
     self._sequence = sequence or tuple()
     self._reorder_segment()
     self._make_ascent()
     self._set_arp_pitches()
     self._set_arp_strings()
Ejemplo n.º 7
0
def test_virtual_fundamental_10():
    pitches = abjad.PitchSegment(r"c'' cs'' d'' ef'' e'' fs''")
    with pytest.raises(ValueError):
        auxjad.get.virtual_fundamental(
            pitches,
            min_fundamental=abjad.NamedPitch(r"c'"),
        )
Ejemplo n.º 8
0
def test_virtual_fundamental_09():
    pitches = abjad.PitchSegment(r"c'' cs'' d'' ef'' e'' fs''")
    fundamental = auxjad.get.virtual_fundamental(
        pitches,
        min_fundamental=abjad.NumberedPitch(-48),
    )
    assert fundamental == abjad.NamedPitch(r"d,,")
Ejemplo n.º 9
0
 def _reorder_segment(self):
     """Sets a reordered segment according to sequence"""
     pitches = []
     for i in range(len(self._sequence)):
         seq_val = self._sequence[i]
         pitches.append(self._pitch_segment[seq_val])
     self._reordered_segment = abjad.PitchSegment(pitches)
     print("Reordered pitches: ", self._reordered_segment)
Ejemplo n.º 10
0
 def add_pitches(self, score):
     pitches = abjad.PitchSegment("g b d' f'")
     logical_ties = abjad.select(score).logical_ties(pitched=True)
     for i, logical_tie in enumerate(logical_ties):
         index = i % len(pitches)
         pitch = pitches[index]
         for note in logical_tie:
             note.written_pitch = pitch
     return score
Ejemplo n.º 11
0
 def written_pitches(
     self,
     written_pitches,
 ) -> None:
     written_pitches_ = abjad.PitchSegment(written_pitches)
     if len(written_pitches_) != 2:
         raise ValueError("'ArtificialHarmonic' requires exactly two "
                          "pitches")
     for index, pitch in enumerate(written_pitches_):
         self._note_heads[index].written_pitch = pitch
Ejemplo n.º 12
0
def test_PitchRandomiser_10():
    container = abjad.Container(r"c'8 d'8 e'8 f'8 g'8 a'8 b'8 c'8")
    pitches = r"fs' gs' a' b'"
    randomiser = auxjad.PitchRandomiser(container,
                                        pitches,
                                        weights=[100.0, 1.0, 1.0, 1.0],
                                        )
    randomiser.pitches = r"c'' d'' e'' f''"
    assert randomiser.pitches == abjad.PitchSegment(r"c'' d'' e'' f''")
    assert randomiser.weights == [100.0, 1.0, 1.0, 1.0]
Ejemplo n.º 13
0
    def find_pitches(self, abjad_pitch: abjad.NamedPitch) -> None:
        from mutools import lily

        basic_pitch = abjad.NamedPitch(
            lily.round_scale_index_to_12th_tone(
                float(abjad_pitch) - self.ground_interval))
        harmonic_pitch = abjad.NamedPitch(
            lily.round_scale_index_to_12th_tone(
                float(basic_pitch) + self.harmonic_interval))
        return abjad.PitchSegment([basic_pitch, harmonic_pitch])
Ejemplo n.º 14
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
Ejemplo n.º 15
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)),
            )
        """)
Ejemplo n.º 16
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)),
            )
        """)
Ejemplo n.º 17
0
def _get_artifical_harmonic_pitches(pitch: ji.JIPitch) -> tuple:
    ground_pitch = lily.convert2abjad_pitch(pitch, globals_.RATIO2PITCHCLASS)
    (
        harmonic_pitch_class,
        harmonic_octave_difference,
    ) = globals_.RATIO2ARTIFICAL_HARMONIC_PITCHCLASS_AND_ARTIFICIAL_HARMONIC_OCTAVE[
        pitch.register(0)]
    harmonic_pitch_octave = ground_pitch.octave.number + harmonic_octave_difference
    harmonic_pitch = abjad.NamedPitch(name=harmonic_pitch_class,
                                      octave=harmonic_pitch_octave)
    return abjad.PitchSegment(sorted([ground_pitch, harmonic_pitch]))
Ejemplo n.º 18
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)),
            )
        """)
Ejemplo n.º 19
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)),
            )
        """)
Ejemplo n.º 20
0
def guitar_bitones_test():
    print(
        "Running guitar bitones test using ``muda.Material.guitar_bitones()`` method."
    )
    timespans = muda.alternating_timespans([[1, 1], [1, 1], [1, 1]], 4,
                                           ["matA", "matB"])
    durations = timespans.annotated_durations(subdivision=(2, 4))
    makers = {
        "matA": rmakers.stack(rmakers.note()),
        "matB": rmakers.stack(rmakers.note())
    }
    mat = muda.Material("A")
    mat.alternating_materials(durations, makers)
    pitches = {
        "matA": abjad.PitchSegment("fs'"),
        "matB": abjad.PitchSegment("ds'"),
    }
    pitched_leaves = lambda _: abjad.select.leaves(_)
    mat.write_pitches_by_name(pitches)
    mat.attach(abjad.StringNumber([2]), pitched_leaves, "matA")
    mat.attach(abjad.StringNumber([3]), pitched_leaves, "matB")
    mat.guitar_bitones(pitched_leaves, "matA", hammering=True)
    mat.print()
Ejemplo n.º 21
0
def material_test():
    print(
        "Running material test using ``muda.Material()`` class and its methods."
    )
    timespans = muda.alternating_timespans([[1, 1], [1, 1], [1, 1]], 2,
                                           ["matA", "matB"])
    durations = timespans.annotated_durations(subdivision=(2, 4))
    makers = {
        "matA":
        rmakers.stack(rmakers.talea([-1, 2, -1], 16),
                      rmakers.extract_trivial()),
        "matB":
        rmakers.stack(rmakers.talea([1, 1, 1, 1], 16),
                      rmakers.extract_trivial()),
    }
    mat = muda.Material("A")
    mat.alternating_materials(durations, makers)
    pitches = {
        "matA": abjad.PitchSegment("fs'"),
        "matB": abjad.PitchSegment("ds'"),
    }
    mat.write_pitches_by_name(pitches)
    mat.material_name_markups(["matA", "matB"])
Ejemplo n.º 22
0
def invert_down(segment, inversion):
    """
    inverts a chord downwards
    assumes segment is within octave range
    returns new pitch segment

    Warning: no sanity check on transposition at the moment
    i.e. you can invert -433 times and still generate strings
    that represent pitches
    """

    if inversion > 0:
        print("Inversion needs to be a negative int")
    interval = -12
    new_segment = segment
    print("Initial segment: ", new_segment)
    for i in range(abs(inversion)):
        print("nwseg at top: ", new_segment)
        segment = new_segment
        highest_note = get_global_maxima(
            segment)  #call global_minima to find lowest note
        print("top note: ", highest_note)
        set_ = abjad.PitchSet(
            items=[highest_note.name],
            item_class=abjad.NamedPitch,
        )
        transposed_set = set_.transpose(
            interval)  #transposed note is lowest note.tranpose("+P8")
        print("transposed note: ", transposed_set)
        transposed_pitch = None
        for i in transposed_set:
            transposed_pitch = abjad.NamedPitch(i)  # initialize as named pitch
            print("items: ", i)
        print("transposed_pitch: ", transposed_pitch)
        new_pitches = []
        segment_len = len(segment)
        section = range(0, segment_len - 1)  # trim lowest note
        new_pitches.append(transposed_pitch)  # append transposed
        for i in section:
            new_pitches.append(segment[i])
            print(new_pitches)
        print("list of new pitches: ", new_pitches)
        new_segment = abjad.PitchSegment(new_pitches)  # make new segment
        print("nwseg: ", new_segment)
    return new_segment
Ejemplo n.º 23
0
 def pitches(
     self,
     pitches: Union[list[Union[int, float, str, abjad.Pitch]],
                    tuple[Union[int, float, str,
                                abjad.Pitch]], str, abjad.PitchSegment, ],
 ) -> None:
     if not isinstance(pitches, (list, tuple, str, abjad.PitchSegment)):
         raise TypeError("'pitches' must be 'list', 'tuple', 'str', or "
                         "'abjad.PitchSegment'")
     if isinstance(pitches, (list, tuple, str)):
         self._pitches = abjad.PitchSegment(pitches)
     else:
         self._pitches = pitches
     pitch_list = [pitch for pitch in self._pitches]
     self._tenney_selector = TenneySelector(pitch_list)
     if self._weights is not None:
         if len(pitch_list) != len(self._weights):
             self.weights = None
Ejemplo n.º 24
0
    def written_pitches(self):
        """
        Written pitches in chord.

        ..  container:: example

            Get written pitches:

            >>> chord = abjad.Chord("<g' c'' e''>4")
            >>> abjad.show(chord) # doctest: +SKIP

            >>> chord.written_pitches
            PitchSegment("g' c'' e''")

        ..  container:: example

            Set written pitches with pitch names:

            >>> chord = abjad.Chord("<e' g' c''>4")
            >>> abjad.show(chord) # doctest: +SKIP

            >>> chord.written_pitches = "f' b' d''"
            >>> abjad.show(chord) # doctest: +SKIP

            ..  docs::

                >>> abjad.f(chord)
                <f' b' d''>4

            >>> chord.written_pitches
            PitchSegment("f' b' d''")

        Set written pitches with any iterable.

        Returns tuple.
        """
        import abjad
        return abjad.PitchSegment(
            items=(note_head.written_pitch for note_head in self.note_heads),
            item_class=abjad.NamedPitch,
        )
Ejemplo n.º 25
0
def invert_up(segment, inversion):
    """
    inverts a chord upwards
    assumes segment is within octave range
    returns new pitch segment

    Warning: no sanity check on transposition at the moment
    i.e. you can invert 433 times and still generate strings
    that represent pitches
    """
    interval = 12
    new_segment = segment

    if inversion < 0:
        print("Inversion needs to be a positive int")
    for i in range(inversion):
        segment = new_segment
        lowest_note = get_global_minima(
            segment)  #call global_minima to find lowest note
        set_ = abjad.PitchSet(
            items=[lowest_note.name],
            item_class=abjad.NamedPitch,
        )
        transposed_set = set_.transpose(
            interval)  #transposed note is lowest note.tranpose("+P8")
        transposed_pitch = None
        for i in transposed_set:
            transposed_pitch = abjad.NamedPitch(i)
        new_pitches = []
        segment_len = len(segment)
        section = range(1, segment_len)  # trim lowest note
        for i in section:
            new_pitches.append(segment[i])
        new_pitches.append(transposed_pitch)  # append transposed
        new_segment = abjad.PitchSegment(new_pitches)  # make new segment
    return new_segment
Ejemplo n.º 26
0
import abjad
import abjadext.rmakers

staff = abjad.Staff(
    segment = (
        abjad.PitchSegment(
        [
            "e'",
            "ef'",
            "c'"
            "cs'"
        ]
        )
    )

    rhs = [(1, 4), (3, 8), (2, 4), (1, 8)]

    rhythms = [abjad.Duration(x) for x in rhs]

    zip(pitches, abjad.select(rhythms).logical_ties(pitched=True):
        for leaf in tie:
                leaf.written_pitch = pitch)
)

abjad.f(staff)
Ejemplo n.º 27
0
    def __call__(self, argument):
        """
        Calls rotation on `argument`.

        ..  container:: example

            Rotates pitch classes:

            >>> rotation = abjad.Rotation(n=1)
            >>> pitch_classes = abjad.PitchClassSegment([0, 1, 4, 7])
            >>> rotation(pitch_classes)
            PitchClassSegment([7, 0, 1, 4])

        ..  container:: example

            Rotates pitch classes with Stravinsky-style back-transposition to
            zero:

            >>> rotation = abjad.Rotation(n=1, stravinsky=True)
            >>> pitch_classes = abjad.PitchClassSegment([0, 1, 4, 7])
            >>> rotation(pitch_classes)
            PitchClassSegment([0, 5, 6, 9])

        ..  container:: example

            Does not rotate single pitches or pitch-classes:

            >>> rotation = abjad.Rotation(n=1)
            >>> pitch_class = abjad.NumberedPitchClass(6)
            >>> rotation(pitch_class)
            NumberedPitchClass(6)

        ..  container:: example

            Periodic rotation:

            ..  todo:: Deprecated.

            >>> rotation = abjad.Rotation(n=1, period=3)
            >>> pitches = abjad.PitchSegment("c' d' e' f' g' a' b' c''")
            >>> rotation(pitches)
            PitchSegment("e' c' d' a' f' g' c'' b'")

        ..  container:: example

            Stravinsky-style periodic rotation:

            ..  todo:: Deprecated.

            >>> rotation = abjad.Rotation(
            ...     n=1,
            ...     period=3,
            ...     stravinsky=True,
            ...     )
            >>> pitches = abjad.PitchSegment("c' d' e' f' g' a' b' c''")
            >>> rotation(pitches)
            PitchSegment("c' af bf f' df' ef' b' as'")

        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 argument.rotate(self.n, stravinsky=self.stravinsky)
        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 = shard.rotate(self.n, stravinsky=self.stravinsky)
            result = result + shard
        return result
Ejemplo n.º 28
0
import abjad

chord_01 = abjad.PitchSegment("af'' g'' fs'' " + "f'' d'' cs'' " +
                              "b'' af'' g'' " + "e'' c'' g'' " +
                              "fs'' cs'' gs''")

chord_02 = abjad.PitchSegment("af'' g'' fs'' " + "f'' d'' cs'' " +
                              "b'' af'' g'' " + "e'' c'' g'' " +
                              "fs'' cs'' gs''")

pitch_list_01 = [
    chord_01, chord_02, chord_01, chord_02, chord_01, chord_02, chord_01
]
Ejemplo n.º 29
0
def test_virtual_fundamental_11():
    pitches = abjad.PitchSegment(r"c'' g''")
    fundamental = abjad.get.virtual_fundamental(pitches)
    assert fundamental == abjad.NamedPitch(r"c'")
Ejemplo n.º 30
0
def test_virtual_fundamental_04():
    pitches = abjad.PitchSegment(r"c'' d'' ef'' fs''")
    fundamental = auxjad.get.virtual_fundamental(pitches)
    assert fundamental == abjad.NamedPitch(r"bf,,")