Passing MidiMessages to plugin's processBlock

Hi.

I have loaded Kontakt plugin to my host app, and added it as a node to my AudioProcessorGraph.

When I play on a plugin build-in keyboard everything sounds perfect.

I want to generate a MidiMessage and play it with sound of my plugin.

In my GUI I have a Button “Play midi note” - it generates MidiBuffer, and empty AudioBuffer, and pass it to myPluginNode -> getProcessor() -> processBlock(…).

And it plays but with some interruption. Looks like I use it in wrong way.

What is the way to pass midi to you plugin inside your host?
Thank you in advance!

Solved.

This is the 1st forum in my life, where I ask and help myself all along :slight_smile:

Hi,
could you please explain how you solved it? Seems like I am having the same problem. Thanks in advance.

Hi!
How do you call your kontakt processBlock? It should be called at the exact same intervals that your soundcard generates interaptions. So, I just call it from inside my plugin’s processBlock and pass MidiBuffer there. So, kontakt’s process block triggers the same time as your plugin process block.

I discovered that time interval is different each time. E.g. for 48000 Hz with 512 buffer size – it is not 10ms. It is ± ~100 microseconds, and it depened on your soundcard manufacturer.