Kontakt Tutorials
Kontakt Scripting - Saving a MIDI File Inside Kontakt with scripting
When you initialize an instrument, an empty MIDI object is initialized with it. You can either start editing the object by defining a buffer size and inserting events, or by inserting a whole MIDI file. The MIDI object can be saved as well. In today’s video tutorial I will show you how Saving a MIDI File works.
You can only use one MIDI object at a time within an NKI. The MIDI object is held in memory and can be accessed by any of the script slots. It is possible to add, remove and edit MIDI events within the object, as well as import and export MIDI files.
The Multi Script can also hold one MIDI object, and handles it in the same way as an NKI.
If you want to create a MIDI sequence from scratch, you first need to assign a buffer size, which effectively creates a number of inactive MIDI events. From this point you can activate (ie. insert) and edit MIDI events using the MIDI event commands.
MIDI objects can be exported from KONTAKT either by using the save_midi_file() command, or via a drag and drop enabled label element. In either case, it is possible to define the export area, both in terms of start and end times, as well as the start and end tracks, by using the mf_set_export_area() command.
MIDI events in KONTAKT’s MIDI object are given event parameters, which are accessed using either the mf_get_event_par() or mf_set_event_par() commands. A unique event ID can be used to access a specific event, or you can navigate through events by position. The event ID is assigned whenever a MIDI event is created or loaded.
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 if want to give us some feedback!