# Exporting / converting a .nkp table preset into an array of values, how?



## KrisY (Feb 8, 2019)

Is there a way to export or convert a .NKP table preset into numbers from 0-100 values, one value per column, with a row count of 128? So, basically I want to get a spread sheet of the values in the table and use that in an array, in the end. 

_(either by loading a preset and saving it in ksp, or by any/all other means, like shell-script or alike)_

*A .nkp preset file contains:*
_(when opening it in Sublime Text 3)_


4007 0000 0000 0000 0100 0000 6873 696e
0100 0000 0000 0000 6bc0 1c25 87b8 46a6
a3b8 878a 32f6 4906 9600 0000 0000 0000
4453 494e 7600 0000 0100 0000 4800 0000
0000 0000 4453 494e 6a00 0000 0100 0000
1800 0000 0000 0000 4453 494e 0100 0000
0100 0000 0100 0000 0100 0000 0100 0000
0100 0000 0000 0000 0000 0000 0000 0000
0d62 6585 0100 0000 0770 1000 0000 0000
0100 0000 0100 0000 0000 0000 0000 0000
0000 0000 0300 0000 3000 3000 3000 0000
0000 0000 0000 0000 0000 0000 0000 0100
0000 0100 0000 0000 0000 4453 494e 7500
... ... and then the rows continue...

There´s 8 columns in every row. When looking through the presets in my user folder, I see that it´s not one row per staple/bar in the table. Its random, or any number of rows in the document. So I guess it´s not a formula that is used anywhere else, ey?

Is it possible to get any usable format for a spreadsheet or a 2D array?

_Would like to use a specific preset as a release trigger counter model, with each number set to one 128th of XXX seconds, split into percentages. But really, it has much more applications than that._

Thanks upfront!


----------



## polypx (Feb 8, 2019)

An NKP is not an array, it's a script preset. Are you confusing it with an NKA ?


----------



## KrisY (Feb 8, 2019)

Perhaps you missunderstood the issue. Indeed it is not an array. And that was not suggested either. I want to put an .nkp table preset into an array. So, the values of the table becomes the array values. 

But maybe there is already a good way to convert a .nkp preset (table preset) into an array, using KSP?


----------



## EvilDragon (Feb 8, 2019)

Yes, check the Kontakt reference manual, section about modulation shapers. There are some shortcuts for saving/loading modulation shaper tables to/from txt files.


----------



## polypx (Feb 9, 2019)

That's cool. I didn't realise you could do that. (SHIFT-click on the ACTIVE button export, SHIFT-COMMAND-click to import.)

Interesting that the output is floating point too, I'd always assumed it was 127 to 127, but you can be much more precise than the GUI suggests.


----------



## EvilDragon (Feb 9, 2019)

Yeah it's just rounded visually AFAIK.


----------



## KrisY (Feb 10, 2019)

EvilDragon said:


> Yes, check the Kontakt reference manual, section about modulation shapers. There are some shortcuts for saving/loading modulation shaper tables to/from txt files.



Thanks! Great, but I cannot find it in the manual. Are you referring to "*load_array_str() / load_array()*"? 

I managed to export one through the instructions from polypx´s entry though, but need the explanation first.


----------



## KrisY (Feb 10, 2019)

polypx said:


> That's cool. I didn't realise you could do that. (SHIFT-click on the ACTIVE button export, SHIFT-COMMAND-click to import.)
> 
> Interesting that the output is floating point too, I'd always assumed it was 127 to 127, but you can be much more precise than the GUI suggests.



Yeah, never knew that. Cool, and very useful. Now I would be able to make certain find/replace actions to just re-order text into a simple array, then reference the values as time-based points.


----------



## KrisY (Feb 10, 2019)

EvilDragon said:


> Yes, check the Kontakt reference manual, section about modulation shapers. There are some shortcuts for saving/loading modulation shaper tables to/from txt files.





KrisY said:


> Yeah, never knew that. Cool, and very useful. Now I would be able to make certain find/replace actions to just re-order text into a simple array, then reference the values as time-based points.



Sorry, jumped the gun there. I looked in only the KSP manual. :/ You clearly said "Kontakt reference manual". Thanks for the tip, found it. KONTAKT 5 - Application Reference - 308:



> INFO BOX:
> _When using this Table mode of editing the modulation shape, you have the option to import and export the table data as a text file. To open the export dialog, [Shift]-click the Active button; and to open the import dialog, use [Shift] + [Ctrl] on Windows or [Shift] + [Cmd] on Mac OS X. _



A cutout of Sublime Text 3, viewing a .txt export of a table:

(0 = minimum, 1 = maximum values)


----------



## KrisY (Feb 10, 2019)

That concludes this issue SOLVED. Thanks.


----------

