Crate spectrum_analyzer[][src]

Simple no_std spectrum analysis library that follows the KISS (keep it simple, stupid) principle. The main goal of this crate is to be educational to the world and myself. This is not a bullet-proof or ideal solution! Feel free to contribute and point out possible errors/bugs/wrong assumptions or improvements!

Modules

windows

Several window functions which you can apply before doing the FFT. For more information:

Structs

FrequencySpectrum

Enums

FrequencyLimit

Can be used to specify a desired frequency limit. If you know that you only need frequencies f <= 1000Hz, 1000 <= f <= 6777, or 10000 <= f, then this can help you to accelerate overall computation speed and memory usage.

Functions

samples_fft_to_spectrum

Takes an array of samples (length must be a power of 2), e.g. 2048, applies an FFT (using library rustfft) on it and returns all frequencies with their volume/magnitude.

Type Definitions

Frequency

A frequency. A convenient wrapper type around f32.

FrequencyValue

The value of a frequency in a frequency spectrum. Convenient wrapper around f32. Not necessarily the magnitude of the complex numbers because scaling/normalization functions could have been applied.

SpectrumTotalScaleFunctionFactory

Describes the type for a function factory that generates a function that can scale/normalize the data inside FrequencySpectrum. This can be used to subtract min value from all values for example , if min is > 0. The signature is the following: (min: f32, max: f32, average: f32, median: f32) -> fn(f32) -> f32 i.e. you provide a function which generates a function that gets applied to each element.