Crates.io | rustchord |
lib.rs | rustchord |
version | 0.5.0 |
source | src |
created_at | 2020-12-25 22:36:27.40447 |
updated_at | 2022-01-24 04:43:53.109126 |
description | Colorchord bindings for Rust |
homepage | |
repository | |
max_upload_size | |
id | 327289 |
size | 27,241,967 |
These are simple bindings around the Notefinder construct in Colorchord. Colorchord is an amazing piece of software written by CNLohr. I've been wanting to use the algorithm in different projects and decided to write a easy Rust bindings that allows you to run the algorithm against audio acquired in Rust.
The Notefinder expects to read samples from a ringbuffer in order to generate the bucketed notes. For this reason you need to provide a simple ringbuffer with audio samples in f32
format. The audioinput
showcases how to do this.
First create a new instance of the Notefinder with the samplerate that's expected:
let mut notefinder = rustchord::Notefinder::new(48000)
Then provide samples in a buffer as you process them:
notefinder.run(&samplevec)
After Notefinder has ran you can get the folded notes by doing:
notefinder.get_notes()
You can configure parameters of the Notefinder using the set_ methods. For example, to change the input amplification you can use:
notefinder.set_amplification(10.0)
git clone https://github.com/coral/rustchord.git
cd rustchord
git submodule update --init --recursive
cargo build
To run the audio input example, just do
cargo run --example audioinput
ColorChord is Copyright 2015 Charles Lohr, Under the MIT/x11 License.
All other code is licensed under the MIT license.