コード例 #1
0
def notate_voice(part, initial_rest, notesandrests):
    if initial_rest:
        #print(f"{initial_rest=}")
        scamp.wait(initial_rest)
    NOTE = type(music21.note.Note())
    REST = type(music21.note.Rest())
    for event in notesandrests:
        if type(event) == NOTE:
            #print(f"{event=}, {event.quarterLength=}, {event.pitch.midi=}")
            part.play_note(event.pitch.midi, 0.7, event.quarterLength)
        elif type(event) == REST:
            #print(f"{event=}")
            scamp.wait(event.quarterLength)
コード例 #2
0
def repeated_chords(inst,
                    chords,
                    phrase_lengths,
                    voice_manager,
                    length_multiplier_manager,
                    chord_index_seed=0,
                    phrase_length_index_seed=0):

    my_id = VoiceId(repeated_chords.__name__, threading.current_thread().ident)

    chord_index_iterator = 1

    chord_index = chord_index_seed - chord_index_iterator
    phrase_length_index = phrase_length_index_seed - 1

    while voice_manager.should_try_play:

        can_play = voice_manager.request_permission(my_id)

        if can_play:

            chord_index += chord_index_iterator
            current_chord = chords[chord_index % len(chords)]

            phrase_length_index += 1
            mult = length_multiplier_manager.get_length_multiplier(
                repeated_chords.__name__).get_value()
            phrase_length = phrase_lengths[phrase_length_index %
                                           len(phrase_lengths)] * mult

            midi = [
                p.midi_number for p in current_chord.pitches
                if p.overtone_class in [7, 13]
            ]

            inst.play_chord(midi, 0.2, 0.875)
            phrase_length -= 0.875
            inst.play_chord(midi, 0.2, 0.125, "staccato")
            phrase_length -= 0.125

            voice_manager.leave_queue(my_id)

            if voice_manager.should_try_play:
                scamp.wait(phrase_length)

        else:

            scamp.wait(0.1)
コード例 #3
0
def field_triads(inst,
                 chords,
                 phrase_lengths,
                 voice_manager,
                 length_multiplier_manager,
                 chord_index_seed=0,
                 phrase_length_index_seed=0):

    my_id = VoiceId(field_triads.__name__, threading.current_thread().ident)

    chord_index_iterator = 1

    chord_index = chord_index_seed - chord_index_iterator
    phrase_length_index = phrase_length_index_seed - 1

    q = 0

    while q < 5:

        can_play = voice_manager.request_permission(my_id)

        if can_play:

            q += 1

            chord_index += chord_index_iterator
            current_chord = chords[chord_index % len(chords)]

            phrase_length_index += 1
            mult = length_multiplier_manager.get_length_multiplier(
                field_triads.__name__).get_value()
            phrase_length = phrase_lengths[phrase_length_index %
                                           len(phrase_lengths)] * mult

            inst.play_chord([
                p.midi_number for p in current_chord.pitches
                if p.overtone_class in [1, 3, 5]
            ], 0.2, 0.125, "staccato")
            phrase_length -= 0.125

            voice_manager.leave_queue(my_id)

            if voice_manager.should_try_play:
                scamp.wait(Utilities.quantize(phrase_length, 0.125))

        else:

            scamp.wait(1 / 16)
