From a1ccb94640bca320cf3dc03ce8af88182e3443ba Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Mon, 19 Apr 2021 13:00:52 +0200 Subject: [PATCH 1/2] bumped rustfft to v6.0.0 + improved CI + improved README (v0.5.1) --- .travis.yml | 17 ++++++++++++++--- CHANGELOG.md | 13 ++++++++++--- Cargo.toml | 10 +++++----- README.md | 7 +++++++ check-build.sh | 8 ++++++++ 5 files changed, 44 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index c67cdbc..1c2e9b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,15 +5,26 @@ rust: cache: cargo script: + # build with all features/fft implementations - cargo build --all-targets + - cargo build --all-targets --no-default-features --features "rustfft-complex" - cargo build --all-targets --no-default-features --features "microfft-complex" - cargo build --all-targets --no-default-features --features "microfft-real" -# - cargo build --all-targets --release + + # run tests with all features/fft implementations - cargo test --all-targets -# - cargo test --all-targets --release + - cargo test --all-targets --no-default-features --features "rustfft-complex" + - cargo test --all-targets --no-default-features --features "microfft-complex" + - cargo test --all-targets --no-default-features --features "microfft-real" + + # test `no_std`-build with all features/fft implementations - rustup target add thumbv7em-none-eabihf + - cargo check --target thumbv7em-none-eabihf --no-default-features --features "rustfft-complex" - cargo check --target thumbv7em-none-eabihf --no-default-features --features "microfft-complex" - cargo check --target thumbv7em-none-eabihf --no-default-features --features "microfft-real" - # examples + # run examples with all features/fft implementations - cargo run --release --example mp3-samples + - cargo run --release --example mp3-samples --no-default-features --features "rustfft-complex" + - cargo run --release --example mp3-samples --no-default-features --features "microfft-complex" + - cargo run --release --example mp3-samples --no-default-features --features "microfft-real" diff --git a/CHANGELOG.md b/CHANGELOG.md index cea6c11..6e40806 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,16 @@ # Changelog +## v0.5.1 +- Feature "rustfft-complex" uses "rustfft"-crate at version 6 which is faster/more optimized (~25%). +- improved CI +- README update + ## v0.5.0 This crate now uses `microfft::real` as default FFT implementation. It is by far the fastest implementation -and there are no disadvantages. This crate works now in `no_std`-environments by default. It's also -faster in `std`-environments compared to the previous release due to the `real` FFT. +and there are no disadvantages, despite (with `microfft` version 0.4.0) the maximum FFT size is 4096. If you +need bigger FFT sizes, use feature `rustfft-complex`. + +This crate now works in `no_std`-environments by default. ## v0.4.5 Added MIT to file headers where it was missing. @@ -13,7 +20,7 @@ Fixed wrong usage of `microfft::real` + bumped version of `microfft` to `0.4.0`. **Currently it seems like with this implementation you only can get the frequencies zero to `sampling_rate/4`, i.e. half of Nyquist frequency!** I found out so by plotting the values. Wait until -https://gitlab.com/ra_kete/microfft-rs/-/issues/9 gets resolved (TODO!) +https://gitlab.com/ra_kete/microfft-rs/-/issues/9 gets resolved. ## v0.4.3 README fix. diff --git a/Cargo.toml b/Cargo.toml index ba2994f..23ae9a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ description = """ A simple and fast `no_std` library to get the frequency spectrum of a digital signal (e.g. audio) using FFT. It follows the KISS principle and consists of simple building blocks/optional features. """ -version = "0.5.0" +version = "0.5.1" authors = ["Philipp Schuster "] edition = "2018" keywords = ["fft", "spectrum", "frequencies", "audio", "dsp"] @@ -33,11 +33,11 @@ microfft-complex = ["microfft"] microfft-real = ["microfft"] [dependencies] -rustfft = { version = "5.0.1", optional = true } +rustfft = { version = "6.0.0", optional = true } microfft = { version = "0.4.0", optional = true } -float-cmp = "0.8.0" # approx. compare floats; not only in tests but also during runtime -# sin() cos() log10() etc for no_std-environments; as of Rust 1.51 the default -# functions are only part of the standard lib +# approx. compare floats; not only in tests but also during runtime +float-cmp = "0.8.0" +# sin() cos() log10() etc for no_std-environments; these are not part of Core library libm = "0.2.1" [dev-dependencies] diff --git a/README.md b/README.md index ec3795c..1b4a9eb 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,14 @@ are there mainly for educational reasons and to support me while programming/tes resolver = "2" # by default feature "microfft-real" is used +[dependencies] spectrum-analyzer = "" + +# or if you need another feature (FFT implementation) +[dependencies.spectrum-analyzer] +default-features = false # important! only one feature at a time works! +version = "0.5.0" +features = ["rustfft-complex"] # or on of the other features ``` ### your_binary.rs diff --git a/check-build.sh b/check-build.sh index 70f97a9..768ffb1 100755 --- a/check-build.sh +++ b/check-build.sh @@ -1,14 +1,22 @@ echo "checks that this builds on std+no_std + that all tests run + that all features compile" cargo build --all-targets +cargo build --all-targets --no-default-features --features "rustfft-complex" cargo build --all-targets --no-default-features --features "microfft-complex" cargo build --all-targets --no-default-features --features "microfft-real" cargo test --all-targets +cargo test --all-targets --no-default-features --features "rustfft-complex" +cargo test --all-targets --no-default-features --features "microfft-complex" +cargo test --all-targets --no-default-features --features "microfft-real" # test no_std rustup target add thumbv7em-none-eabihf +cargo check --target thumbv7em-none-eabihf --no-default-features --features "rustfft-complex" cargo check --target thumbv7em-none-eabihf --no-default-features --features "microfft-complex" cargo check --target thumbv7em-none-eabihf --no-default-features --features "microfft-real" # run examples cargo run --release --example mp3-samples +cargo run --release --example mp3-samples --no-default-features --features "rustfft-complex" +cargo run --release --example mp3-samples --no-default-features --features "microfft-complex" +cargo run --release --example mp3-samples --no-default-features --features "microfft-real" From 31dc422fa3ee228b782e9966a10331fc36105f10 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Mon, 19 Apr 2021 13:07:09 +0200 Subject: [PATCH 2/2] CI fix --- .travis.yml | 3 ++- check-build.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1c2e9b4..3a00dcb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,8 @@ script: # test `no_std`-build with all features/fft implementations - rustup target add thumbv7em-none-eabihf - - cargo check --target thumbv7em-none-eabihf --no-default-features --features "rustfft-complex" + # nope, thats BS: this crate needs STD + # - cargo check --target thumbv7em-none-eabihf --no-default-features --features "rustfft-complex" - cargo check --target thumbv7em-none-eabihf --no-default-features --features "microfft-complex" - cargo check --target thumbv7em-none-eabihf --no-default-features --features "microfft-real" diff --git a/check-build.sh b/check-build.sh index 768ffb1..72c3d82 100755 --- a/check-build.sh +++ b/check-build.sh @@ -11,7 +11,8 @@ cargo test --all-targets --no-default-features --features "microfft-real" # test no_std rustup target add thumbv7em-none-eabihf -cargo check --target thumbv7em-none-eabihf --no-default-features --features "rustfft-complex" +# nope, thats BS: this crate needs STD +# cargo check --target thumbv7em-none-eabihf --no-default-features --features "rustfft-complex" cargo check --target thumbv7em-none-eabihf --no-default-features --features "microfft-complex" cargo check --target thumbv7em-none-eabihf --no-default-features --features "microfft-real"