#resampling #sound #sox #soxr

libsoxr

Wrapper for libsoxr (resampling library for sounds)

12 releases

0.2.9 Apr 12, 2023
0.2.8 Feb 1, 2022
0.2.7 May 23, 2021
0.2.5 Feb 24, 2021
0.1.6 Dec 24, 2020

#196 in Audio

Download history 5/week @ 2024-07-20 159/week @ 2024-07-27 391/week @ 2024-08-03 183/week @ 2024-08-10 239/week @ 2024-08-17 58/week @ 2024-08-24 27/week @ 2024-08-31 16/week @ 2024-09-07 39/week @ 2024-09-14 102/week @ 2024-09-21 114/week @ 2024-09-28 46/week @ 2024-10-05 58/week @ 2024-10-12 38/week @ 2024-10-19 183/week @ 2024-10-26 181/week @ 2024-11-02

484 downloads per month
Used in 3 crates (2 directly)

LGPL-2.0

1MB
737 lines

Contains (WOFF font, 190KB) docs/FiraSans-Medium.woff, (WOFF font, 185KB) docs/FiraSans-Regular.woff, (WOFF font, 94KB) docs/SourceSerifPro-Bold.ttf.woff, (WOFF font, 89KB) docs/SourceSerifPro-Regular.ttf.woff, (WOFF font, 56KB) docs/SourceCodePro-Regular.woff, (WOFF font, 56KB) docs/SourceCodePro-Semibold.woff and 1 more.

libsoxr-rs

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

crates.io API documentation license

For direct access to the native libsoxr functions, you can use the libsoxr-sys crate. The documentation including examples can be found here.

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


lib.rs:

libsoxr-rs

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

For direct access to the libsoxr functions, you can use the libsoxr-sys crate.

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:

[dependencies]
libsoxr = "0.2"

Example

// upscale factor 2, one channel with all the defaults
let soxr = 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. First run will convert the source data into target.
// Last run with None is to inform resampler of end-of-input so it can clean up
soxr.process(Some(&source), &mut target).unwrap();
soxr.process::<f32,_>(None, &mut target[0..]).unwrap();

// just print the values in target
for s in target.iter() {
  print!("{:?}\t", s)
}

Dependencies