Skip to main content

fast-short-time-fft

Fast Short-Time FFT — 7× faster than scipy.signal.ShortTimeFFT, bit-identical.

Vectorized, CPU-only (pocketfft, no GPU). One batched rfft per signal vs per-slice Python loop.

from fast_short_time_fft import FastShortTimeFFT
import numpy as np

SFT = FastShortTimeFFT(win=np.hanning(256), hop=64, fs=8000)  # same API as scipy
Sx = SFT.stft(x)  # (129, p_num) — exact as scipy, 7× faster
# or
from fast_short_time_fft import stft
Sx = stft(x, win=np.hanning(256), hop=64, fs=8000)

For 1k wavs (8kHz, avg 2s, 250k frames): 0.66s vs scipy 3.3s (median, incl. I/O).

Repo: https://github.com/yonikremer/fast-short-time-fft

Install

pip install fast-short-time-fft

CLI

fast-stft sounds/*.wav --hop 64 --mfft 256 --workers 6

Why faster

Scipy loops for p in 250k: rfft(x_*win) in Python (10µs overhead per 256-pt FFT). This batches all p_num frames per file: pad → as_strided view → frames*win → rfft(workers=6).T — 1k Python calls vs 250k, one AVX *win, one batched C FFT with 6 threads. Same pad/win/rfft math → max err 0.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast_short_time_fft-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fast_short_time_fft-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file fast_short_time_fft-0.1.0.tar.gz.

File metadata

  • Download URL: fast_short_time_fft-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.0

File hashes

Hashes for fast_short_time_fft-0.1.0.tar.gz
Algorithm Hash digest
SHA256 381ec46ce46e5631da958bbaa41b326f70024300441e5ea58cefb5ed614f1789
MD5 faef0b9064b2ce331465f6d502c72b9f
BLAKE2b-256 da83c180a992ed42230435f1d08214abab1a03fd8430232427cf1a83e9ade7f0

See more details on using hashes here.

File details

Details for the file fast_short_time_fft-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fast_short_time_fft-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d212fcb14a40e002dc8b0305c867d8123b6a0e74fc835e16e114ad5e9e7e957
MD5 9b5bd7c1f8b865486188adebbe990a43
BLAKE2b-256 22e99b46634e48fe1e7ec8da047630ff13f92f2155126e483021711349a36ec7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page