コード例 #4
0
def octaves(inst,
            chords,
            phrase_lengths,
            voice_manager,
            length_multiplier_manager,
            misc_wrapper,
            chord_index_seed=0,
            phrase_length_index_seed=0):

    my_id = VoiceId(octaves.__name__, threading.current_thread().ident)

    chord_index_iterator = 1

    chord_index = chord_index_seed - chord_index_iterator
    phrase_length_index = phrase_length_index_seed - 1

    while voice_manager.should_try_play:

        can_play = voice_manager.request_permission(my_id)

        if can_play:

            chord_index += chord_index_iterator
            current_chord = chords[chord_index % len(chords)]

            phrase_length_index += 1
            mult = length_multiplier_manager.get_length_multiplier(
                octaves.__name__).get_value()
            phrase_length = phrase_lengths[phrase_length_index %
                                           len(phrase_lengths)] * mult

            p = [p for p in current_chord.pitches if p.overtone_class == 27][0]
            midi_to_play = [p.midi_number, p.midi_number - 24]
            if not misc_wrapper.should_ban_bass_octaves:
                midi_to_play.extend([p.midi_number - 24, p.midi_number - 36])
            inst.play_chord(midi_to_play, 0.8, 0.125, "staccato")
            phrase_length -= 0.125

            voice_manager.leave_queue(my_id)

            if voice_manager.should_try_play:
                scamp.wait(phrase_length)

        else:

            scamp.wait(0.1)
コード例 #5
0
def perform_cell(input_string,
                 repeats,
                 max_duration,
                 parts,
                 instrument_name,
                 key,
                 check_range=False):
    total_duration = 0
    n = NanoNotation()
    note_pattern = Pseq(n.midinumbers(input_string), repeats)
    dur_pattern = Pseq(n.dur(input_string), repeats)
    for n, d in zip(note_pattern, dur_pattern):
        if total_duration < max_duration:
            prop = {}
            if random.randint(0, 10) > 7:
                accent = 1.0
                prop["articulations"] = "accent"
            else:
                accent = 0.6

            duration = dur_to_beat(d)
            if total_duration + duration > max_duration:
                duration = max_duration - total_duration  #  cut off the rhythm to remain inside measure

            if key:
                prop["key"] = key

            if check_range and not check_range(instrument_name, n):
                print(
                    f"Warning: instrument {instrument_name} goes out of range with note {n}"
                )

            if n == REST:
                scamp.wait(duration)
            else:
                parts[instrument_name].play_note(
                    n,
                    0.7 * accent,
                    duration,
                    properties=prop if prop else None)
            total_duration += duration

        else:
            return
コード例 #6
0
    def leave_queue(self, my_id):

        new_q = [
            elem for elem in self._q
            if (not elem.name == my_id.name
                and not elem.thread_id == my_id.thread_id)
        ]

        if len(new_q) > 0:

            if new_q[0].name == my_id.name:
                # no need to delay, because the next voice waiting to play is of the same type (has the same name)
                pass
            elif self.are_voices_closely_related(my_id.name, new_q[0].name):
                if self.closely_related_dequeue_multiplier > 0:
                    scamp.wait(self._get_dequeue_time() *
                               self.closely_related_dequeue_multiplier)
            else:
                scamp.wait(self._get_dequeue_time())

        else:
            scamp.wait(self._get_dequeue_time())

        with self._lock:
            self._q = new_q
            self.previous_voices.append(my_id.name)
            if len(self.previous_voices) > 2:
                self.previous_voices.pop(0)
コード例 #7
0
def triads_interruption(inst1,
                        inst2,
                        chords,
                        voice_manager,
                        chord_indices,
                        chord_lengths,
                        play_loud_chord=True):

    my_id = VoiceId(triads_interruption.__name__, 0)

    did_play = False

    while not did_play:

        can_play = voice_manager.request_permission(my_id)

        if can_play:

            if (play_loud_chord
                    and not (triads.__name__ in voice_manager.previous_voices)
                    and not (voice_manager.previous_voices[1]
                             == octaves.__name__)):
                inst1.play_chord([
                    p.midi_number for p in chords[chord_indices[0]].pitches
                    if p.overtone_class in [1, 3, 5]
                ], 0.8, 0.125, "staccato")
                scamp.wait(1.0)

            i = -1

            while i < len(chord_indices) - 1:

                i += 1
                selected_chord_index = chord_indices[i]
                current_chord = chords[selected_chord_index]

                length = chord_lengths[i % len(chord_lengths)]

                midi = [
                    p.midi_number + 24 - 1 for p in current_chord.pitches
                    if p.overtone_class in [3, 5]
                ]
                midi.extend([
                    p.midi_number + 36 - 1 for p in current_chord.pitches
                    if p.overtone_class in [1]
                ])

                inst2.play_chord(midi, 0.7, 0.125, "staccato")
                length -= 0.125

                scamp.wait(length)

            voice_manager.leave_queue(my_id)

            did_play = True

        else:

            scamp.wait(0.1)
