Rust Audio

What is the correct crate/audio library I should use to extract frequencies?

Hi, I am looking an audio library that allows me to import an audio file, and extract frequencies from it as well as to play the audio file. What should I use?

Hi @rusty_programmer, welcome on this forum (and Merry Christmas, if you’re into that).

I don’t think there is a library that does all three (importing audio file, extracting frequencies and playing it). So you’ll probably have to use different libraries for that and combine these.

  • For importing audio files, you can use audrey or sndfile, just to name some that I know (I’ve never used either myself).
  • I’m not sure what you mean by extracting frequencies. Do you mean something like the short-term FFT?
  • For playing audio files, you can use rodio, which does both reading audio files and playing it, but there were many questions about rodio on this forum where I advised to encourage using cpal directly (rodio is built on top of cpal), so I would use cpal from the start of the project.

For combining these crates, you may also have a look at rtrb, which you will probably need if you want to write real-time audio software.

Extra tip: you can use to discover crates in the rust ecosystem.