I am wondering if it possible to write an audio sampler plugin (ideally VST3, but it does not have to be) n that reads ALL of the midi events prior to rendering. What I am trying to do is write an audio plugin wrapper for MuseSounds (see https://www.musehub.com) that makes the library usable in a DAW. The challenge is that the MuseSounds API requires you to specify the duration of the note being played (in addition to the timestamp and some other information). As a result it does not lend itself very well to real-time MIDI processing since we do not know the duration until we get a NOTE OFF event. However, if there was a way to load all of the MIDI events up front, the proper note events could be played at right time during playback using previously computed note durations. This would probably require the user to have some way to refresh the plugin, but if that is the only way to make it work than so be it. I have seen some plugins that do this sort of thing. For example. Logic Pro’s “Mastering” plugin can do this sort of thing. Also, some noise reduction plugins do something similar to get a profile of the “noise”. As I am writing this I realized that there might be one other hacky alternative, which is to do the data acquisition the first time the playback is performed (and output nothing) and the do a proper rendering the second (and up) time around (assuming the track contents did not change). With this approach, in the event of a track change, the old track contents would end up being rendered in the first pass, but the playback would be corrected in the second pass.
Any ideas on how to make this work using JUCE?