-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from phip1611/dev
merge dev for v0.4.0 release
- Loading branch information
Showing
19 changed files
with
820 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
language: rust | ||
rust: | ||
- stable | ||
- nightly | ||
cache: cargo | ||
|
||
script: | ||
- cargo build --all-targets | ||
# - cargo build --all-targets --release | ||
- cargo test --all-targets | ||
# - cargo test --all-targets --release | ||
- rustup target add thumbv7em-none-eabihf | ||
- 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 | ||
- cargo run --release --example mp3-samples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,25 +4,44 @@ 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.3.0" | ||
version = "0.4.0" | ||
authors = ["Philipp Schuster <[email protected]>"] | ||
edition = "2018" | ||
keywords = ["fft", "spectrum", "frequencies", "audio", "dsp"] | ||
categories = ["multimedia", "no-std"] | ||
readme = "README.md" | ||
license = "MIT" | ||
|
||
homepage = "https://github.com/phip1611/spectrum-analyzer" | ||
repository = "https://github.com/phip1611/spectrum-analyzer" | ||
documentation = "https://docs.rs/spectrum-analyzer" | ||
|
||
# fixes build problems of wrong feature resolution in microfft crate, see | ||
# https://gitlab.com/ra_kete/microfft-rs/-/merge_requests/11 | ||
resolver = "2" | ||
|
||
# room for mutliple fft implementations in the future, for example "rustfft" that needs STD | ||
[features] | ||
default = ["rustfft-complex"] | ||
# best option for STD environments, most accurate and performant + more than 4096 samples! | ||
rustfft-complex = ["rustfft"] | ||
# a bit slower but more accurate: uses regular FFT with complex numbers | ||
microfft-complex = ["microfft"] | ||
# faster but less accurate: uses an FFT algorithm that only works on real numbers | ||
microfft-real = ["microfft"] | ||
|
||
[dependencies] | ||
rustfft = "5.0.1" | ||
float-cmp = "0.8.0" # approx. compare floats | ||
rustfft = { version = "5.0.1", optional = true } | ||
microfft = { version = "0.3.1", optional = true } | ||
# override num-complex dependency of microfft; otherwise build problems :( | ||
num-complex = { version = "0.3", default-features = false } | ||
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 | ||
libm = "0.2.1" | ||
|
||
[dev-dependencies] | ||
minimp3 = "0.5.1" | ||
audio-visualizer = "0.2.1" | ||
audio-visualizer = "0.2.2" | ||
|
||
# otherwise FFT and other code is too slow | ||
[profile.dev] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## How to use FFT to get a frequency spectrum? | ||
|
||
This library is full of additional and useful links and comments about how an FFT result | ||
can be used to get a frequency spectrum. In this document I want to give a short introduction | ||
where inside the code you can find specific things. | ||
|
||
**TL;DR:** Although this crate has 1400 lines of code, **the part which gets the frequency and | ||
their values from the FFT is small and simple**. Most of the code is related to my convenient | ||
abstraction over the FFT result including several getters, transform/scaling functions, and | ||
tests. | ||
|
||
**I don't explain how FFT works but how you use the result!** | ||
If you want to understand that too: | ||
|
||
- check out all links provided [at the end of README.md](/README.md) | ||
- look into `lib.rs` (**probalby gives you 90 percent of the things you want to know**) | ||
and the comments over the FFT abstraction in `src/fft/mod.rs` and | ||
`src/fft/rustfft-complex/mod.rs`. | ||
|
||
|
||
This is everything important you need. Everything inside | ||
`spectrum.rs` and the other files is just convenient stuff + tests for when you | ||
want to use this crate in your program. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
echo "checks that this builds on std+no_std + that all tests run" | ||
cargo build --all-targets | ||
# cargo build --all-targets --release | ||
cargo test --all-targets | ||
# cargo test --all-targets --release | ||
rustup target add thumbv7em-none-eabihf | ||
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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.