コード例 #8
0
def field_octaves(inst,
                  chords,
                  phrase_lengths,
                  voice_manager,
                  length_multiplier_manager,
                  pedal_up,
                  pedal_down,
                  chord_index_seed=0,
                  phrase_length_index_seed=0):

    my_id = VoiceId(field_octaves.__name__, threading.current_thread().ident)

    chord_index_iterator = 1

    chord_index = chord_index_seed - chord_index_iterator
    phrase_length_index = phrase_length_index_seed - 1

    q = 0

    while q < 5:

        can_play = voice_manager.request_permission(my_id)

        if can_play:

            q += 1

            chord_index += chord_index_iterator
            current_chord = chords[chord_index % len(chords)]

            phrase_length_index += 1
            mult = length_multiplier_manager.get_length_multiplier(
                field_octaves.__name__).get_value()
            phrase_length = phrase_lengths[phrase_length_index %
                                           len(phrase_lengths)] * mult

            p = [p for p in current_chord.pitches if p.overtone_class == 27][0]
            pedal_up.play_note(0, 0.0, 0.001)
            scamp.wait(0.1)
            pedal_down.play_note(0, 0.0, 0.001)
            inst.play_chord([
                p.midi_number, p.midi_number - 24, p.midi_number - 36,
                p.midi_number + 12
            ], 0.4, 0.125, "staccato")
            phrase_length -= 0.125

            voice_manager.leave_queue(my_id)

            if voice_manager.should_try_play:
                scamp.wait(phrase_length)

        else:

            scamp.wait(0.1)
コード例 #9
0
def grace_notes(inst,
                chords,
                phrase_lengths,
                voice_manager,
                length_multiplier_manager,
                chord_index_seed=0,
                phrase_length_index_seed=0):

    my_id = VoiceId(grace_notes.__name__, threading.current_thread().ident)

    chord_index_iterator = 1

    chord_index = chord_index_seed - chord_index_iterator
    phrase_length_index = phrase_length_index_seed - 1

    reversable_indices = [2, 5, 7, 11]
    jitterable_indices = [1, 2, 4, 6, 7, 11]
    repeatable_indices = [3, 5, 8, 9, 10]

    while voice_manager.should_try_play:

        can_play = voice_manager.request_permission(my_id)

        if can_play:

            chord_index += chord_index_iterator
            current_chord = chords[chord_index % len(chords)]
            # print("playing grace notes " + str(chord_index % len(chords)))

            phrase_length_index += 1
            mult = length_multiplier_manager.get_length_multiplier(
                grace_notes.__name__).get_value()
            phrase_length = phrase_lengths[phrase_length_index %
                                           len(phrase_lengths)] * mult

            midi = [
                p.midi_number for p in current_chord.pitches
                if p.overtone_class in [19, 21]
            ]

            if (chord_index % len(chords) in reversable_indices):
                midi = sorted(midi, reverse=True)

            should_jitter = chord_index % len(chords) in jitterable_indices
            should_repeat = chord_index % len(chords) in repeatable_indices

            if should_jitter or should_repeat:
                for i in range(0, len(midi)):
                    if i == 0:
                        inst.play_note(midi[i],
                                       0.4,
                                       0.125,
                                       properties=[
                                           "staccato", "text: " +
                                           str(chord_index % len(chords))
                                       ])
                        phrase_length -= 0.125
                    elif i == 1 and should_jitter:
                        inst.play_note(midi[i], 0.4, 0.875)
                        phrase_length -= 0.875
                        inst.play_note(midi[i - 1], 0.4, 0.125, "staccato")
                        phrase_length -= 0.125
                    elif i == 1 and should_repeat:
                        inst.play_note(midi[i], 0.4, 0.875)
                        phrase_length -= 0.875
                        inst.play_note(midi[i], 0.4, 0.125, "staccato")
                        phrase_length -= 0.125

            else:
                for i in range(0, len(midi)):
                    properties = ["staccato"]
                    if i == 0:
                        properties.append("text: " +
                                          str(chord_index % len(chords)))
                    inst.play_note(midi[i], 0.4, 0.125, properties=properties)
                    phrase_length -= 0.125

            voice_manager.leave_queue(my_id)

            if voice_manager.should_try_play:
                scamp.wait(phrase_length)

        else:

            scamp.wait(0.1)
