18 |
<p> |
<p> |
19 |
<img src="nksp_file.png" style="height:111px; margin-right:12px;"> |
<img src="nksp_file.png" style="height:111px; margin-right:12px;"> |
20 |
NKSP stands for "is <b>N</b>ot <b>KSP</b>", which denotes its distinction |
NKSP stands for "is <b>N</b>ot <b>KSP</b>", which denotes its distinction |
21 |
to an existing proprieatary language called <i>KSP</i>. |
to an existing proprietary language called <i>KSP</i>. |
22 |
NSKP is a script language specifically designed to write real-time capable |
NSKP is a script language specifically designed to write real-time capable |
23 |
software extensions to LinuxSampler's sampler engines that can be bundled |
software extensions to LinuxSampler's sampler engines that can be bundled |
24 |
individually with sounds by sound designers themselves. |
individually with sounds by sound designers themselves. |
414 |
triggered on a MIDI keyboard. The following example demonstrates how that |
triggered on a MIDI keyboard. The following example demonstrates how that |
415 |
could be achieved. |
could be achieved. |
416 |
</p> |
</p> |
417 |
<note class="important"> |
<note> |
418 |
The following example does not fully work with LinuxSampler yet. That's |
You need at least LinuxSampler 2.0.0.svn2 or higher for the following |
419 |
because the used <code>wait()</code> function is not fully implemented |
example to work as described and as expected. Refer to the notes of the |
420 |
yet. Currently a <code>wait()</code> function call suspends execution, |
<code>wait()</code> function reference documentation for more |
421 |
but since the respective scheduler code is yet missing, the script |
informations about this issue. |
|
will automatically be resumed with the next audio fragment cycle. So |
|
|
effectively a <code>wait()</code> call will pause your script for a few |
|
|
miliseconds with LinuxSampler right now, no matter which function argument |
|
|
you provided. Hopefully this will be implemented soon though. |
|
422 |
</note> |
</note> |
423 |
<code> |
<code> |
424 |
on init |
on init |
958 |
<h3>Boolean Operators</h3> |
<h3>Boolean Operators</h3> |
959 |
<p> |
<p> |
960 |
To perform logical transformations of <i>boolean</i> data, you may use the |
To perform logical transformations of <i>boolean</i> data, you may use the |
961 |
following boolean operators: |
following logical operators: |
962 |
</p> |
</p> |
963 |
<code> |
<code> |
964 |
on init |
on init |
971 |
end on |
end on |
972 |
</code> |
</code> |
973 |
<p> |
<p> |
974 |
Remember that with boolean operations, all integer values other than <code>0</code> |
Keep in mind that with logical operators shown above, |
975 |
|
all integer values other than <code>0</code> |
976 |
are interpreted as boolean <i>true</i> while an integer value of |
are interpreted as boolean <i>true</i> while an integer value of |
977 |
precisely <code>0</code> is interpreted of being boolean <i>false</i>. |
precisely <code>0</code> is interpreted of being boolean <i>false</i>. |
978 |
</p> |
</p> |
979 |
|
<p> |
980 |
|
So the logical operators shown above always look at numbers at a whole. |
981 |
|
Sometimes however you might rather need to process numbers bit by bit. For |
982 |
|
that purpose the following bitwise operators exist. |
983 |
|
</p> |
984 |
|
<code> |
985 |
|
on init |
986 |
|
message("1 .and. 1 is " & 1 .and. 1) { bitwise "and" } |
987 |
|
message("1 .and. 0 is " & 1 .and. 0) { bitwise "and" } |
988 |
|
message("1 .or. 1 is " & 1 .or. 1) { bitwise "or" } |
989 |
|
message("1 .or. 0 is " & 1 .or. 0) { bitwise "or" } |
990 |
|
message(".not. 1 is " & .not. 1) { bitwise "not" } |
991 |
|
message(".not. 0 is " & .not. 0) { bitwise "not" } |
992 |
|
end on |
993 |
|
</code> |
994 |
|
<p> |
995 |
|
Bitwise operators work essentially like logical operators, with the |
996 |
|
difference that bitwise operators compare each bit independently. |
997 |
|
So a bitwise <code>.and.</code> operator for instance takes the 1st bit |
998 |
|
of the left hand's side value, the 1st bit of the right hand's side value, |
999 |
|
compares the two bits logically and then stores that result as 1st bit of |
1000 |
|
the final result value, then it takes the 2nd bit of the left hand's side value |
1001 |
|
and the 2nd bit of the right hand's side value, compares those two bits logically |
1002 |
|
and then stores that result as 2nd bit of the final result value, and so on. |
1003 |
|
</p> |
1004 |
|
|
1005 |
|
|
1006 |
<h3>Comparison Operators</h3> |
<h3>Comparison Operators</h3> |
1007 |
<p> |
<p> |