Time based decisions in script

Hi David,

for my script I need a possibility to have some time windows to decide how incoming notes or already received notes are processed.
I tried to use the SendLater function to an MIDI-input and

On NoteOnEvent from that MIDI-input,
unfortunately the sent MIDI It does not arrive at the script level, would have been so easy :frowning:

Any tips?

Peter

Hmmm, right now, once you use a SendLater function, the event is put in a queue so that it, well, gets sent later, going right into the MIDI out queue. The assumption of course is that when you do a SendLater, you always want it to get sent. What is your scenario where you would send a note out into the future and then need to change it later?

But your comment is interesting ā€” the notion would be that one could schedule an event into the future and then capture it at the point when itā€™s about to go out and run script code.

It probably wouldnā€™t be too hard to implement such a feature but I think it requires some thought. For example, do we now need to know whether a callback is handling a real-time note that was just played or whether itā€™s handling a note that was scheduled from earlier? Do we need to have a completely new set of constrained callbacks to respond to these or do we extend the existing callbacks with another argument to indicate what kind of event we are receiving.

When you are on Mac you could do a trick with IAC.
Here is a proof of concept, DESTINATION is IAC Driver in Channel 2 and DEST2 is IAC Driver out Channel 2

var SOURCE : MidiInBlock
DESTINATION : MidiInBlock
DEST2 : MidiOutBlock

On NoteEvent(m : NoteMessage) from SOURCE
SendNowExternal(DEST2, m)
End

On NoteEvent(m : NoteMessage) from DESTINATION
Print(ā€œLaterā€)
End

sorry for my bad explanation,I try again:

Notes arriving from keyboard are stored in arrays and sorted in that arrays by time, note number
to decide to which instruments they belong to ( and wili sent to later)

after say 9 ms time window I want to proceed, sending the notes to the instruments,

so I just need a signal after 9ms to proceed,
and tied to use a dummy note (e.g. Note127 on Ch 16), sent with send later function

since this did not work,
which way to go ? generator, something else, dummynote to IACBus?

just a tip, the least processor taxing way?
Peter

I do not really understand.

Why do you have to check incoming notes to decide which instruments the notes should be sent to?

Can you create a screenshot of your rackspace and the script?

thanks, pianopaul,
I thought about this already, I will try this
Peter

DIVisi roles (for instruments )

I will post the script later when itā€™s better working.
Peter

Now I understand, you want to implement a logic in similar what Native Instruments does with Symphony Series?

@dhj

Hmmm, right now, once you use a SendLater function, the event is put in a queue so that it, well, gets sent >later, going right into the MIDI out queue. The assumption of course is that when you do a SendLater, you >always want it to get sent. What is your scenario where you would send a note out into the future and then >need to change it later?

Just change the routing goal, currently done via Midi channels.

But your comment is interesting ā€” the notion would be that one could schedule an event into the future and >then capture it at the point when itā€™s about to go out and run script code.

The routing roles (to the instruments) can be calculated after receiving some notes in the played first chord
inside an as small as possible time window after sorting them related to Note Number.

It probably wouldnā€™t be too hard to implement such a feature but I think it requires some thought. For >example, do we now need to know whether a callback is handling a real-time note that was just played or >whether itā€™s handling a note that was scheduled from earlier? Do we need to have a completely new set of >constrained callbacks to respond to these or do we extend the existing callbacks with another argument to >indicate what kind of event we are receiving.

Inside the first chord-timewindow the roles can be assigned,
after that,
it must be calculated to which voice (role/Midich.) of a chord the incoming note should belong.
That can be done by the addition of the note to the right position in
the note number sorted Array and some Midi control ā€¦ how this exactly happens, ā€¦ later tbd

If/when I get it to work you can take a look, I canā€™t really say anything more now

Peter

@pianopaul

yes LASS like,
for non KONTAKT instruments.
Peter

Unfortionately there is no
SendLaterExternal(DEST2, m)

Peter

Make a new MidiIn Block and give it a new GP Script name (use the OSC block as thatā€™s not tied to a physical device). Then connect your new MidiIn block to a MidiOut Block. Then you can use a regular SendLater to send events to that new MidiIn Block to go out to the external block.

:grinning:

@dhj
Thank you David,
Iā€™ll try this.
Peter

@dhj
Thanks,
that works!
Peter