Skip to content

Commit

Permalink
Merge pull request #31 from phip1611/dev
Browse files Browse the repository at this point in the history
bumped rustfft to v6.0.0 + improved CI + improved README (v0.5.1)
  • Loading branch information
phip1611 authored Apr 19, 2021
2 parents 35234d8 + 31dc422 commit 0b0bc7f
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 11 deletions.
18 changes: 15 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,27 @@ 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
# 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"

# 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"
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <phip1611@gmail.com>"]
edition = "2018"
keywords = ["fft", "spectrum", "frequencies", "audio", "dsp"]
Expand Down Expand Up @@ -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]
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<latest>"

# 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
Expand Down
9 changes: 9 additions & 0 deletions check-build.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
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
# 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"

# 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"

0 comments on commit 0b0bc7f

Please sign in to comment.