I want to implement a feature in a plugin related to the length of an incoming note.
To my understanding JUCE’s MidiMessage contains only the timestamp for the beginning of the note, am I right?
I wonder if any of the plugin standards are capable to receive information about a note’s length, and of course wether any of the industry standard plugin hosts can implement this.
Thank you! Erez
as MIDI is a streaming protocol, how would that even be possible?
When I hit a note on a keyboard, a “note on” message must be sent.
But how would it be possible to know at that moment already when I am going to release that note (which will happen sometime in the future)?
Only when you release the key on the keyboard, a “note off” message can be sent, so there is no way to know the duration of a note at the moment you start it.
For playing back from pre-recorded musical/MIDI sequences, that might be possible, but for MIDI in general as a streaming protocol, it’s not.
If you want to know the duration of a particular note after it stopped, you’ll need to keep track of when the start for that note happened in the past and calculate the time difference (either in musical time (ticks) or wall-clock time (seconds), depending on what you need).
Oh, sorry I didn’t explain myself good enough. Since MIDI has become also the standard for sending messages in virtual sequencers, I am only talking about implementing this kind of information in sequencers, where the length of the note is known in advanced.
It doesn’t have to be a required information in a midi message but an optional one to be implemented by digital sequencers.
I need this kind of information to create a Midi effect that generate midi notes time based on a division of the incoming note length.
You’ll probably have to keep track of the noteOn and noteOff for the same note number and calculate the length
It has to be real time. So as the ‘note on’ is played I need to know when will the note off be triggered. Just wondered if this kind of midi message information exist in any of the plugin formats.
It can be so incredibly useful for various applications.
That’s an impossible question to answer… when will the keyboard player lift his finger? Unless you don’t want real time triggering…
In a Delphi VST plugin I wrote ages ago, I queued auto generated MIDI Note offs Nms after Note on… Worked OK for me.
Again, I talk only about sequencers where the length is known in advanced
Would be nice to have, but the MIDI spec has no way of transmitting a note length, so the answer is no, even if the DAWs wanted to send this info, there’s no way for them to do it.
I think the only way you’ll be able to do this is by having a “Capture” button where you can record the MIDI sequence… then use the captured sequence to get your note lengths… when your plugin isn’t in Capture mode do whatever you want to do. I believe Auto-Tune did something like that.
Like Jules pointed out, it is not in the MIDI specs, so the only option is to use another protocol. You could make something up based on MIDI, but nobody except yourself would understand it.
You can use an alternative like MusicXML, it provides note lengths etc, but has other disadvantages.
Or you come up with something new and become that successfull, that everybody wants to implement your new protocol
I thought because the plugin standards require a sort of conversion of the Midi note to the Midi Message format of the plugin it could be possible to add extra information.
Anyway I guess updating a 36 years old protocol in the digital world where things change drastically every year makes total sense.