Posted by & filed under KSP Scripting (NI Kontakt) - Tutorials, KSP: Basics.

Before you start scripting you should create a resource container where you put in all your files you need for your instrument (e.g graphic files or impulse responses etc.)

  1. start Kontakt and create a new instrument
  2. save your instrument into a new folder
  3. click on the wrench button, click on “instrument options”  and click “create” (left image)
  4. chose the folder you have just stored your nki/instrument into and enter a name for the resource container. Click “save”
  5. when you are getting asked to create one, confirm it
init_create-resourceinit_create-resource_2

Kontakt automatically creates a “Resources” folder and a “nkr” file. Both have the same purpose: they both contain all resources for your instrument like graphics, impulse responses or scripts. However you can only access the Resources folder and each time you click on the create button again, Kontakt will transfer (and “encrypt”) your resources into the “.nkr”  file. Assuming that you have put in all your files correctly into the “Resources” folder and didn’t forget the text file:

  • you have to store all graphics or images into Resources\pictures\
  • all impulse responses into Resources\ir_samples\
  • scripts to be included into Resources\scripts\
  • for graphics you also have to add a *.txt file with the graphics filename (but ending txt) which is declaring the properties of the respective file. So assuming you put in an image called  “wallpaper.png”  you also have to add a “wallpaper.txt” with this content:
    Has Alpha Channel: yes
    Number of Animations: 0
    Horizontal Animation:  no
    Vertical Resizable: no
    Horizontal Resizable: no
    Fixed Top: 0
    Fixed Bottom: 0
    Fixed Left: 0
    Fixed Right:  0

    the txt file has to be stored into the same folder as your graphic (Resources\pictures\); It has to be stored as UTF-8 or ANSI; It must have the same filename as the respective graphic file;

Also keep in mind that Kontakt will first look into the Resources folder. Only if Kontakt can’t find any files there, it will proceed looking into the nkr file. So the Resources folder has always priority which is very useful for developers because you don’t need create the resources container again and again after adding only one more new file.

Purpose of the nkr file – publishing your instrument

Why do we need the nkr file at all? Well, the nkr file simply “hides” all resources in itself. There are many reasons for not letting the users access your resources e.g they could use them for their own purposes or change things you may not want them to change. So before publishing your instrument simply hit the “create” button again, check if all resources have been inlcuded into the nkr file and publish your instrument folder (nki, nkr, nkc file + samples) without the Resources folder. Unless you want to share all your resources of course. In this case simply share your whole instrument folder including your Resources folder.

It’s also recommended to test if all files are included there before publishing your instrument. For this just copy your instrument folder (without the resources folder) to another location on your hard drive. Open the instrument (nki) from the new location and check if anything is missing. The most obvious you will notice instantly are missing images.

 

6 Responses to “KSP Scripting (NI Kontakt) – BASICS :: Create a Resource Container”

  1. Wesley Henriques

    Hello all, being to Kontakt generate a folder with samples (.nkx and .nkc) what is possible? I try to generate this folder to encrypt my wavs but unfortunately I can not, please help me … Thank you very much! Thank you!

    reply
    • YummyBeats

      hey,
      as far as I know you can only create nkx files with a special agreement with Native Instruments. You need to sign a contract with them and buy special licenses, then your instrument can also be used with the free Kontakt player and can be added to the “libraries” tab. For normal usage you don’t need the nkx files since any graphical content or impulse responses etc is stored into the nkc and nkr file when creating it.

      To create an nkc & nkr file just follow this article and keep in mind to first save your whole instrument as nki file. Save it with relative paths so that you are able to move your instrument with all related files to any folder, later on.

      wav files are stored outside when saving your instrument as “patch + samples”. It’s recommended to create a sub-folder inside the folder where your nki file is located. Simply enter the name of your sub folder into the “Sub-Folder:” field. You can also compress the samples as ncw files. Just check “Compress Samples”.
      Hope this helps!

      reply
    • YummyBeats

      In general every image needs to have a correct .txt file (as described above) in order to get packed into the resource container.
      If you are working on a mac you should also add a blank line after “Fixed Right: 0” (9th line) as stated by @Serge below

      reply
  2. Serge

    Hi _

    Be careful about the number of lines in the .txt file of a graphic file: need to add a blank line in tenth position (with nothing) to work properly with an Apple machine.
    Best

    reply

Leave a Reply

Your email address will not be published. Required fields are marked *