Native Instruments NCW Audio File Format

crates.io docs.rs

Description

NCW (Native Instruments Compressed Wave) is a lossless compression algorithm developed by Native Instruments which is essentially DPCM and bit truncation.

This library is a zero-dependency Rust-based library to decode NCW files. It serves as part of a wider reverse engineering effort of proprietary audio formats, and this particular library is used in ni-file.

This repository also includes an ncw to wav conversion cli tool, ncw-decode.

Requirements

Usage

```rust let input = File::open(&args[1])?; let mut output = File::create(&args[2])?; let mut ncw = NcwReader::read(&input)?;

let spec = WavSpec { channels: ncw.header.channels, samplerate: ncw.header.samplerate, bitspersample: ncw.header.bitspersample, sample_format: hound::SampleFormat::Int, };

for sample in ncw.decode_samples()? { // save or convert each sample into a file or stream dbg!(sample); } ```

Utility (ncw-convert)

To install the cli utility, install it from cargo:

bash cargo install ncw --package ncw-convert

Usage

Run the program with the following command-line arguments:

bash ncw-decode <INPUT> <OUTPUT>

Contribution

To contribute, create a pull request with your proposed changes.