stft
stft copied to clipboard
Update to rustfft 6.0 and Rust 2018 edition
Heya! When I tried to use stft from crates.io it failed with an error related to nalgebra-0.5. I poked around in the forks and found YoshieraHuang/stft which adds some modernizations on which this PR is based:
- Zero-padding FFT through
STFT::new_with_zero_padding()(via https://github.com/YoshieraHuang/stft/commit/3695eb86ebd7e7c7cd5949faf939c52d25fbd7d7) - More importantly, an update of the test/bench suite to Criterion (via https://github.com/YoshieraHuang/stft/commit/bad50ff5e200aab957ea1ddfa11f9e2ced41bff4).
The latter commit allows cargo bench and cargo criterion to be run with stable Rust.
From there, I updated the Cargo.toml to use edition = "2018" and updated the dependencies to rustfft = "6.0", num = "0.4" and apodize = "1.0". I made sure to sanitize the code using rustfmt and Clippy.
The newer rustfft version appears to do FFT in-place now, but has support for an externally allocated scratch buffer. I added this to the STFT struct - the benchmarks indicate a slight performance increase with that change.
The existing integration tests were lacking an assertion to actually ensure the correct results are calculated. I added a dev dependency on approx = "0.5" to do perform said comparisons; the calculations are now also performed twice to ensure that a call to compute_column() does not
corrupt the internal state.
It seems like the author has abandoned this project, @sunsided would you be able to release your version under a new name on crates.io to ensure that it has a working build? Maybe it could be called ruststft to match the naming convention of rustfft.
@rohansatapathy Will do. I've reached out to @snd by mail first to see if he can add me as a maintainer, too. In that case we don't require the parallel crates.
Okay, I published it as ruststft version 0.3.0. If @snd gets back to me regarding maintainership on crates.io and/or merges the changes himself, I'll see to yank my version to not create confusion.