Skip to main content

Zone Parameters

Zone Parameters

These set the parameters for the user zones via KSP in the same manner and ranges as available on the mapping editor. They can be set with set_zone_par() and retrieved with get_zone_par() commands. When the user zones are declared, all these parameters are set to 0 by default.

$ZONE_PAR_HIGH_KEY

Sets the high key for the zone. Range: 0 ... 127.

$ZONE_PAR_LOW_KEY

Sets the low key of the zone. Range: 0 ... 127.

$ZONE_PAR_HIGH_VELO

Sets the maximum velocity response of the zone. Range: 1 ... 127.

$ZONE_PAR_LOW_VELO

Sets the minimum velocity response of the zone. Range: 1 ... 127.

$ZONE_PAR_ROOT_KEY

Sets the root key of the zone. Range: 0 ... 127.

$ZONE_PAR_FADE_LOW_KEY

Optionally use this parameter to create zone crossfades. The value is set in the form of a distance to the $ZONE_PAR_LOW_KEY.

Range: $ZONE_PAR_HIGH_KEY - $ZONE_PAR_LOW_KEY + 1

$ZONE_PAR_FADE_HIGH_KEY

Optionally use this parameter to create zone crossfades. The value is set in the form of a distance to the $ZONE_PAR_HIGH_KEY.

Range: $ZONE_PAR_HIGH_KEY - $ZONE_PAR_LOW_KEY + 1

$ZONE_PAR_FADE_LOW_VELO

Optionally use this parameter to create zone crossfades. The value is set in the form of a distance to the $$ZONE_PAR_LOW_VELO.

Range: $ZONE_PAR_HIGH_VELO - $ZONE_PAR_LOW_VELO + 1

$ZONE_PAR_FADE_HIGH_VELO

Optionally use this parameter to create zone crossfades. The value is set in the form of a distance to the $ZONE_PAR_HIGH_VELO.

Range: $ZONE_PAR_HIGH_VELO - $ZONE_PAR_LOW_VELO + 1

$ZONE_PAR_VOLUME

Sets the volume of the zone. Range: -3600 ... 3600 .

$ZONE_PAR_PAN

Sets the panning of the zone. Range: -1000 ... 1000 .

$ZONE_PAR_TUNE

Sets the tuning of the zone. Range: -3600 ... 3600 .

$ZONE_PAR_GROUP

Sets the group of the user zone. By default a user zone is placed in group 0.

$ZONE_PAR_SAMPLE_START

Sets the sample start value of the sample attached to the zone.

$ZONE_PAR_SAMPLE_END

Sets the sample end value of the sample attached to the zone.

$ZONE_PAR_SAMPLE_MOD_RANGE

Sets the sample start modulation range of the sample attached to the zone. This is the S.Mod parameter in Kontakt's Wave Editor.

$ZONE_PAR_SAMPLE_RATE

Gets the sample rate of the sample attached to the zone. This zone parameter cannot be used with set_zone_par().

$ZONE_PAR_SELECTED

Returns 1 if the zone is selected in Kontakt's Mapping Editor, or 0 if it's not selected. This zone parameter cannot be used with set_zone_par().

Examples

on init
    message("")

    set_num_user_zones(4)

    set_zone_par(%NI_USER_ZONE_IDS[0], $ZONE_PAR_GROUP, 0)
    set_zone_par(%NI_USER_ZONE_IDS[1], $ZONE_PAR_GROUP, 1)
    set_zone_par(%NI_USER_ZONE_IDS[2], $ZONE_PAR_GROUP, 2)
    set_zone_par(%NI_USER_ZONE_IDS[3], $ZONE_PAR_GROUP, 3)
end on

Creates 4 user zones in an instrument and assigns each to a separate group. Make sure that you have enough empty groups defined in the instrument when testing this example!

Loop Parameters

$LOOP_PAR_MODE

The loop playback mode of the selected loop within the zone.

0: Loop off

1: Loop until end

2: Loop until end, bidirectional

3: Loop until release

4: Loop until release, bidirectional

$LOOP_PAR_START

The starting point in samples of the selected loop within the zone. If this parameter is not set, the loop will start at the beginning of the sample.

$LOOP_PAR_LENGTH

The loop length in samples of the selected loop within the zone. If this parameter is not set, the loop length will correspond to the entire sample.

$LOOP_PAR_XFADE

The crossfade duration in microseconds for the selected loop within the zone.

$LOOP_PAR_COUNT

The number of times the selected loop within the zone will repeat. If this parameter is not set (or is set to 0), the loop will play indefinitely.

$LOOP_PAR_TUNING

Sets the tuning offset inside the loop area for the selected loop within the zone. This offset is applied on the first repeat of the loop, and for all successive repeats (as defined by $LOOP_PAR_COUNT).

Examples

on init
    message("")

    set_num_user_zones(1)

    set_sample(%NI_USER_ZONE_IDS[0], "path/to/sample.wav")
end on

on ui_control ($SampleLoopOn)
    wait_async(set_loop_par(%NI_USER_ZONE_IDS[0], 0, $LOOP_PAR_MODE, $SampleLoopOn))
end on

Enable or disable the loop of a sample loaded into a user zone.

Sample Parameters

$NI_FILE_NAME

The file name of a zone’s sample (corresponds to the zone name).

$NI_FILE_FULL_PATH

The full path of a zone’s sample (same result as without the parameter).

$NI_FILE_FULL_PATH_OS

The full OS path of a zone’s sample (uses backslashes on Windows).

$NI_FILE_EXTENSION

The file extension of a zone’s sample (without the dot).