A utility for extracting data from Native Instruments Kontakt (.nki) files.
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
- 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
- Kontakt 1-4
- WAV Audio: Detects and handles both raw PCM and compressed formats
- Preserves original filename patterns including note numbers and names
./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
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
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
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)
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
- Standard C compiler (clang or gcc)
- System zlib library (zlib1g-dev on Debian/Ubuntu, zlib-devel on RHEL/CentOS)
- 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