RustFFT | performance FFT library written in pure Rust

 by   ejmahler Rust Version: 6.1.0 License: Apache-2.0

kandi X-RAY | RustFFT Summary

kandi X-RAY | RustFFT Summary

RustFFT is a Rust library typically used in Big Data applications. RustFFT has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

RustFFT is a high-performance FFT library written in pure Rust. It can compute FFTs of any size, including prime-number sizes, in O(nlogn) time. RustFFT supports the AVX instruction set for increased performance. No special code is needed to activate AVX: Simply plan a FFT using the FftPlanner on a machine that supports the avx and fma CPU features, and RustFFT will automatically switch to faster AVX-accelerated algorithms. For machines that do not have AVX, it also supports the SSE4.1 instruction set. As for AVX, this is enabled automatically when using the FftPlanner. Unlike previous major versions, RustFFT 5.0 has several breaking changes compared to RustFFT 4.0. Check out the Upgrade Guide for a walkthrough of the changes RustFFT 5.0 requires.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              RustFFT has a low active ecosystem.
              It has 482 star(s) with 33 fork(s). There are 12 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 12 open issues and 26 have been closed. On average issues are closed in 31 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of RustFFT is 6.1.0

            kandi-Quality Quality

              RustFFT has 0 bugs and 0 code smells.

            kandi-Security Security

              RustFFT has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              RustFFT code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              RustFFT is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              RustFFT releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.
              It has 217 lines of code, 4 functions and 3 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of RustFFT
            Get all kandi verified functions for this library.

            RustFFT Key Features

            No Key Features are available at this moment for RustFFT.

            RustFFT Examples and Code Snippets

            No Code Snippets are available at this moment for RustFFT.

            Community Discussions

            QUESTION

            How to modify and then inverse complex data that went through FFT algorithm?
            Asked 2022-Feb-28 at 15:27

            I wrote a low-pass filter based around the FFT algorithm.

            First I process the input data using forward FFT, then I decrease the "volume" of parts of the resulting spectrum, then I put the data into the inverse FFT and finally I normalize the data like this:

            ...

            ANSWER

            Answered 2022-Feb-28 at 13:30

            There are two issues with your code:

            1. Since you want to process real data (i.e. data whose imaginary part is 0), the output of the forward FFT is symmetrical and you need to apply the same coefficient to matching frequencies (i.e. spectrum[i] and spectrum[spectrum.len() - i], remembering that spectrum[0] stands alone, and so does spectrum[spectrum.len()/2] if the length is even).

            2. If the frequencies are symmetrical, the result of the inverse FFT should be real (i.e. the imaginary part should be 0 ± small rounding errors). Therefore your normalize function should use x.re instead of x.norm(), which will allow it to retain its sign.

            Source https://stackoverflow.com/questions/71293024

            QUESTION

            What do I have to do to change the visuals of my audio visualizer?
            Asked 2021-Aug-08 at 20:07

            I created my own audio visualizer in rust where I have the amplitude of each frequency stored as [f32; 3750].

            I use cpal as audio backend with f32 audio samples, 2 channels and a 44.1khz sample rate.

            I converted those samples using rustfft like this:

            ...

            ANSWER

            Answered 2021-Aug-08 at 20:07

            Your code is, in a sense, fine; what you are seeing are basic problems with interpreting the FFT, not with computing it.

            First, the FFT is naturally a function from complex samples to complex samples. When you start with a real-valued input signal and convert it to complex by adding a zero imaginary component (or any other simple value, even copying the real input_buffer[i]), the output will always be a mirrored spectrum.

            (Complex-valued signals can have arbitrarily asymmetric spectra, distinguishing positive frequencies from negative ones. This is not widely useful in audio, but it is fundamental to software-defined radio (SDR) applications of FFT and other DSP operations.)

            In order to not get the mirroring, you must discard one half of the output. (It's slightly more efficient — though not 50%, if I recall correctly — to skip computing that half, but it doesn't look like rustfft offers that option.)

            If you discard the upper half of the output (in terms of array indices), then you will find that the remaining “frequency bins” are arranged from 0 Hz up to 22.05 kHz. The library documentation notes this:

            Output Order

            Elements in the output are ordered by ascending frequency, with the first element corresponding to frequency 0.

            Applications that do use the second half of the spectrum often swap the two halves, so that instead of a range of 0 Hz to [sampling frequency]/2, they go from −[sampling frequency]/2 to +[sampling frequency]/2. But since you're starting with a real, not complex, signal, this doesn't apply to you; I just mention it since you might have seen it in other plots that have 0 Hz at the center.

            The drop-off which is visible in the center of your image corresponds to the high-pass anti-aliasing filter required in any digital signal processing. It should appear at the right edge once you've discarded the right half.

            Finally, your code does not appear to have any windowing applied to the input signal. Windowing is a complex topic, but it is necessary to account for the fact that the FFT presumes a periodic signal which exactly repeats over the length of the input buffer, but we're actually feeding it a signal whose period is not an even division of the input buffer; windowing dampens the effects of this by attenuating the beginning and ending portions of the signal.

            You should look up a standard window function and apply it to your input data before the FFT; this should reduce the secondary peak you're observing.

            Source https://stackoverflow.com/questions/68702132

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install RustFFT

            You can download it from GitHub.
            Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.

            Support

            RustFFT requires rustc 1.37 or newer. Minor releases of RustFFT may upgrade the MSRV(minimum supported Rust version) to a newer version of rustc. However, if we need to increase the MSRV, the new Rust version must have been released at least six months ago.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/ejmahler/RustFFT.git

          • CLI

            gh repo clone ejmahler/RustFFT

          • sshUrl

            git@github.com:ejmahler/RustFFT.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link