# Welcome to KSP

Welcome to the KONTAKT Script Processor (KSP) reference manual. KSP is the technology that powers thousands of instruments in our industry leading sampling platform - KONTAKT. Its underlying scripting language defines how samples are being played, how MIDI information is used for interacting with the instrument, how the instrument looks and much more. From simple sequencers to large orchestral clusters with thousands of samples, KSP makes it all work.

This resource is a reference manual that covers every function, command, variable, callback and other element of the KONTAKT scripting language. Where applicable, it also includes examples and short code snippets that demonstrate how a given function can be used. To learn more about KONTAKT, refer to the KONTAKT User Manual.

You can navigate this manual through the menu on the left, which groups elements of the KSP language in functions. Alternatively, if you are looking for a specific command you can use the search bar.

We hope you enjoy exploring KSP!

## What's New in KONTAKT 7.1

#### New Features

• New commands to retrieve group, modulator and modulation target indices: get_group_idx(), get_mod_idx(), get_target_idx(). These commands will return $NI_NOT_FOUND when the queried object is not found. Introduction of these commands also deprecates the usage of find_group(), find_mod() and find_target()! • Engine parameter for Convolution Auto Gain: $ENGINE_PAR_IRC_AUTO_GAIN

• Engine parameter for the Legato button across various Tone/Time Machine modes ($ENGINE_PAR_TM_LEGATO) • Engine parameters for the new Flexible Envelope parameters: $ENGINE_PAR_FLEXENV_LOOP, $ENGINE_PAR_FLEXENV_ONESHOT • Filter type constants for the new SV 6-pole filters: $FILTER_TYPE_SV_LP6, $FILTER_TYPE_SV_BP6, $FILTER_TYPE_SV_HP6, $FILTER_TYPE_SV_NOTCH6 • New command for querying the status of a zone: get_zone_status(). Introduction of this command also deprecates the usage of is_zone_empty()! • New zone-related commands: get_num_zones() and get_zone_id() • New zone parameters to retrieve the sample rate of the sample used by the zone ($ZONE_PAR_SAMPLE_RATE) and get or set the zone BPM (\$ZONE_PAR_BPM)

• XY pad values can now be retrieved and set using UI IDs (get/set_control_par_real_arr())

• New real number math commands: cbrt(), log2(), log10(), exp2()

• New arithmetic commands dealing with the negative sign: signbit(), sgn()

• New boolean operator: xor

• New bitwise operator: .xor.

• New, shorter commands for integer/real value conversion: int(), real(). Introduction of these commands also deprecates the usage of real_to_int() and int_to_real()

#### Improved Features

• Added mode 2 to change_pan() and change_vol(), which retains the zone pan/volume adjustments on top of the absolute offset added by change_pan() or change_vol(), unlike mode 0 which disregarded zone pan/volume adjustments entirely

• Zone commands like set_sample(), set_loop_par() and set_zone_par() now work on all zones when using snapshot modes 2 and 3, and when called from init and persistence_changed callbacks

• The mod keyword now also works with real numbers, providing remainder after regular floating-point division