Access current editor in IDE programmatically?

I think, however, TextView could be also appropriate if you need it to show the information:
https://doc.sccode.org/Classes/TextView.html

If you would like to save the midi input please refer to the following posts: