Writing Docs Gigedit SFZ Instrument Scripts NKSP Language NKSP Reference


The key range (or note range if you will) of instruments is assigned to one or more keyboard regions. So each "region" is responsible for mapping audio samples and synthesis parameters for a certain key range. This function takes two keys on the keyboard (as MIDI note number) as arguments and checks the region relationship of the two keys, that is if the two keys have a region mapped each, and if yes how the relationship of those two regions exactly is. So the result value of this function depends on the precise regions layout of the currently loaded instrument.

Function Prototype

same_region(key1, key2)


Argument Name Data Type Description
key1 Integer Number Note number of 1st key to be checked.
key2 Integer Number Note number of 2nd key to be checked.

Return Value

Data Type Description
Integer Number Relationship of the two keys:
0: Both keys have a region, however they are two different regions, which also and don't overlap each other.
1: Both keys have a region and it is exactly the same region.
2: Both keys have a region, which are two different regions, and which are overlapping each other though.
3: key1 has a region, key2 does not have any region.
4: key1 does not have any region, key2 has a region.
5: key1 and key2 both don't have any region.
The GigaStudio/Gigasampler format currently does not officially allow overlapping regions. So the designated return value 2 is reserved for such a potential future feature.


Note that it is also indeed valid and useful sometimes to pass the same note number to both arguments of this function, which allows you to check whether one certain key is mapped to a region.


Since LinuxSampler 2.0.0.svn53.

This function is currently only available for the GigaStudio/Gigasampler format engine.

Furthermore this function exists only with NKSP, it is not available with KSP.

Document Updated:  2019-08-29  |  Author:  Christian Schoenebeck