First of all, thanks for this project! I'm working on a Raspberry Pi based MIDI sequencer and I'm using isobar
to sync the timeline to an external MIDI clock, and to send MIDI events to external gear (I'm testing with a MFB-503 drumcomputer).
When I press a button on the hardware sequencer, a Node.js script sends the updated sequence data into the Python process where isobar
is running.
I just can't seem to figure out how to update a running sequence without it falling silent until it repeats.
I want to update the notes in place, basically swapping notes/CC in the existing sequence while it keeps playing/repeating.
In the picture I've got 3 tracks (16, 14, 10 steps) with some trigs as an example, each track is scheduled separately in isobar
.
It kind of works when I set the quantize=4
parameter. The tracks will sync up correctly when the pattern loops after 4 beats (16 steps with a duration of 0.25). But if the sequence is running and I update it when e.g. 10 steps are remaining, the final 10 steps are silent until the pattern loops again.
This is my (simplified) current approach:
_, bpm, midi_clock_in_name, midi_mfb503_out_name = sys.argv
midi_in = iso.MidiInputDevice(device_name=midi_clock_in_name)
midi_out = iso.MidiOutputDevice(device_name=midi_mfb503_out_name, send_clock=True)
timeline = iso.Timeline(bpm, clock_source=midi_in, output_device=midi_out)
events = {}
tracks = {}
while True:
try:
line = input().strip() # receive data from parent process on sequence update
id, trigs, velocities, notes = line.split()
track_name = f"track-{id}"
note_seq, velocity_seq = get_seq(trigs, velocities, notes)
# updated sequence:
# note_seq: [48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48]
# velocity_seq: [127, 0, 0, 0, 127, 0, 0, 0, 127, 0, 127, 0, 127, 0, 0, 0]
events[track_name] = {
iso.EVENT_NOTE: iso.PSequence(note_seq),
iso.EVENT_AMPLITUDE: iso.PSequence(velocity_seq),
iso.EVENT_DURATION: 0.25,
}
if track_name in tracks:
tracks[track_name].update(events[track_name], quantize=4)
else:
tracks[track_name] = timeline.schedule(params=events[track_name], name=track_name, quantize=4)
except EOFError:
break
timeline.run()
How can I update the sequence without it stopping for a few beats? I want the current pattern to keep playing, while updating one or more note/CC values in the pattern.
Any thoughts/tips are much appreciated!