Crates.io | pyin |
lib.rs | pyin |
version | 1.2.0 |
source | src |
created_at | 2022-04-03 11:01:15.91429 |
updated_at | 2024-07-21 11:20:46.363196 |
description | pYIN pitch detection algorithm written in Rust |
homepage | |
repository | https://github.com/Sytronik/pyin-rs |
max_upload_size | |
id | 561266 |
size | 100,743 |
This crate provides a pitch estimate for each frame of the audio signal and a probability that the frame is a voiced region.
The implementation is based on librosa. For easy translation from Python + Numpy to Rust, the implementation is written on top of ndarray crate.
You can download the executable binary from the Releases page.
pyin <input_file> <output_npy_file> <fmin> <fmax> --frame_ms <frame length in miliseconds>
You can use this both as an executable binary and as a library (C shared library and Rust library).
When you build, you can use BLAS by turning on the blas
feature flag.
cargo run -F build-binary[,blas] --release <input_file> <output_npy_file> <fmin> <fmax> --frame_ms <frame length in miliseconds>
or
cargo build -F build-binary[,blas] --release
./target/release/pyin <input_file> <output_npy_file> <fmin> <fmax> --frame_ms <frame length in miliseconds>
The example is in test/test.c
. To build and run it with GCC,
./compile_test.sh [blas]
LD_LIBRARY_PATH=target/release ./test_pyin
Add the following to your Cargo.toml
:
[dependencies]
pyin = "1.2.0"
# or, pyin = {version = "1.2.0", features = ["blas"]}