コード例 #10
0
def arpeggios(inst,
              chords,
              phrase_lengths,
              voice_manager,
              length_multiplier_manager,
              chord_index_seed=0,
              phrase_length_index_seed=0):

    my_id = VoiceId(arpeggios.__name__, threading.current_thread().ident)

    chord_index_iterator = 5  # NB!

    chord_index = chord_index_seed - chord_index_iterator
    phrase_length_index = phrase_length_index_seed - 1

    reversable_indices = [7, 8, 1, 10]
    jitterable_indices = [7, 2, 1, 5, 8]

    while voice_manager.should_try_play:

        can_play = voice_manager.request_permission(my_id)

        if can_play:

            chord_index += chord_index_iterator
            current_chord = chords[chord_index % len(chords)]

            phrase_length_index += 1
            mult = length_multiplier_manager.get_length_multiplier(
                arpeggios.__name__).get_value()
            phrase_length = phrase_lengths[phrase_length_index %
                                           len(phrase_lengths)] * mult

            midi = [
                p.midi_number for p in current_chord.pitches
                if (p.is_harmonic_tone and p.midi_number >= 67
                    and p.overtone_class not in [27])
            ]

            if (chord_index % len(chords) in reversable_indices):
                midi = sorted(midi, reverse=True)

            jitter_count = 0

            for i in range(0, len(midi)):

                properties = ["staccato"]
                if i == 0:
                    properties.append("text: " +
                                      str(chord_index % len(chords)))
                inst.play_note(midi[i], 0.4, 0.125, properties=properties)
                phrase_length -= 0.125

                if i == 3 and chord_index % len(chords) in jitterable_indices:
                    inst.play_note(midi[i - 1], 0.4, 0.125, "staccato")
                    phrase_length -= 0.125
                    inst.play_note(midi[i], 0.4, 0.125, "staccato")
                    phrase_length -= 0.125

                    inst.play_note(midi[i - 1], 0.4, 0.125, "staccato")
                    phrase_length -= 0.125
                    inst.play_note(midi[i], 0.4, 0.125, "staccato")
                    phrase_length -= 0.125

                    jitter_count += 1

            voice_manager.leave_queue(my_id)

            if voice_manager.should_try_play:
                scamp.wait(phrase_length)

        else:

            scamp.wait(0.1)
コード例 #11
0
pianoteq_field.play_note(chords[0].pitches[0].midi_number, 0.3, 1.66)

pitches = [p for p in chords[0].pitches if p.overtone_class in [3, 5]]
note_lengths = [5, 0.25]
dynamics = [0.2, 0.07]
for l, d in zip(note_lengths, dynamics):
    for p in pitches:
        # 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 27
        if p.overtone_class in [1, 3, 5, 9, 15, 17, 19, 27]:
            pianoteq_field.play_note(p.midi_number, d, l, blocking=False)
        elif p.overtone_class in [7, 11, 13, 21]:
            pianoteq_field_detuned.play_note(p.midi_number,
                                             d,
                                             l,
                                             blocking=False)
        elif p.overtone_class in [13]:
            pianoteq_field_detuned.play_note(p.midi_number + 1,
                                             d,
                                             l,
                                             blocking=False)
    scamp.wait(l)

s.wait(32)
pedal_up.play_note(0, 0.0, 0.01)

# -------------------------------------------------------------------------------------------------------------------------------------------

