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

Metadata

Release files for fast-short-time-fft 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fast-short-time-fft 0.1.0
File Size Uploaded
fast_short_time_fft-0.1.0.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fast-short-time-fft 0.1.0
File Interpreter ABI Platform
fast_short_time_fft-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / fast_short_time_fft-0.1.0.tar.gz

Download URL fast_short_time_fft-0.1.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
381ec46ce46e5631da958bbaa41b326f70024300441e5ea58cefb5ed614f1789
BLAKE2b-256 checksum
How to use checksums
da83c180a992ed42230435f1d08214abab1a03fd8430232427cf1a83e9ade7f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / fast_short_time_fft-0.1.0-py3-none-any.whl

Download URL fast_short_time_fft-0.1.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d212fcb14a40e002dc8b0305c867d8123b6a0e74fc835e16e114ad5e9e7e957
BLAKE2b-256 checksum
How to use checksums
22e99b46634e48fe1e7ec8da047630ff13f92f2155126e483021711349a36ec7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page