Skip to main content

Engine Parameter Commands

find_mod()

find_mod(<group-index>,<mod-name>)

Returns the slot index of an internal modulator or external modulation slot

<group-index>

The index of the group

<mod-name>

The name of the modulator or modulation slot.

Each modulator or modulation slot has a predefined name, based on the modulation source and target.

The name can be changed with the script editor's edit area open and right-clicking on the modulator or modulation slot.

Examples

on init
	declare $grp_idx
	$grp_idx := 0
	
	declare $env_idx
	$env_idx := find_mod(0,"VOL_ENV")
	
	declare ui_knob $Attack (0,1000000,1)
	set_knob_unit($Attack,$KNOB_UNIT_MS)
	
	$Attack := get_engine_par($ENGINE_PAR_ATTACK,$grp_idx,$env_idx,-1)
	
	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 ui_slider $test (0,1000000)
	$test := get_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,0,...
	find_mod(0,"VEL_VOLUME"),-1)

end on

on ui_control ($test)

	$count := 0
	while($count < $NUM_GROUPS)
		set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,$test,$count,...
		find_mod($count,"VEL_VOLUME"),-1)
		inc($count)
	end while

end on

Creating a slider which controls the velocity to volume modulation intensity of all groups

See Also

find_target()

set_engine_par()

find_target()

find_target(<group-index>,<mod-index>,<target-name>)

Returns the slot index of a modulation slot of an internal modulator

<group-index>

The index of the group

<mod-index>

The slot index of the internal modulator. Can be retrieved with find_mod(<group-idx>,<mod-name>)

<target-name>

The name of the modulation slot. Each modulation slot has a predefined name, based on the modulation source and target. The name can be changed with the script editor's edit area open and right-clicking on the modulation slot.

Examples

on init
	declare ui_knob $Knob (-100,100,1)
	declare $mod_idx
	$mod_idx := find_mod(0,"FILTER_ENV")
	 
	declare $target_idx
	$target_idx := find_target(0,$mod_idx,"ENV_AHDSR_CUTOFF")
end on

on ui_control ($Knob)
	if ($Knob < 0)
		set_engine_par ($MOD_TARGET_INVERT_SOURCE,...
		1,0,$mod_idx,$target_idx)
	else
		set_engine_par ($MOD_TARGET_INVERT_SOURCE,...
		0,0,$mod_idx,$target_idx)
	end if
	set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,...
	abs($Knob*10000),0,$mod_idx,$target_idx)
end on

Controlling 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".

See Also

find_mod()

set_engine_par()

get_engine_par()

get_engine_par(<parameter>,<group>,<slot>,<generic>)

Returns the value of a specific engine parameter

<parameter>

Specifies the engine parameter by using one of the built in engine parameter variables.

<group>

The index (zero-based) of the group in which the specified parameter resides.

If the specified parameter resides on an Instrument level, enter -1.

<slot>

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:

find_mod(<group-idx>,<mod-name>)

For all other applications, set this parameter to -1.

<generic>

For instrument effects, this parameter distinguishes between:

$NI_SEND_BUS: Send Effect

$NI_INSERT_BUS: Insert Effect

$NI_MAIN_BUS: Main Effect

For buses, this parameter specifies the actual bus:

$NI_BUS_OFFSET + [0-15] one of the 16 buses

For internal modulators, this parameter specifies the modulation slider which you can retrieve by using:

find_target(<group-idx>,<mod-idx>,<target-name>)

For Step Modulator, this parameter specifies the step whose value is to be retrieved by using $ENGINE_PAR_STEPMOD_STEP_VALUE.

For all other applications, set this parameter to -1

Examples

on init
	declare $a
	
	declare ui_label $label (2,6)
	set_text ($label,"Release Trigger Groups:")
	
	while ($a < $NUM_GROUPS)
		if(get_engine_par($ENGINE_PAR_RELEASE_TRIGGER ,$a,-1,-1)=1)
		  add_text_line($label,group_name($a)&" (Index: "&$a&")")
		end if
		inc($a)
	end while
end on

Output the name and index of release trigger group

on init
	declare ui_label $label (2,6)
	
	declare ui_button $Refresh
	
	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"
	
	declare $count
	while ($count < 8)
		add_text_line($label,"Slot: " & $count+1 & ": " & ...
		!effect_name[get_engine_par($ENGINE_PAR_SEND_EFFECT_TYPE,-1,$count,-1)])
	inc($count)
	end while
	
end on

on ui_control ($Refresh)
	set_text($label,"")
	$count := 0
	while ($count < 8)
		add_text_line($label,"Slot: " & $count+1 & ": " & ...
		!effect_name[get_engine_par($ENGINE_PAR_SEND_EFFECT_TYPE,-1,$count,-1)])
	inc($count)
	end while
	
	$Refresh := 0
end on

Output the effect types of all eight send effect slots

See Also

Module Status Retrieval

get_engine_par_disp()

get_engine_par_disp(<parameter>,<group>,<slot>,<generic>)

Returns the displayed string of a specific engine parameter

<parameter>