performance = s.stop_transcribing()
score = performance.to_score(title="Clocks (after Nancarrow)",
                             composer="Alex Stephenson")
score.show()
コード例 #12
0
def perform_cell_spicy(input_string,
                       repeats,
                       max_duration,
                       parts,
                       instrument_name,
                       key,
                       check_range=False):
    total_duration = 0
    n = NanoNotation()
    note_pattern = Pseq(n.midinumbers(input_string), repeats)
    dur_pattern = Pseq(n.dur(input_string), repeats)
    if len(n.midinumbers(input_string)) == 1 and repeats <= 1:
        perform_cell(input_string, repeats, max_duration, parts,
                     instrument_name, key, check_range)
    else:
        last_encountered_nd2 = None
        for nd1, nd2 in pairwise(zip(note_pattern, dur_pattern)):
            last_encountered_nd2 = nd2
            if total_duration < max_duration:
                prop = {}
                if random.randint(0, 10) > 7:
                    accent = 1.0
                    prop["articulations"] = "accent"
                else:
                    accent = 0.6

                n1 = nd1[0]
                n2 = nd2[0]
                d = nd1[1]
                duration = dur_to_beat(d)

                if total_duration + duration > max_duration:
                    duration = max_duration - total_duration  #  cut off the rhythm to remain inside measure

                if key:
                    prop["key"] = key

                if check_range and not check_range(instrument_name, n):
                    print(
                        f"Warning: instrument {instrument_name} goes out of range with note {n}"
                    )

                all_notes, all_durs = transform_note_duration(duration, n1, n2)

                for n, d in zip(all_notes, all_durs):
                    if n == REST:
                        scamp.wait(d)
                    else:
                        parts[instrument_name].play_note(
                            n,
                            0.7 * accent,
                            d,
                            properties=prop if prop else None)
                    total_duration += d
            else:
                return

        if last_encountered_nd2 is not None:
            n = last_encountered_nd2[0]
            d = last_encountered_nd2[1]
            if n == REST:
                scamp.wait(d)
            else:
                parts[instrument_name].play_note(
                    n,
                    0.7 * accent,
                    duration,
                    properties=prop if prop else None)
            total_duration += d
コード例 #13
0
def field_slow_arpeggios(inst1,
                         inst2,
                         chords,
                         phrase_lengths,
                         voice_manager,
                         length_multiplier_manager,
                         pitch_index_seed=0,
                         phrase_length_index_seed=0):

    my_id = VoiceId(field_slow_arpeggios.__name__,
                    threading.current_thread().ident)

    chord_index_iterator = -1

    pitch_index_iterator = 5  # NB!

    pitch_index = pitch_index_seed - pitch_index_iterator
    phrase_length_index = phrase_length_index_seed - 1

    q = 0

    while q < 6:

        can_play = voice_manager.request_permission(my_id)

        if can_play:

            chord_index_iterator += 1
            chord = chords[chord_index_iterator % len(chords)]

            q += 1

            pitches = []

            for _ in range(0, 7):
                pitch_index += pitch_index_iterator
                # if pitch_index % len(chord.pitches) == 0:
                # 	pitch_index += pitch_index_iterator
                pitches.append(chord.pitches[pitch_index % len(chord.pitches)])
            if q == 6:
                pitches.extend(
                    [p for p in chord.pitches if p.overtone_class == 3])
                pitches.extend(
                    [p for p in chord.pitches if p.overtone_class == 1])
                # pitches.extend([p for p in chord.pitches if p.overtone_class == 7])
                # pitches.extend([p for p in chord.pitches if p.overtone_class == 11])

            phrase_length_index += 1
            mult = length_multiplier_manager.get_length_multiplier(
                field_slow_arpeggios.__name__).get_value()
            phrase_length = phrase_lengths[phrase_length_index %
                                           len(phrase_lengths)] * mult

            note_lengths = [0.6, 0.6]
            for _ in range(0, (len(pitches) - 2)):
                note_lengths.append(0.4)

            for p, l in zip(pitches, note_lengths):
                # 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 27
                midi = p.midi_number
                if p.overtone_class in [1, 3, 5, 9, 15, 17, 19, 27]:
                    inst1.play_note(midi, 0.2, l)
                elif p.overtone_class in [7, 11, 13, 21]:
                    inst2.play_note(midi, 0.2, l)
                elif p.overtone_class in [13]:
                    inst2.play_note(midi + 1, 0.2, l)
                phrase_length -= l

            voice_manager.leave_queue(my_id)

            if voice_manager.should_try_play:
                scamp.wait(phrase_length)

        else:

            scamp.wait(0.1)
