ksp

Last modifiedby & filed under Kontakt Scripting (KSP) - Basics, UIs, Tutorials, Scripts and Tools, Kontakt Scripting (KSP) :: Basics.

To start scripting

  1. start Kontakt and create a new instrument
  2. click on the wrench symbol
  3. click on “Script Editor” and then “edit”
  4. in the window below there goes your code
    init_the-editor1

 

The Script Tabs

You can use all the 5 tabs to create independent UI’s or to separate different scripts (for better clarity). But be careful the code inside different tabs is not really independent from each other. There are commands or callbacks which are affecting each other (like the on note callback).

Executing your Script & Error Reporting

When you hit the apply button your script gets executed immediately.

However if there are any errors, Kontakt will not execute the script but report the first error with a status message below. It also marks the affected line of code. However it will not report all kind of errors. Eg. it doesn’t show runtime errors. Furthermore you will probably find the whole error reporting and debugging very nerve-racking. The automatic warnings are still a good help though, to quickly find typos and slips.

init_the-editor2

The “Title for The Script” field

init_the-editor3
on init
  make_perfview
end on

The Text you put into the “Title for the Script” field is also visible on the respective UI tab outside the edit mode (wrench button). But only when using multiple tabs in combination with the “make_perfview” command (see the image above).

The “make_perfview” command just makes the actual script tab visible outside the edit mode. You need it whenever you make a custom UI with knobs, buttons etc (of which more in later tutorials).

Try it yourself by putting the upper code into 2 or more tabs and enter some text into the “Title for the Script” field

“External” Editors

For code writing you should rather use an “external” or 3rd party editor which makes coding much easier like colorizing your code, working with indents and offering great additional features like syntax checks, macros etc. Sublime Text is the tool to go here. For further info read our Setting up Sublime 3 Tutorial.

But of course you can also use any other text editor which already simplifies a lot because of the much bigger working space .. scrolling sucks ;)

How useful was this article?

something you didn't like? Please tell us before you rate!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

NOTE: highly negative votes may be removed without any reasonable given feedback!

Tell us how we can improve this post?

2 Responses to “KSP Scripting (NI Kontakt) :: BASICS :: The Kontakt Script Editor”

    • YummyBeats

      basically it's like an advanced text editor but with a lot of helpful extra features (like coloring your code) which makes coding a lot easier. Especially with sublime text you get tons of intelligent ksp features like macros or functions where you can pass parameters. You can get sublime text at https://www.sublimetext.com/

Leave a Reply to YummyBeats Cancel reply

use <pre> </pre> to wrap code blocks

use <code> </code> to wrap small code snippets

use basic html to style your comment

Your email address will not be published. Required fields are marked *