Is it possible to create a midi note from ScriptNode/c++ node and direct it to a synth in the module tree?
-
Hmmm. So I've got this, and it compiles. But I really have no idea how to tell if I'm truly creating a midi note, and if I am, where is it going... and how can I pick it up elsewhere in my module tree.
Do I need to write an additional script for a MidiProcessor and process the event???
@Christoph-Hart - Any ideas?
-
@Orvillain yeah there's currently not a real line of communication for MIDI messages back from scriptnode, but you're pretty good on track with the global cable approach - just analyse the audio in the C++ node and send it back to HISE via a global cable, then attach a synchronous script callback there that will add an HiseEvent to the MIDI queue with
Synth.playNote()
et al. -
@Christoph-Hart Thank you!
-
Wait, we can do synchronous global cables?
How fast will this be? We aren't talking sample accurate audio thread type fast are we?Someone told me recently that cables are not high priority speed wise.
I decided they aren't for anything fast anyway due to the copying involved, except for midi, it kind of makes sense, I can see it being powerful for c++ sequencers, so I'm curious.
Then again, for normal sequencers we can just send an array back and Hise can play from it. I guess this is only for sequencing that needs to be really realtime for some reason
-
Wait, we can do synchronous global cables?
How fast will this be? We aren't talking sample accurate audio thread type fast are we?
Sure:
-
I decided they aren't for anything fast anyway due to the copying involved.
Ah now I understand you, that advice is when you send complex data over a global cable, but the default operational mode of just sending a single numeric value is fast and realtime capable.
-
So far I'm following your global cable guide and sending data from my node. I've got a fair amount of data, and it seems plenty fast. But I guess it depends what you want to do. I've got some arrays that could be thousands of samples long, and it isn't struggling.
-
oh yeah, no, in my case I was sending data that was one and a half million floats long down a cable. Although, it never actually caused a cpu spike, so maybe I didn't have to throttle it.
I guess I'm just being careful. Then again, that was async, which is probably why that works, it's already background thread I'm guessing. -
@griffinboy Gotcha! Right, so I'm processing audio inside a c++ node and deriving a bunch of statistics from it, which I'm then painting in my UI. I'm not trying to do millions and millions and gajillions of floats or anything like that. I'd already assumed that was all best kept in c++
What kind of thing are you working on out of interest?
-
@Christoph-Hart Hey Chris. I don't know if I'm doing it wrong, but it doesn't seem possible to do these two things at the same time???
dataCable.registerDataCallback(function(data)
{
this is where I derive data from my custom c++ node inside the network that my dataCable is attached to
};dataCable.registerCallback(function(data)
{
this is where I would create midi notes and tell a synth to play them
}, SyncNotification);Am I misunderstanding?
-
@Orvillain Right no... I get it. Use two cables. Dohhh.