コード例 #14
0
def field_repeated_chords(inst1,
                          inst2,
                          chords,
                          phrase_lengths,
                          voice_manager,
                          length_multiplier_manager,
                          pitch_index_seed=0,
                          phrase_length_index_seed=0):

    my_id = VoiceId(field_repeated_chords.__name__,
                    threading.current_thread().ident)

    chord_index_iterator = -1

    pitch_index_iterator = 7

    pitch_index = pitch_index_seed - pitch_index_iterator
    phrase_length_index = phrase_length_index_seed - 1

    q = 0

    while q < 5:

        can_play = voice_manager.request_permission(my_id)

        if can_play:

            q += 1

            chord_index_iterator += 1
            chord = chords[chord_index_iterator % len(chords)]

            pitches = []
            for i in range(0, 2):
                pitch_index += pitch_index_iterator
                if i == 1:
                    pitch_index += 4
                pitches.append(chord.pitches[pitch_index % len(chord.pitches)])

            phrase_length_index += 1
            mult = length_multiplier_manager.get_length_multiplier(
                field_repeated_chords.__name__).get_value()
            phrase_length = phrase_lengths[phrase_length_index %
                                           len(phrase_lengths)] * mult

            note_lengths = [5, 0.25]
            dynamics = [0.3, 0.1]

            for l, d in zip(note_lengths, dynamics):
                for p in pitches:
                    # 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 27
                    if p.overtone_class in [1, 3, 5, 9, 15, 17, 19, 27]:
                        inst1.play_note(p.midi_number, d, l, blocking=False)
                    elif p.overtone_class in [7, 11, 13, 21]:
                        inst2.play_note(p.midi_number, d, l, blocking=False)
                    elif p.overtone_class in [13]:
                        inst2.play_note(p.midi_number + 1,
                                        d,
                                        l,
                                        blocking=False)
                scamp.wait(l)
                phrase_length -= l

            voice_manager.leave_queue(my_id)

            if voice_manager.should_try_play:
                scamp.wait(phrase_length)

        else:

            scamp.wait(0.1)
コード例 #15
0
def field_grace_notes(inst1,
                      inst2,
                      chords,
                      phrase_lengths,
                      voice_manager,
                      length_multiplier_manager,
                      pitch_index_seed=0,
                      phrase_length_index_seed=0):

    my_id = VoiceId(field_grace_notes.__name__,
                    threading.current_thread().ident)

    chord_index_iterator = -1

    pitch_index_iterator = 7  # NB!

    repeatable_indices = [7, 9, 4, 6, 3, 10]

    pitch_index = pitch_index_seed - pitch_index_iterator
    phrase_length_index = phrase_length_index_seed - 1

    q = 0

    while q < 6:

        can_play = voice_manager.request_permission(my_id)

        chord_index_iterator += 1
        chord = chords[chord_index_iterator % len(chords)]

        if can_play:

            q += 1

            pitches = []
            pitch_reserves = []
            for i in range(0, 2):
                pitch_index += pitch_index_iterator
                pitches.append(chord.pitches[pitch_index % len(chord.pitches)])
                if (pitch_index % len(chord.pitches) in repeatable_indices):
                    pitch_reserves.append(chord.pitches[pitch_index %
                                                        len(chord.pitches)])
                # print(pitch_index % len(chord.pitches))
            pitches.extend(pitch_reserves)

            note_lengths = [0.25, 1.25, 0.25]

            phrase_length_index += 1
            mult = length_multiplier_manager.get_length_multiplier(
                field_grace_notes.__name__).get_value()
            phrase_length = phrase_lengths[phrase_length_index %
                                           len(phrase_lengths)] * mult

            for p, l in zip(pitches, note_lengths):
                # 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 27
                if p.overtone_class in [1, 3, 5, 9, 15, 17, 19, 27]:
                    inst1.play_note(p.midi_number, 0.2, l)
                elif p.overtone_class in [7, 11, 13, 21]:
                    inst2.play_note(p.midi_number, 0.2, l)
                elif p.overtone_class in [13]:
                    inst2.play_note(p.midi_number + 1, 0.2, l)
                phrase_length -= l

            voice_manager.leave_queue(my_id)

            if voice_manager.should_try_play:
                scamp.wait(phrase_length)

        else:

            scamp.wait(0.1)
