First post and some questions

Lord Adef

New Member
Hi everyone,

Since I just joined the family here, I thought I should introduce myself before asking for any help.

I´m Alex, I work as a composer and Music Producer and work with Kontakt on a daily basis (as we all are, I assume).

I´m also an Assembly programmer, although it´s more like a hobby. C is fine too, but I really enjoy Assembly programming.

Anyway... Here I am.
KSP script is easy, already into it. The Kontakt side of it is a bit tougher for now.

Sublime is already up and running with KSP script (Doing it within Kontakt is a nightmare...).


I will try not to ask many question though, but as a start:

1. I am more familiar with Visual Code rather than Sublime. Is anyone here using VC for KSP?
2. Can you give me some guidelines on general performance optimizations in KSP?
I see scripts making use of random functions, something that I would change, and would use a look up table instead, to speed it up. But I don´t know what´s happening under the KSP hood.


Anyway, good to be here
Alex
 

d.healey

Music Monkey
1. I am more familiar with Visual Code rather than Sublime. Is anyone here using VC for KSP?
2. Can you give me some guidelines on general performance optimizations in KSP?
I see scripts making use of random functions, something that I would change, and would use a look up table instead, to speed it up. But I don´t know what´s happening under the KSP hood.
Welcome to the forum!

1: Nope, the only KSP compiler is SublimeKSP (not counting Nils' original outdated compiler).

2: KSP is very well optimized for real time performance. Using the random function is not going to slow down your script by any noticeable amount. Of course look up tables are usually more efficient, but sometimes not as easy to maintain or update.
 
OP
L

Lord Adef

New Member
Cheers David!

Is there any timing function to benchmark code in the script (you know, Assembly programmers are a bit obsessed with bench-marking)?
 

d.healey

Music Monkey
I don't think there is a specific function for benchmarking, unless one has been added in k6. You can use engine uptime before and after a block of code though to get an idea of execution time. What kind of behemoth script are you planning? ;)
 
OP
L

Lord Adef

New Member
I´m still testing the waters, really.
I pulled one step sequencer script from the factory and am changing things, adding key switches and so forth. Now with Sublime things are easier, and the macro add on helps an awful lot.

I own a recording studio, so I am building a percussion instrument I recorded here. 7 round robins, and release trigger.

The manual and youtube are helping a lot, including your videos which I´ve watched. Congratulations btw, they are very informative and well organized.

I am Steinberg user, so I am using SpectraLayers as the cleaning lady, instead of RX. I wonder if Wavelab is suited for sample editing. There is a "Sample" window, but I never checked it
 

EvilDragon

KSP Wizard
Yes, you can use $KSP_TIMER to benchmark your things. Note that it times things in microseconds, and since it's a 32-bit variable (like everything else in KSP, 32-bit signed int or float), after about 30 minutes it will overflow. Hence you should use reset_ksp_timer() before your timing operation.

But in general you shouldn't be too concerned. Sounds like you have programming chops from before, so you also probably have good programming practices :) Just use KSP as any other procedural programming language, don't try to use OOP style with it, it's not meant to do that.
 
OP
L

Lord Adef

New Member
Cheers AD,

Thanks for the inputs

I always try to write very optimized code, even if there is no urge to it.

Reading the SublimeKSP I learned KSP has structures. I wonder why they didn´t use it in the script I am studying (Factory preset Poly Step).

Based on your last comments, I wonder if this is the nature of KSP design (to avoid structs), or there wasn´t any in 2009 and they didn´t bothered to update the code.

I see all those loose variables floating around and I would make a struct for them. What would you suggest?