How do I import the aubio-rs crate in the main file and how do I get started with it?

So with this crate: https://docs.rs/aubio-rs/0.1.3/aubio_rs/

I already put it in the Cargo.toml file, but in the main.rs file how would I import this library?

I additionally want to know how do I get started with this as I am very lost. How would I import a music and start analysing the data on the song etc?

as well as putting it in the Cargo.toml file, you typically have a use statement, although you can reference items directly.

For example:

use aubio_rs::FFT;
1 Like

I see, thanks,

How would I also get started with this crate? I want to read a file called audio.mp3 and I want to get beats per minute, pitch/key signature and loudness of the file, would you happen to know exactly how to do this if this is the correct crate I am using?

I think you need to look around at the documentation. Following links in the crate

https://crates.io/crates/aubio-rs

got me to


and then
https://aubio.org/documentation

I saw an example written in C, you would need to translate this to Rust ( which should be fairly straight-forward ).

1 Like

i had a look at the website i don't think aubio supports key detection (it does support pitch detection); unfortunately i don't know any other library that does this, and i don't think this is an easy problem to solve (see this stackoverflow thread)

1 Like

Thanks mate :slight_smile:

With this library aubio-rs do you know how I can play a song and get the beats per minute value? I am kinda bad at this at the moment?

for playback, have a look at
https://docs.rs/rodio/0.11.0/rodio/

for bpm there seem to be several solutions, either aubio that you linked above or maybe simple_bpm?

disclaimer: i haven't used any of the above myself

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.