コード例 #16
0
def field_true_arpeggios(inst,
                         chords,
                         phrase_lengths,
                         voice_manager,
                         length_multiplier_manager,
                         tempo_factor,
                         chord_index_seed=0,
                         phrase_length_index_seed=0):

    my_id = VoiceId(field_true_arpeggios.__name__,
                    threading.current_thread().ident)

    chord_index_iterator = 1

    chord_index = chord_index_seed - chord_index_iterator
    phrase_length_index = phrase_length_index_seed - 1

    reversable_indices = [7, 8, 1, 10]
    jitterable_indices = [7, 2, 1, 5, 8]

    q = 0

    while q < 6:

        can_play = voice_manager.request_permission(my_id)

        if can_play:

            q += 1
            current_chord = chords[0]

            phrase_length_index += 1
            mult = length_multiplier_manager.get_length_multiplier(
                field_true_arpeggios.__name__).get_value()
            phrase_length = phrase_lengths[phrase_length_index %
                                           len(phrase_lengths)] * mult

            midi = [
                p.midi_number for p in current_chord.pitches
                if (p.is_harmonic_tone and p.midi_number >= 67
                    and p.overtone_class not in [27])
            ][-(8 - q):]

            # print(len(midi))

            if (chord_index % len(chords) in reversable_indices):
                midi = sorted(midi, reverse=True)

            jitter_count = 0

            for i in range(0, len(midi)):

                properties = ["staccato"]
                if i == 0:
                    properties.append("text: " +
                                      str(chord_index % len(chords)))
                inst.play_note(midi[i],
                               0.2,
                               Utilities.quantize(0.125 * tempo_factor, 0.125),
                               properties=properties)
                phrase_length -= 0.125 * tempo_factor

                if i == 3 and chord_index % len(chords) in jitterable_indices:
                    inst.play_note(
                        midi[i - 1], 0.2,
                        Utilities.quantize(0.125 * tempo_factor, 0.125),
                        "staccato")
                    phrase_length -= 0.125 * tempo_factor
                    inst.play_note(
                        midi[i], 0.2,
                        Utilities.quantize(0.125 * tempo_factor, 0.125),
                        "staccato")
                    phrase_length -= 0.125 * tempo_factor

                    inst.play_note(
                        midi[i - 1], 0.2,
                        Utilities.quantize(0.125 * tempo_factor, 0.125),
                        "staccato")
                    phrase_length -= 0.125 * tempo_factor
                    inst.play_note(
                        midi[i], 0.2,
                        Utilities.quantize(0.125 * tempo_factor, 0.125),
                        "staccato")
                    phrase_length -= Utilities.quantize(
                        0.125 * tempo_factor, 0.125)

                    jitter_count += 1

            scamp.wait(1.25)
            inst.play_note(midi[-1], 0.2, 0.125)

            voice_manager.leave_queue(my_id)

            if voice_manager.should_try_play:
                scamp.wait(Utilities.quantize(phrase_length, 0.125))

        else:

            scamp.wait(1 / 16)