Kontakt Tutorials
Use a Custom Midi File With Your Instrument in Kontakt
Callbacks are sections of a script that is being called. One of the callbacks, on async_complete is called when you load or save arrays, midi files or ir samples. In today’s video tutorial I’ll show you to Use a custom midi file with your Instrument.
Some other useful information about callbacks is that they all start with on and end with end on. Callbacks can be stopped using the command, exit. Each callback has a unique id number which can be retrieved with $NI_CALLBACK_ID. And you can query which callback triggered a function with $NI_CALLBACK_TYPE and the corresponding built in constants.
On aync_complete is an asynchronous callback that is triggered after the execution of the load_array, save_array, love_midi_file, save_midi_file and load_ir_sample commands. What this means is that on async_complete is not waiting for those commands to be finished. When those commands are finished, they return a unique value. This value can be used with $NI_ASYNC_ID and $NI_ASYNC_EXIT_STATUS to check whether the command was finished and whether the command was successful or not.
Today we will write some script that will load a miid file and display a message as to whether it was successful or not.
We make us use of load_midi_file and on async_complete to do this.
To resolve synchronization issues, load_midi_file returns a unique ID when being used. When the command is finished, the on async_complete callback gets triggered and the built-in variable $NI_ASYNC_ID is updated with the ID of the command that triggered the callback. If the command was completed successfully (for example if the file was found and successfully loaded), the internal value $NI_ASYNC_EXIT_STATUS is set to 1, otherwise it is 0.
Remember to leave a comment to let us know what you think about the video, how you plan on using the techniques you have learned or want to give us some feedback!