Outputting a list of values from MIDI file (M4L)

Julian Lenz's icon

Hello,

I am building a pipeline with some machine learning software and would like to achieve the following:
1. Drag and drop a MIDI file from Ableton into a M4L Device
2. Click a button (bang), and have a utility 'read' that MIDI clip into a list of values, with the format of:
[start time, duration, velocity]

So if someone brings in a MIDI file with two notes being played, it would output 6 numbers.
Even better if I can somehow restrict what MIDI files can be dragged in, i.e. it will only accepts MIDI files that are exactly 2 bars long.

Is there an existing utility / patch for the above, or if you have any guidance I'd be very appreciative!

double_UG's icon

1. Drag and drop a MIDI file from Ableton into a M4L Device ? do you mean midi Clip?
https://cycling74.com/articles/what's-new-in-live-11-part-2
here you can get the notes of a Midi-Clip to a Dict

If you mean a MIDI File the look at Seq and Seq~ objects.