Page tree
Skip to end of metadata
Go to start of metadata

insertMidiModule(module, position)


An Element object can only have one parent. It cannot be child of multiple parents. Therefore, an Element object that you retrieved from the running plug-in instance must be removed before it can be inserted again. The Element objects you retrieve through loadPreset or loadPresetAsync can be inserted freely, because these functions create a copy of the Element objects when reading them.

Available in: Controller.


moduleThe MidiModule object of the MIDI module that you want to insert.MidiModule
positionThe position where the MIDI module is inserted.number


To explore the following script:

  1. Download Program.vstpreset.
  2. Drag the preset on the MediaBay to import it to the user folder for VST presets.
  3. Create an empty program and add a script module.
  4. Paste the script into the text editor of the script module and execute the script.


-- insert MIDI module from Program.vstpreset into the current program
-- get the file path for user VST presets
path = getUserPresetPath()
-- load VST preset
loadedProgram = loadPreset(path.."/Program/Program.vstpreset")
-- get the first MIDI module from the loaded program
module = loadedProgram:getMidiModule()
-- insert MIDI module
if module then
    this.program:insertMidiModule(module, 1)

1 Comment