Skip to content
/ nkitool Public

Extract samples, metadata, and create SFZ files from Native Instruments Kontakt 1-4 (NKI) files

Notifications You must be signed in to change notification settings

reales/nkitool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Mar 23, 2025
95d5f9b · Mar 23, 2025

History

1 Commit
 
 
 
 
 
 

Repository files navigation

NKI Tool

A utility for extracting data from Native Instruments Kontakt (.nki) files.

Features

This tool can extract:

  • XML metadata from Kontakt instrument files
  • WAV samples embedded in the NKI file (both uncompressed PCM and compressed formats)
  • Original filenames and MIDI note mapping information from the NKI file
  • Enhanced SFZ instrument files for use in SFZ-compatible samplers with proper note mapping

What's New in Version 2.0 (2024-03-23)

  • Original filenames are now extracted from NKI's internal listing
  • Prefix cleanup to remove unnecessary path components and prefixes
  • Directory structure is created to match the original instrument
  • Enhanced SFZ files with accurate note mapping and proper filenames
  • Improved filename parsing for better organization

Supported Formats

  • Kontakt 1-4
  • WAV Audio: Detects and handles both raw PCM and compressed formats
  • Preserves original filename patterns including note numbers and names

Usage

./nki <filename.nki>

This will create the following output files:

  • <filename.nki>.xml: XML metadata from the instrument
  • A folder named after the instrument containing all extracted samples
  • Sample files with their original names, cleaned up and with note information preserved
  • <filename.nki>.sfz: Enhanced SFZ format instrument definition with proper mapping

Building from Source

make clean && make

The tool uses the system zlib library. Make sure zlib development files are installed on your system.

  • On macOS: Usually pre-installed
  • On Ubuntu/Debian: sudo apt-get install zlib1g-dev
  • On Fedora/RHEL/CentOS: sudo dnf install zlib-devel

Extractable Data

Sample Extraction and Filename Handling

The tool automatically:

  • Identifies and extracts WAV samples embedded in the NKI file
  • Finds original filenames from the NKI's internal listing
  • Cleans up filenames by removing unnecessary path components and prefixes
  • Preserves MIDI note numbers and names in the filename patterns
  • Creates a directory structure that matches the original instrument

The filename pattern for extracted samples is:

[Instrument Name]-000-[MIDI Note]-[Note Name].wav

For example:

DW8000 Funk Long-000-048-c2.wav
DW8000 Funk Long-000-051-d#2.wav
DW8000 Funk Long-000-054-f#2.wav

SFZ Files

The tool automatically generates enhanced SFZ files that include:

  • Proper sample mapping based on extracted MIDI note information
  • Key ranges for each sample with intelligent boundary calculation
  • Crossfades between sample boundaries for smooth playback
  • Velocity sensitivity appropriate for the instrument type
  • Release sample handling (if release samples are present)

Note Mapping Information

The key mapping information is now extracted directly from the original sample names, providing:

  • Accurate root notes for each sample
  • Intelligently calculated key ranges
  • Proper pitch mapping in the SFZ file

Requirements

  • Standard C compiler (clang or gcc)
  • System zlib library (zlib1g-dev on Debian/Ubuntu, zlib-devel on RHEL/CentOS)

Limitations

  • Cannot extract samples that are referenced but stored externally
  • Some complex NKI files may have samples that cannot be extracted
  • Not all NKI versions or formats are fully supported
  • No support for importing XML back into NKI files

Original Project

http://www.linuxsampler.org/nkitool/

About

Extract samples, metadata, and create SFZ files from Native Instruments Kontakt 1-4 (NKI) files

Resources

Stars

Watchers

Forks

Packages

No packages published