Engine Parameter Commands
get_mod_idx()
| |
|---|---|
Returns the slot index of an internal modulator or external modulation slot. | |
| The index of the group (see Index column in Monitor -> Groups pane in Kontakt). |
| The name of the internal (LFO, envelope, step modulator...) or external (velocity, key position, mono aftertouch...) modulator. |
Remarks
Each modulator has a predefined name, based on its type and the parameter it targets.
This name can be changed by enabling developer options in Kontakt's Options → Developer pane, then right-clicking on the modulator or modulator target strip.
Examples
on init
declare $grp_idx := 0
declare $env_idx
$env_idx := get_mod_idx($grp_idx, "VOL_ENV")
declare ui_knob $Attack (0, 1000000, 1)
$Attack := get_engine_par($ENGINE_PAR_ATTACK, $grp_idx, $env_idx, -1)
set_knob_unit($Attack, $KNOB_UNIT_MS)
set_knob_label($Attack, get_engine_par_disp($ENGINE_PAR_ATTACK, $grp_idx, $env_idx, -1))
end on
on ui_control ($Attack)
set_engine_par($ENGINE_PAR_ATTACK, $Attack, $grp_idx, $env_idx, -1)
set_knob_label($Attack, get_engine_par_disp($ENGINE_PAR_ATTACK, $grp_idx, $env_idx, -1))
end on
Controlling the attack time of the volume envelope of the first group. Note: the envelope has been manually renamed to "VOL_ENV".
on init
declare $count
declare $mod_idx
$mod_idx := get_mod_idx(0, "VEL_VOLUME")
declare ui_slider $VelAmt (0, 1000000)
if ($mod_idx # $NI_NOT_FOUND)
$VelAmt := get_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY, 0, $mod_idx, -1)
end if
make_persistent($VelAmt)
end on
on ui_control ($VelAmt)
$count := 0
while($count < $NUM_GROUPS)
$mod_idx := get_mod_idx($count, "VEL_VOLUME")
if ($mod_idx # $NI_NOT_FOUND)
set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY, $VelAmt, $count, $mod_idx, -1)
end if
inc($count)
end while
end on
Creating a slider which controls the velocity to volume modulation intensity of all groups, if they exist.
See Also
get_target_idx()
| |
|---|---|
Returns the modulation target slot index of an internal modulator | |
| The index of the group (see Index column in Monitor -> Groups pane in Kontakt). |
| The slot index of an internal modulator (LFO, envelope, step modulator...). Can be retrieved with |
| The name of the modulation target slot. |
Remarks
Each modulator has a predefined name, based on its type and the parameter it targets.
This name can be changed by enabling developer options in Kontakt's Options → Developer pane, then right-clicking on the modulator or modulator target strip.
Examples
on init
declare $mod_idx
declare $target_idx
$mod_idx := get_mod_idx(0, "FILTER_ENV")
$target_idx := get_target_idx(0, $mod_idx, "FILTER_ENV > CUTOFF")
declare ui_knob $FilterEnv (-1000, 1000, 10)
set_knob_unit($FilterEnv, $KNOB_UNIT_PERCENT)
make_persistent($FilterEnv)
end on
on ui_control ($FilterEnv)
if ($mod_idx # $NI_NOT_FOUND and $target_idx # $NI_NOT_FOUND)
set_engine_par($ENGINE_PAR_MOD_TARGET_MP_INTENSITY, 500000 + ($FilterEnv * 500), 0, $mod_idx, $target_idx)
end if
end on
Controlling the envelope to filter cutoff modulation amount in the first group. Note: the filter envelope has been manually renamed to "FILTER_ENV", and the target to "FILTER_ENV > CUTOFF".
See Also
get_engine_par()
| |
|---|---|
Returns the value of a specific engine parameter. | |
| Specifies the parameter by using one of the built-in engine parameter constants. |
| The index (zero-based) of the group in which the specified parameter resides. If the specified parameter resides on an Instrument level, enter -1. Buses and Main FX also reside on Instrument level, so you must set <group> to -1 if you want to address a bus. |
| The slot index (zero-based) of the specified parameter. It applies only to group/instrument effects, modulators and modulation intensities. For group/instrument effects, this parameter specifies the slot in which the effect resides (zero-based). For modulators and modulation intensities, this parameters specifies the index which you can retrieve by using For all other applications, set this parameter to -1. |
| This parameter applies to instrument effects and to internal modulators. For instrument effects, this parameter distinguishes between:
For buses, this parameter specifies the actual bus:
For internal modulators, this parameter specifies the modulation slider which you can retrieve by using For Flex Envelope, this parameter specifies which envelope stage to target when using For Step Modulator, this parameter specifies which step value to target when using For all other applications, set this parameter to -1. |
Examples
on init
declare $i
declare ui_label $label (2, 6)
set_text($label,"Release Trigger Groups:")
while ($i < $NUM_GROUPS)
if (get_engine_par($ENGINE_PAR_RELEASE_TRIGGER, $i, -1, -1) = 1)
add_text_line($label, group_name($i) & " (Index: " & $i & ")")
end if
inc($i)
end while
end onOutput the name and index of release trigger group
on init
declare ui_label $label (2, 6)
declare ui_button $Refresh
declare $i
declare !effect_name[128]
!effect_name[$EFFECT_TYPE_NONE] := "None"
!effect_name[$EFFECT_TYPE_PHASER] := "Phaser"
!effect_name[$EFFECT_TYPE_CHORUS] := "Chorus"
!effect_name[$EFFECT_TYPE_FLANGER] := "Flanger"
!effect_name[$EFFECT_TYPE_REVERB] := "Reverb"
!effect_name[$EFFECT_TYPE_DELAY] := "Delay"
!effect_name[$EFFECT_TYPE_IRC] := "Convolution"
!effect_name[$EFFECT_TYPE_GAINER] := "Gainer"
while ($i < 8)
add_text_line($label, "Slot: " & $i + 1 & ": " & ...
!effect_name[get_engine_par($ENGINE_PAR_SEND_EFFECT_TYPE, -1, $i, -1)])
inc($i)
end while
end on
on ui_control ($Refresh)
set_text($label, "")
while ($i < 8)
add_text_line($label, "Slot: " & $i + 1 & ": " & ...
!effect_name[get_engine_par($ENGINE_PAR_SEND_EFFECT_TYPE, -1, $i, -1)])
inc($i)
end while
$Refresh := 0
end onOutput the effect types of all eight send effect slots.
See Also
get_engine_par_disp()
| |
|---|---|
Returns the displayed value of a specific engine parameter, as a string. | |
| Specifies the parameter by using one of the built-in engine parameter constants. |
| The index (zero-based) of the group in which the specified parameter resides. If the specified parameter resides on an Instrument level, enter -1. Buses and Main FX also reside on Instrument level, so you must set <group> to -1 if you want to address a bus. |
| The slot index (zero-based) of the specified parameter. It applies only to group/instrument effects, modulators and modulation intensities. For group/instrument effects, this parameter specifies the slot in which the effect resides (zero-based). For modulators and modulation intensities, this parameters specifies the index which you can retrieve by using For all other applications, set this parameter to -1. |
| This parameter applies to instrument effects and to internal modulators. For instrument effects, this parameter distinguishes between:
For buses, this parameter specifies the actual bus:
For internal modulators, this parameter specifies the modulation slider which you can retrieve by using For Flex Envelope, this parameter specifies which envelope stage to target when using For Step Modulator, this parameter specifies which step value to target when using For all other applications, set this parameter to -1. |
Examples
on init
declare $i
declare ui_label $label (2, 6)
set_text($label, "Group Volume Settings:")
while ($i < $NUM_GROUPS)
add_text_line($label, group_name($i) & ": " & get_engine_par_disp($ENGINE_PAR_VOLUME, $i, -1, -1) & " dB")
inc($i)
end while
end onQuery the group volume settings in an instrument.
get_engine_par_disp_ext()
| |
|---|---|
Returns the display value of a specific engine parameter with an arbitrary value, as a string. | |
| Specifies the parameter by using one of the built-in engine parameter constants. |
| The value to which the specified parameter is set. The range of values is always 0 to 1000000, except for switches, in which case it is 0 or 1, and certain engine parameters which are stepped instead of continuous. These will either have specific constants provided, or a generic integer span of values, which will be separately noted in the Engine Parameters section. |
| The index (zero-based) of the group in which the specified parameter resides. If the specified parameter resides on an Instrument level, enter -1. Buses and Main FX also reside on Instrument level, so you must set <group> to -1 if you want to address a bus. |
| The slot index (zero-based) of the specified parameter. It applies only to group/instrument effects, modulators and modulation intensities. For group/instrument effects, this parameter specifies the slot in which the effect resides (zero-based). For modulators and modulation intensities, this parameters specifies the index which you can retrieve by using For all other applications, set this parameter to -1. |
| This parameter applies to instrument effects and to internal modulators. For instrument effects, this parameter distinguishes between:
For buses, this parameter specifies the actual bus:
For internal modulators, this parameter specifies the modulation slider which you can retrieve by using For Flex Envelope, this parameter specifies which envelope stage to target when using For Step Modulator, this parameter specifies which step value to target when using For all other applications, set this parameter to -1. |
Examples
on init
declare $value
declare ui_knob $Cutoff (0, 1000000, 1)
declare ui_knob $Macro (0, 1000000, 10000)
declare ui_knob $MacroAmt (-1000000, 1000000, 10000)
$MacroAmt := -500000
set_knob_defval($Cutoff, 1000000)
set_knob_defval($MacroAmt, 0)
set_knob_unit($Cutoff, $KNOB_UNIT_HZ)
set_knob_unit($Macro, $KNOB_UNIT_PERCENT)
set_knob_unit($MacroAmt, $KNOB_UNIT_PERCENT)
make_persistent($Cutoff)
make_persistent($Macro)
make_persistent($MacroAmt)
set_engine_par($ENGINE_PAR_EFFECT_TYPE, $EFFECT_TYPE_FILTER, -1, 0, $NI_INSERT_BUS)
end on
function SetCutoff()
$value := int(real($Cutoff) + (real($Macro) * real($MacroAmt) * 1.0e-6))
if ($value < 0)
$value := 0
end if
if ($value > 1000000)
$value := 1000000
end if
set_engine_par($ENGINE_PAR_CUTOFF, $value, -1, 0, $NI_INSERT_BUS)
set_knob_label($Cutoff, get_engine_par_disp_ext($ENGINE_PAR_CUTOFF, $Cutoff, -1, 0, $NI_INSERT_BUS))
end function
on persistence_changed
call SetCutoff()
end on
on ui_controls
call SetCutoff()
end onQuery the baseline filter cutoff value despite the actual engine parameter value being different, due to the additional offset from a macro-style control.
get_voice_limit()
| |
|---|---|
Returns the voice limit for the Time Machine Pro sampler mode of the Source module. | |
| The voice type, can be one of the following:
|
Examples
on init
declare ui_label $label (3, 2)
add_text_line($label, "Standard Voice Limit: " & get_voice_limit($NI_VL_TMPRO_STANDARD))
add_text_line($label, "HQ Voice Limit: " & get_voice_limit($NI_VL_TMPRO_HQ))
end on
Displaying TM Pro voice limits.
See Also
output_channel_name()
| |
|---|---|
Returns the channel name for the specified output. | |
| The number of the output channel (zero-based, i.e. the first output is 0). |
Examples
on init
declare $i
declare ui_menu $menu
add_menu_item($menu, "Default", -1)
$i := 0
while ($i < $NUM_OUTPUT_CHANNELS)
add_menu_item($menu, output_channel_name($i), $i)
inc($i)
end while
$menu := get_engine_par($ENGINE_PAR_OUTPUT_CHANNEL, 0, -1, -1)
end on
on ui_control ($menu)
set_engine_par($ENGINE_PAR_OUTPUT_CHANNEL,$menu, 0, -1, -1)
end on
Mirroring the output channel assignment menu of the first group.
See Also
General: $NUM_OUTPUT_CHANNELS, $ENGINE_PAR_OUTPUT_CHANNEL
set_engine_par()
| |
|---|---|
Controls various Kontakt engine parameters. | |
| Specifies the parameter by using one of the built-in engine parameter constants. |
| The value to which the specified parameter is set. The range of values is always 0 to 1000000, except for switches, in which case it is 0 or 1, and certain engine parameters which are stepped instead of continuous. These will either have specific constants provided, or a generic integer span of values, which will be separately noted in the Engine Parameters section. |
| The index (zero-based) of the group in which the specified parameter resides. If the specified parameter resides on an Instrument level, enter -1. Buses and Main FX also reside on Instrument level, so you must set <group> to -1 if you want to address a bus. |
| The slot index (zero-based) of the specified parameter. It applies only to group/instrument effects, modulators and modulation intensities. For group/instrument effects, this parameter specifies the slot in which the effect resides (zero-based). For modulators and modulation intensities, this parameters specifies the index which you can retrieve by using For all other applications, set this parameter to -1. |
| This parameter applies to instrument effects and to internal modulators. For instrument effects, this parameter distinguishes between:
For buses, this parameter specifies the actual bus:
For internal modulators, this parameter specifies the modulation slider which you can retrieve by using For Flex Envelope, this parameter specifies which envelope stage to target when using For Step Modulator, this parameter specifies which step value to target when using For all other applications, set this parameter to -1. |
Remarks
Certain engine parameters are executed asynchronously (most prominently: setting effect type and subtype). When changing the effect slot contents from the
on initcallback, it is executed synchronously, which can greatly affect the initial loading time of the instrument, especially if this is done for a large amount of effect slots. It is advisable to move any such operations toon persistence_changedcallback.
Examples
on init
declare ui_knob $Volume (0, 1000000, 1000000)
end on
on ui_control ($Volume)
set_engine_par($ENGINE_PAR_VOLUME, $Volume, -1, -1, -1)
end onA knob controls the instrument volume.
on init
declare ui_knob $Freq (0, 1000000, 1000000)
declare ui_button $Bypass
end on
on ui_control ($Freq)
set_engine_par($ENGINE_PAR_CUTOFF, $Freq, 0, 0, -1)
end on
on ui_control ($Bypass)
set_engine_par($ENGINE_PAR_EFFECT_BYPASS, $Bypass, 0, 0, -1)
end onControlling the cutoff and bypass button of any filter module in the first slot of the first group.
on init
declare ui_knob $Knob (-1000, 1000, 10)
declare $mod_idx
$mod_idx := get_mod_idx(0, "FILTER_ENV")
declare $target_idx
$target_idx := get_target_idx(0, $mod_idx, "ENV_AHDSR_CUTOFF")
end on
on ui_control ($Knob)
set_engine_par($ENGINE_PAR_MOD_TARGET_MP_INTENSITY, $Knob * 1000, 0, $mod_idx, $target_idx)
end onControlling the filter envelope amount of an envelope to filter cutoff modulation in the first group. Note: the filter envelope has been manually renamed to "FILTER_ENV".
on init
declare ui_knob $Vol (0, 1000000, 1000000)
end on
on ui_control ($Vol)
set_engine_par($ENGINE_PAR_VOLUME, $Vol, -1, -1, $NI_BUS_OFFSET + 15)
end onControlling the amplifier volume of 16th bus.
set_voice_limit()
| |
|---|---|
Sets the voice limit for the Time Machine Pro mode of the Source module. | |
| The voice type, can be one of the following:
|
| The voice limit of the Time Machine Pro mode. |
Remarks
Changing voice limits is an asynchronous operation. This means that one cannot reliably access the newly allocated voices immediately after instantiation. To resolve this, the
set_voice_limit()command returns an$NI_ASYNC_IDand triggers theon async_completecallback.Use this command to adjust the memory requirement of your instrument. Time Machine Pro uses its own memory allocation that is separate from memory used by loaded samples. This can be monitored in Kontakt's side pane, Monitor → Engine tab.
Examples
on init
declare $change_voices_id
declare ui_value_edit $Voices (1, 8, 1)
make_persistent($Voices)
end on
on ui_control ($Voices)
$change_voices_id := set_voice_limit($NI_VL_TMPRO_STANDARD, $Voices)
end on
on async_complete
if ($NI_ASYNC_ID = $change_voices_id)
message("New TMPro Std Voice Limit: " & get_voice_limit($NI_VL_TMPRO_STANDARD))
end if
end onChanging TM Pro voice limits.