Code Snippet for Y'All: Capture Incoming MIDI Notes Without Limitations
-
Here's a self-contained snippet that will capture all incoming MIDI notes, from either a live input or from a host sequencer.
Notes—
- As such a function should, it does not require pre-setting a time signature, tempo.
- Code is split into UI and Real-time threads.
- In the example, I am setting a maximum sequence length (ideally) for performance reasons—simply use the "push" array method to remove the note limit as well.
- A test button dumps the captured MIDI data to the console.
- My example only captures note-ons, as it's for a one-shot sample; it's trivial to also capture the note-offs (and other MIDI data) if you're into that kind of thing.
- You can load the resulting captured data into a MIDI Player object.
As always, every line of code is documented, along with discussions of relevant issues.
HiseSnippet 2375.3oc4Y8taiabDmx9XRjtlfb.8C4iKNDzSF1mhjs5cWqaRkrrrCa8eDrjuzhf.g0jqjVbj6xRtzxpAGvk9Rz2f9bzGkh9Dz2f1YVRJRIQ6S13xmpfwcj6Nyr+lYmY1YV1KPZyBCkAFkJOXlOynzuvr+LgZRmITtvv5PiRelYGpuJJfQN05PKiCl4SCCYNFkJs4wHMkJ+HC8u+yu+.pKUXyxFxv30RtM6DtGWkMZuV+Qtq6QTG1.tWNpa1xxVJ5HckQ.d1zrtgO09MzwrynHYaXZT5i55vUxf9JphEZT5QGHcl0ehbpHl9WyC4W4xvWZXzGDT7vGIccPDiiZzYB20oWpdGZ.RoWlUXyXqvuz7TtCe93YViOWOAIii71iRarH71bA30HO7pmCdE.oMyAoONciQCIW5LVfFJKLPdXzIJHfIT8Y+kH1RaGISMH.Lr424NQJ86Jn.3bxOLJ7q.R66yVbhRat1ZZi6TSMPc3HtKCeNmR+nXk9Il8sC39prYPM+wlVBEKXDETt7JdLsFa72qX9Uq9ib14C5R5zt2fKunKo+YV850c.o.B+pJ5+HClvCIgBtuOSQriCBBIbgsziKFqCGHBoh8bof3AnC7TwoQVCXT2mq.u6cfAHpILBMxgKgmfYbpQrTDGIPMvdpjQ1hk1nQg6PBkD9HfdpBjvHYfGUwg0APD2yWFnnBEQIIyjQ6fbBKgfbEiDhApv3TGmXlGEIrQNotb0rZUpzQBlNg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