Multi part music with new_midi_part

Hello again!
It seems that Covid-19 has left me really slow, because I can not find the reason why this code is not playing the two voices in parallel. I had a look at the Multi-Part music example in the repository, but I don’t see what I am doing wrong.

from scamp import Session
import random

scamp_session = Session(tempo=48)
piano = scamp_session.new_midi_part("piano",
                         midi_output_device=1,
                         start_channel=0)

def arpeggio_up_down(chord, octaves=4):
    arpeggio = []
    # up
    len_chord = len(chord)
    for octave in range(octaves):
        for index in range(len_chord):
            arpeggio.append(chord[index] + octave * 12)
    # down
    arpeggio.append(arpeggio[0] + octaves * 12)
    chord.reverse()
    for octave in range(octaves - 1, -1, -1):
        for index in range(len_chord):
            arpeggio.append(chord[index] + octave * 12)
    arpeggio.pop()
    return arpeggio

def trio_voice(arpeggio):
    while scamp_session.beat() < 100:
        for note in arpeggio:
            print(note)
            piano.play_note(note, random.uniform(0.05, 0.15), 0.5)

print("First voice")
scamp_session.fork(trio_voice(arpeggio_up_down([27, 31, 34], 7)))

print("Second voice")
scamp_session.fork(trio_voice(arpeggio_up_down([34, 39, 43], 6)))

scamp_session.wait_for_children_to_finish()

Nevermind, I found the fork method signature in the documentation and now it’s working:

print("First voice")
scamp_session.fork(trio_voice, (arpeggio_up_down([27, 31, 34], 7), piano1))

print("Second voice")
scamp_session.fork(trio_voice, (arpeggio_up_down([34, 39, 43], 6), piano2))