stft icon indicating copy to clipboard operation
stft copied to clipboard

Update to rustfft 6.0 and Rust 2018 edition

Open sunsided opened this issue 4 years ago • 3 comments

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.

sunsided avatar Oct 13 '21 19:10 sunsided

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 avatar Jun 22 '23 05:06 rohansatapathy

@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.

sunsided avatar Jun 22 '23 07:06 sunsided

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.

sunsided avatar Jun 22 '23 08:06 sunsided