Giter Site home page Giter Site logo

ni-file's Introduction

Native Instruments File Format

Progress

This library is a work in progress. It can read files and do a few other things so far. Any help would be appreciated.

  • Read NI file containers
  • Read type (kontakt, fm8, etc)
  • Read version number
  • Decompress compressed segments
  • Full support for NI file containers (all fields understood and documented)
  • ... everything else?

File Schematic

Block Format

File is made up of nested blocks, denoted with 'hsin' tags / magic numbers.

HSIN - Header Section In

<LENGTH_OF_SEGMENT: le_u64>
<HEADER_TAG: "hsin" / 4-bytes>
<CHECKSUM 16-bytes>
<DATA_SEGMENT_LENGTH le_u64>
<DATA_SEGMENT {DATA_SEGMENT_LENGTH}-bytes>
<NUMBER_OF_CHILDREN le_u32> // usually 0
<CHILD_TYPEID le_u32>
<EMBEDDED_SEGMENTS (remaining data)>

The first block length in the file will be the entire file size, as it represents one block and other hsin blocks are embedded within.

DSIN - Data Structure In

DSIN blocks act as maps or slice indexes. The first DSIN is usually the length of the whole data chunk, minus footer data. Each DSIN is embedded inside its parent data. Like inception. Only dumber.

Format:

<LENGTH_OF_SEGMENT: le_u64>
<HEADER_TAG: "DSIN" | "4KIN" | "RTKR" | etc / 4-bytes>
<TYPE: le_u32>
<UNKNOWN: le_u32> // always 1
<CHILD_DSIN_LENGTH: le_u64>
<CHILD_DSIN {CHILD_DSIN_LENGTH}-bytes>
<DATA (remaining data)>

Footer data

Compressed segments

The main preset is compressed with a custom LZ77 variant. deflate.rs can deflate a segment. The segment will start as normal, but appears to embed another file (with its own data segments, compressed) as data in a DSIN (type 115).

IMPORTANT: the compression starts 11 bytes into the data slice, but you must provide an initial dictionary of 00.

Note that checksums and file lengths for the file header are usually SKIPPED in kontakt, you can remove them entirely in some situations and the patch will still load. This also applies to DSIN tags. I think NI might have tried to make their code more efficient by directly reading offsets.

ni-file's People

Contributors

monomadic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.