Specifies the engine parameter.

<group>

The index (zero-based) of the group in which the specified parameter resides.

If the specified parameter resides on an Instrument level, enter -1.

<slot>

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:

find_mod(<group-idx>,<mod-name>)

For all other applications, set this parameter to -1.

<generic>

This parameter applies to instrument effects and to internal modulators.

For instrument effects, this parameter distinguishes between:

$NI_SEND_BUS: Send Effect

$NI_INSERT_BUS: Insert Effect

$NI_MAIN_BUS: Main Effect

For buses, this parameter specifies the actual bus:

$NI_BUS_OFFSET + [0-15] one of the 16 buses

For internal modulators, this parameter specifies the modulation slider which you can retrieve by using:

find_target(<group-idx>,<mod-idx>,<target-name>)

For Step Modulator, this parameter specifies the step whose value is to be read by using $ENGINE_PAR_STEPMOD_STEP_VALUE.

For all other applications, set this parameter to -1

Examples

on init
	declare $a
	
	declare ui_label $label (2,6)
	set_text ($label,"Group Volume Settings:")
	
	while ($a < $NUM_GROUPS)
		add_text_line($label,group_name($a) & ": "  & ...
		get_engine_par_disp($ENGINE_PAR_VOLUME,$a,-1,-1) & " dB")
		inc($a)
	end while
end on

Query the group volume settings in an instrument

get_voice_limit()

get_voice_limit(<voice-type>)

Returns the voice limit for the Time Machine Pro mode of the source module

<voice-type>

The voice type, can be one of the following:

$NI_VL_TMPRO_STANDARD {Standard Mode}

$NI_VL_TMRPO_HQ {High Quality Mode} 

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

set_voice_limit()

output_channel_name()

output_channel_name(<output-number>)

Returns the channel name for the specified output

<output-number>

The number of the output channel (zero-based, i.e. the first output is 0)

Examples

on init
	declare $count
	declare ui_menu $menu
	add_menu_item($menu,"Default",-1)
	
	$count := 0
	while($count < $NUM_OUTPUT_CHANNELS)
		add_menu_item($menu,output_channel_name($count),$count)
		inc($count)
	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()

set_engine_par(<parameter>,<value>,<group>,<slot>,<generic>)

Control automatable KONTAKT parameters and bypass buttons

<parameter>

The engine parameter to be modified, e.g. $ENGINE_PAR_CUTOFF

<value>

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.

<group>

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 Instruments level, so you must set <group> to -1 if you want to address a bus.

<slot>

The slot index (zero-based) of the specified parameter. This 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:

find_mod(<group-idx>,<mod-name>)

For all other applications, set this parameter to -1.

<generic>

This parameter applies to instrument effects and to internal modulators.

For instrument effects, this parameter distinguishes between:

$NI_SEND_BUS: Send Effect

$NI_INSERT_BUS: Insert Effect

$NI_MAIN_BUS: Main Effect

For buses, this parameter specifies the actual bus:

$NI_BUS_OFFSET + [0-15] one of the 16 buses

For internal modulators, this parameter specifies the modulation slider which you can retrieve by using:

find_target(<group-idx>,<mod-idx>,<target-name>)

For Step Modulator, this parameter specifies the step whose value is to be changed by using $ENGINE_PAR_STEPMOD_STEP_VALUE.

For all other applications, set this parameter to -1

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 on

A 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 on

Controlling the cutoff and bypass button of any filter module in the first slot of the first group

on init
	declare ui_knob $Knob (-100,100,1)
	declare $mod_idx
	$mod_idx := find_mod(0,"FILTER_ENV")
	 
	declare $target_idx
	$target_idx := find_target(0,$mod_idx,"ENV_AHDSR_CUTOFF")
end on

on ui_control ($Knob)
	if ($Knob < 0)
		set_engine_par ($MOD_TARGET_INVERT_SOURCE,...
		1,0,$mod_idx,$target_idx)
	else
		set_engine_par ($MOD_TARGET_INVERT_SOURCE,...
		0,0,$mod_idx,$target_idx)
	end if
	set_engine_par($ENGINE_PAR_MOD_TARGET_INTENSITY,...
	abs($Knob*10000),0,$mod_idx,$target_idx)
end on

Controlling 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,1)
end on

on ui_control ($Vol)
	set_engine_par($ENGINE_PAR_VOLUME,$Vol,-1,-1,$NI_BUS_OFFSET + 15)
end on

Controlling the amplifier volume of the 16th bus

set_voice_limit()

set_voice_limit(<voice-type>,<value>)

Sets the voice limit for the Time Machine Pro mode of the source module

<voice-type>

The voice type, can be one of the following:

$NI_VL_TMPRO_STANDARD {Standard Mode}

$NI_VL_TMRPO_HQ {High Quality Mode}

<value>

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_ID and triggers the on async_complete callback.

Examples

on init
	declare ui_value_edit $Voices (1,8,1)
	make_persistent($Voices)
	
	declare $change_voices_id
	
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 on

Changing TM Pro voice limits

See Also

get_voice_limit()