libsoxr-rs

This library is a thin wrapper for libsoxr which is a "High quality, one-dimensional sample-rate conversion library".

This wrapper library is licensed the same as libsoxr itself: LGPLv2.

The documentation can be found here.

Install

add the following to your Cargo.toml: toml [dependencies.libsoxr] git = "https://github.com/lrbalt/libsoxr-rs"

and add the crate:

rust extern crate libsoxr; use libsoxr::Soxr;

Example

```rust // upscale factor 2, one channel with all the defaults let s = Soxr::create(1.0, 2.0, 1, None, None, None).unwrap();

// source data, taken from 1-single-block.c of libsoxr examples. let source: [f32; 48] = [0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0];

// create room for 2*48 = 96 samples let mut target: [f32; 96] = [0.0; 96];

// two runs. last run with None to inform resampler of end-of-input let result = s.process(Some(&source), &mut target).andthen(|| { s.process::(None, &mut target[0..]).andthen(|| { for s in target.iter() { print!("{:?}\t", s) } Ok(()) }) }); ```