At a Glance
A modern Syntax for KSP
Introducing local variables, functions and data structures in a modern syntax - delivering cleaner, more readable, and maintainable code.
Learn more →Easy Transition from Sublime
Simplyfying migration by supporting most Sublime KSP features and ensuring compatibility as well as ease of integration with existing codebases.
VS Code Extension
Discover CKSP Tools, a VS Code Extension for syntax highlighting, go-to-definition, hover documentation, Kontakt log output, and more. It offers a seamless development experience for Kontakt scripts.
Learn more →How to Install
Install the compiler as a build system in Sublime Text, use it in the command line or install the VS Code plugin.
Learn more →Get the Latest Version
Download the latest stable release of cksp from the GitHub repository.
Or stay up-to-date with the latest features and improvements with the current alpha release.
Report a Bug
If you encounter any issues or have suggestions for improvements, please report them on the GitHub repository. Your feedback is highly appreciated.
Learn more →Up to x48 faster Compilation!
Since almost all SublimeKSP features are supported,
cksp can also compile existing sksp projects with minimal changes.
And it does so in seconds with an up to
× speed-up compared to SublimeKSP.
Below are some real-world projects that have been benchmarked with both compilers
(big thanks to Sonuscore for providing these!):
Benchmarks: 2021 MacBook Pro (M1 Max, 64 GB RAM). SublimeKSP:
Optimize Compiled Code and Additional Branch Optimization;
cKSP: #pragma optimize("aggressive").
Stay in your editor.
Ship straight to Kontakt.
CKSP Tools turns Visual Studio Code into a complete Kontakt scripting workspace: write with rich language support, compile in one shortcut, launch Kontakt, and inspect its filtered log output without breaking your flow.
Up to 47% Smaller Generated KSP Code!
Besides faster compilation, cksp also emits smaller, more efficient KSP output reducing parsing and loading work for the Kontakt runtime.
The source column describes the size of each original project in
non-empty, non-comment source lines. The chart shows that source baseline next
to the generated code size produced by SublimeKSP and
cKSP 0.1.0.
Source size: non-empty, non-comment lines in the original codebase. SublimeKSP:
Optimize Compiled Code and Additional Branch Optimization;
cKSP: #pragma optimize("aggressive").
Frequently Asked Questions
The most important questions about CKSP, the compiler, migration from SublimeKSP, and the VS Code workflow.
What is CKSP?
CKSP is a compiler for Native Instruments
Kontakt scripts. You write your script in the
CKSP language, a superset of KSP with local
variables, functions, structs and modules, and the compiler turns it
into plain KSP that Kontakt loads like any hand-written
script.
It reads both *.cksp and vanilla *.ksp
files, is written in C++, and is available in two forms:
- CKSP Tools, a VS Code extension that bundles the compiler with completion, KSP documentation and Kontakt integration.
- A standalone command-line executable for macOS and Windows, for Sublime Text or your own build scripts.
Getting started walks you through a first script in a few minutes.
Is CKSP free?
Yes. Both the CKSP compiler and the CKSP Tools extension are free to download and use. The extension is on the VS Code Marketplace, and the compiler binaries are on the GitHub releases page.
Why use CKSP instead of vanilla KSP?
Vanilla KSP only has global variables declared in
on init, no function parameters or return values, and no
way to group data. That works for small scripts, but large
instruments become hard to read and maintain. CKSP adds what you know
from other languages:
- Local variables and lexical scope: declare a variable in any block. It only exists there, so names no longer clash across the script.
- Real functions with parameters, return values and optional types, which can also be called inside conditions.
-
Structs with methods, operator overloading, generic
type parameters like
List<T>and dynamic allocation withnew. -
Modern loops:
for ... in range(...), for-each over arrays, plusbreakandcontinue. - Imports and namespaces for splitting a project into files.
Kontakt only ever sees the generated KSP, so none of this
requires anything from Kontakt itself. All features are covered in
The CKSP Syntax.
Does CKSP stay compatible with Kontakt?
Yes. The output is ordinary KSP text. Kontakt loads it
like a hand-written script, and anyone who opens your instrument,
whether a colleague or a customer, does not need CKSP installed.
The usual workflow is to write the output straight into your
instrument's resource container with
#pragma output_path("Samples/Resources/scripts/main.txt")
and load that file as a resource script in the script slot. Kontakt
then picks up every new build without copy and paste. You can also
paste the generated *.txt into an empty script slot and
click Apply.
The CKSP Tools project initializer sets this up for you and requires Kontakt 7 or newer. See Kontakt Integration for details.
Can CKSP compile existing KSP or SublimeKSP projects?
Usually yes. Vanilla KSP compiles as is, and CKSP
supports most features of nojanath's SublimeKSP fork, so
many projects build with few or no changes. The differences you are
most likely to run into:
-
Parameter passing: SublimeKSP passes every
function parameter by reference. CKSP passes
int,realandstringparameters by value. Mark single parameters withref, or switch the default with#pragma pass_by("reference"). The compiler warns where a value parameter is modified. -
Output path:
{#pragma save_compiled_source ...}becomes#pragma output_path(...). Written as//#pragma output_path(...), it works with both compilers. - Task functions are no longer needed and can become normal functions. The editor offers a quick fix.
-
Not supported:
propertyblocks,concat()andlist_add(). Structs use a different syntax.
To try it without switching, add cksp as a second
Build System in Sublime Text next to SublimeKSP. If
a build fails, the error message names the construct and what to
replace it with. The full comparison is in
Adopted Features.
Which SublimeKSP preprocessor features are supported?
All of the commonly used ones:
-
macro ... end macrowith#param#text replacement, also inside strings -
defineconstants and function-like defines such asdefine POINT(x, y) := x, y -
iterate_macroandliterate_macro, including the one-line shorthand with#n#and#l#, plus the_post_variants -
START_INC/END_INCnumber incrementers -
The built-in defines, plus
__CKSP_VER__for the compiler version
Beyond the preprocessor, families, constant blocks, UI arrays,
multidimensional arrays, the pers / read
shorthands, control -> param syntax,
set_*_properties() and import_nckp() are
supported too. Examples for each are in
Adopted Features.
How do I compile a CKSP file?
In VS Code with CKSP Tools:
- Compile the project's main file with Shift+Cmd+R on macOS or Shift+Ctrl+R on Windows, or with the play button in the CKSP Sidebar.
- Compile the file you are editing with Shift+Alt+R.
All open files are saved first, and compiler errors in the
cksp terminal link to the exact source line.
In Sublime Text, once cksp is set up as
a Build System, press
Cmd+B
on macOS or
Ctrl+B
on Windows.
From the command line, run
cksp -o path/to/output.txt path/to/main.cksp. Without
-o, the compiler writes out.txt next to the
input file. Use -O3 for the most aggressive
optimization and cksp --help for all options. Setup for
each route is in Installation.
What does the VS Code extension add?
CKSP Tools turns VS Code into an IDE for Kontakt
scripting, for both *.cksp and *.ksp files:
-
Editor: highlighting, completion, signature help,
go to definition, find references and inlay hints. Hovering a
built-in
KSPcommand shows its official documentation, so you rarely need the KSP manual. - Compiler: download and switch compiler versions per project, compile with one shortcut, and click errors to jump to the source.
-
Project setup: New Project creates the
.nki, resource folders and a startermain.cksp, already linked to the script slot. - Kontakt: start Kontakt from the editor, read and filter the Kontakt log, jump from a log entry to its source, and see script errors in the Problems tab.
-
Project awareness: resource file paths and
performance view (
.nckp) controls show up as completions.
It requires VS Code 1.87 or newer. The full feature tour is in VS Code Extension.
How fast is CKSP compared with SublimeKSP?
On six real-world Kontakt libraries provided by Sonuscore, CKSP compiles 13 to 48 times faster than SublimeKSP: between 0.4 and 2.3 seconds, where SublimeKSP takes 12 to 100 seconds. The largest project, Time Textures Expanded, drops from 100 s to about 2 s.
The output is also smaller, by up to 47%: the same project compiles to about 61,000 lines of KSP instead of 115,000, which means less code for Kontakt to parse and load.
Measured on an M1 Max MacBook Pro, with both compilers at their highest optimization settings. The per-project numbers are in the benchmark charts above.
Is CKSP still under active development?
Yes. The compiler and CKSP Tools both get regular releases. Next to the stable versions, alpha pre-releases ship features early. CKSP Tools can install several compiler versions side by side, so you can try a pre-release in one project and keep another on stable.
Recent releases added generic structs, recursive data structures,
booleans with ternary expressions and import ... as.
Classes with polymorphism and recursion are next, as listed under
Planned Features.
Changelogs are on the
releases page.
Where can I find the latest release or report issues?
- Extension: install CKSP Tools from the Extensions view in VS Code or the Marketplace. It downloads the compiler for you.
- Compiler: the latest release has binaries for macOS (arm64 and x86) and Windows.
- Compiler bugs and language requests go to the compiler issue tracker, and extension bugs to the CKSP Tools issue tracker.
When you report a bug, include the compiler version
(cksp --version) and, if possible, a small snippet that
reproduces it.