ejmahler / RustFFT

RustFFT is a high-performance FFT library written in pure Rust.
Apache License 2.0
678 stars 47 forks source link

Question: how to get frequency and phase from complex numbers #99

Closed beckend closed 1 year ago

beckend commented 1 year ago

I was wondering how I get that, are there recommended crates to convert these numbers?

HEnquist commented 1 year ago

This may be helpful: https://www.mathworks.com/help/matlab/ref/fft.html

That shows how to get the frequency and amplitude. Phase is more difficult. In principle it's just the angle of the complex numbers, but interpreting the number to something useful tends to get tricky. What do you want to achieve?

beckend commented 1 year ago

I have microphone audio samples of amplitudes in f32, Ineed continuous frequency, phase, amplitude data. I do not quite understand what code to write to get such data using rustfft.

HEnquist commented 1 year ago

Rustfft does a standard fft, it gives you the same result as pretty much any other fft out there. I would suggest prototyping in something more interactive until you know exactly what to do. Python (with numpy), Matlab or Octave for example. They have fft functions that give the same result, and you can easily plot the data as you work on the algorithms.

beckend commented 1 year ago

Ok thanks