Skip to content

Latest commit

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Samplerate

Build StatusDocs

A samplerate conversion library for Rust. This library provides a high-level API for libsamplerate-sys and hence is built on top of libsamplerate.

Example

externcrate samplerate;externcrate hound;use samplerate::{convert,ConverterType};use hound::{WavSpec,WavWriter,SampleFormat};fnmain(){// Generate a 880Hz sine wave for 1 second in 44100Hz with one channel.let freq = std::f32::consts::PI*880f32 / 44100f32;let input:Vec<f32> = (0..44100*5).map(|i| (freq * i asf32).sin()).collect();// Resample the input from 44100Hz to 48000Hz.let resampled = convert(44100,48000,1,ConverterType::SincBestQuality,&input).unwrap();// Write the resampled pcm data to disk.letmut writer = WavWriter::create("resampled.wav",WavSpec{channels:1,sample_rate:48000,bits_per_sample:32,sample_format:SampleFormat::Float,}).unwrap();
resampled.iter().for_each(|i| writer.write_sample(*i).unwrap());}

About

High level Rust bindings for libsamplerate.

Resources

Stars

19 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages