KSP Improvement Suggestions
Here is a small list of very useful features that I wish were available in KSP to save some code writing:
● The ability to pass variables to functions like this:
function myFunction($var1, %var2, …) declare $myFunctionVar1 := $var1 declare %myFunctionVar2 := %var2 … end function
● The ability to use local scope variables inside functions like this:
function myFunction() declare myLocalVar1 := 1 declare myLocalVar2 := 2 … end function
● Support load and save structured data in JSON files (.nkj) with the ability to read content in the structure (parents vs child objects):
declare @myJsonFileContent @myJsonFileContent := load('myJsonFile.nkj') $knob1Value := @myJsonFileContent['parameters']['knob1Value'] OR $knob1Value := @myJsonFileContent.parameters.knob1Value … end function
● Support for multi dimensional arrays:
declare %presets[10, 8]
Which ones are yours?
NOTE: THIS POST REPLACE THIS ONE WITH BAD CODE FORMATTING. PLEASE DELETE THE POST HERE UNDER:
https://community.native-instruments.com/discussion/28358/ksp-improvement-suggestions
Comments
-
I'm sorry to say but none of these are going to be implemented.
Passing variables to functions would be really handy, but since it is doable already with manual management of variables, nothing will be done there. You can though have some transpiler help using SublimeKSP for this:
SublimeKSP also manages local scope variables for you.
I personally don't like it for some reasons so I also manage this manually.
The JSON thing is... not completely off the table, but the notation you proposed might be.
I am not saying these things out of any special knowledge I have from inside NI, but from a number of conversations I had with their people.
2 -
Thanks @Gablux for commenting,
SublimeKSP seems really great at first sight. After looking at the repo and the doc quickly, there are a couple of powerful features that retains my attention right from the start:
- Multidimensional Arrays
- Structs
- Functions with properties
- Macros
- Import
As a Visual Studio Code user, I would give it a try for sure if it was available as a VS Extension with automatic compilation run after each update (save) on the code. Meanwhile, I'll keep it in my backlog of things to experiment for sure.
Thanks again for this great suggestion!
0 -
Yeah I feel you, I use vs code on other non ksp things
for Sublime KSP I use sublime and it is fine, works really well. I recommend.
Staying in vanilla KSP will drive you crazy
1 -
Yeah I admit I need to produce a good bunch of code for simple things and I also need to be careful with variable names to avoid collisions between function calls, especially when they're using the same global variable for looping with while loops, for instance.
Apart that, it's not that bad since I started working with KSP 1 month ago only and now that I got the big picture I started to built my first instrument which, in short, contains 6 layers (user's sample), each with it's own loops, arpeggiator and settings such as ADSR and FILTERS, Compressor, etc. So far, so good. The CPU is still around 5% when playing a chord of ten notes on the six layers all together.
Right now, I'm trying to add a granular synth for each layer. I admit, it's a bit challenging but I'm almost done with it. Now I need to handle the envelope release because the Kontakt envelope handler doesn't follow the current playing direction (forward/reverse). It's sad by the way that KSP doesn't provide any parameter to change the reverse parameter on the source. That would have saved me a good bunch of code.
I'm going to try SublimeKSP once I've finished my own experimentation with KSP.
Kontakt is an awesome engine by the way. Handling all these samples, notes and parameters live with such a low footprint on the CPU, it's impressive.
See You!
0 -
it is the power of C/C++
1 -
Another improvement suggestion to KSP that came up to my mind while coding and that would be very useful: callbacks on variable changes.
Could be like this, roughly:
on init … declare ui_knob $volume1 declare ui_knob $volume2 declare %volumes[2] end on
on var_change(%volumes) save_array(%volumes, 1) end on
on ui_control($volume1) … %volumes[0] := $volume1 … end on
on ui_control($volume2) … %volumes[1] := $volume2 … end on0 -
You should join the Kontakt Discord server
1 -
The invite seems to be expired:
0
Categories
- All Categories
- 19 Welcome
- 1.4K Hangout
- 60 NI News
- 760 Tech Talks
- 4K Native Access
- 16.2K Komplete
- 2K Komplete General
- 4.2K Komplete Kontrol
- 5.6K Kontakt
- 1.6K Reaktor
- 373 Battery 4
- 831 Guitar Rig & FX
- 423 Massive X & Synths
- 1.2K Other Software & Hardware
- 5.6K Maschine
- 7.1K Traktor
- 7.1K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators