# KSP Math Library V702



## Big Bob (Jul 15, 2015)

HI Guys,

V702 of the KSP Math Library is now available.

This latest version of the Library has some nice new functions that many of you will find very useful.

There are 3 new Log and 3 new Exponential routines that feature *Variable Scaling*. These routines can simplify the use of logs and exponentials for many common applications such as converting pitch to frequency.

Two new conditional predicates named *pRange* and *pRange0* have been added to the library's extensive set of predicates. Like all the prior predicates, these functions can be used inline anywhere in your code just like KSP functions.

In addition, four more inline functions are now available. *Clamp*, *Clamp0*, *Max*, and *Min*. These one-line, return-value functions allow you to easily eliminate the need for the if-else constructs usually used to implement these common tasks in your code.

**********************************************************************

I receive a fair number of PMs and emails asking about the Library functions that have been added since V700. So, I'm going to try to post a series of short tutorials on how to use some of these newer library functions. I will probably begin with a post about how to use *conditional predicates* and take it from there depending on how much interest there appears to be.

Rejoice,

Bob

*EDIT: Installment #1 and #2 on Conditional Predicates and Pitch, Frequency, and Variable Scaling have now been posted.

NOTE: I also found some typos in the User Guide and corrected them. Please download again if you downloaded prior to 7-16-15.

http://vi-control.net/community/ind...ditional-predicates-for-fun-and-profit.46687/*

http://vi-control.net/community/index.php?threads/pitch-frequency-and-variable-scaling.46717/


----------



## Alesis (Jul 15, 2015)

Thanks Bob!


----------



## d.healey (Jul 15, 2015)

:D Thanks again Bob!


----------



## Reegs (Jul 15, 2015)

Thanks Bob!


----------



## Big Bob (Jul 16, 2015)

Thanks for the thanks guys

However I want to advise all of you, that have previously downloaded V702, that I found a couple of serious typos in the User Guide and corrected them. I think they are important enough corrections that you should re-download the attachment again and discard the earlier manual. The corrected manual has a cover date of 7-16-15 (vs 7-15-15 for the earlier version).

Sorry for the inconvenience.

Rejoice,

Bob


----------



## Big Bob (Jul 17, 2015)

Both of the promised Mini Tutorials are now posted:

http://vi-control.net/community/ind...ditional-predicates-for-fun-and-profit.46687/

http://vi-control.net/community/index.php?threads/pitch-frequency-and-variable-scaling.46717/

*Also again I need to remind everyone that downloaded V702 prior to 7-16-15* that you should download the corrected version. There were quite a few initial downloads that haven't 'paired up' yet and I wouldn't want you to 'get bit' by the typos when you eventually get around to using some of the new stuff. 

Rejoice,

Bob


----------



## dogknob (Dec 11, 2015)

Hi. New to Kontakt. One reason I got it was for the scripting... I can't find any information on where to install the math library. I'm on Win 7, I have the script editor and the Sublime plugin... so where do I put the math library?


----------



## tsherr (Dec 11, 2015)

Just put KSPMathV702.ksp in the same folder as your script. Then, in your script, import the math library with the following line (before on init):
import "KSPMathV702.ksp"

You'll have to then call SetMathMode() in on init - see the https://dl.dropboxusercontent.com/u/80404485/Kontakt/Math%20Library/Docs/KSPMathUserGuide_V702.pdf (documentation) for a description of what parameters to pass.


----------



## dogknob (Dec 11, 2015)

tsherr said:


> Just put KSPMathV702.ksp in the same folder as your script. Then, in your script, import the math library with the following line (before on init):
> import "KSPMathV702.ksp"
> 
> You'll have to then call SetMathMode() in on init - see the https://dl.dropboxusercontent.com/u/80404485/Kontakt/Math%20Library/Docs/KSPMathUserGuide_V702.pdf (documentation) for a description of what parameters to pass.



Thank you 
What about the demo instruments? Those are already compiled into Kontakt-ese?


----------



## dogknob (Dec 11, 2015)

Might as well ask while I'm here:

Did I do this right for KSP.sublime-settings?

```
{
    "optimize_compiled_code": true,
    "extra_syntax_checks": true,
    "compact_output": true
}
```


----------



## EvilDragon (Dec 11, 2015)

Those are all optional.


----------



## dogknob (Dec 11, 2015)

EvilDragon said:


> Those are all optional.


Thank you.

The math pack pdf threatens  in boldface if I don't set these. Easy in KScript Editor, but I was wondering about the syntax in the Sublime plugin. I just made it look like one of the other sublime config files.


----------



## EvilDragon (Dec 11, 2015)

That should be fine, then.


----------



## d.healey (Dec 11, 2015)

dogknob said:


> Thank you.
> 
> The math pack pdf threatens  in boldface if I don't set these. Easy in KScript Editor, but I was wondering about the syntax in the Sublime plugin. I just made it look like one of the other sublime config files.


You can also access those options from the tools menu in sublime text


----------

