stftpitchshift
STFT based pitch and timbre shifting
What it is and what it does
stftpitchshift is a Python library that shifts the pitch and timbre of audio signals using STFT-based spectral analysis. It implements the instantaneous frequency estimation technique (vocoder) to decompose audio into magnitude and frequency components, then resamples those components according to a pitch shift factor. The library also includes formant preservation via cepstral analysis to reduce the Mickey Mouse effect that occurs when pitch-shifting vocal audio.
The package comes as both a library for embedding in Python projects and a command-line tool for batch processing .wav files. It depends on click for CLI support, numpy for numerical operations, and matplotlib for visualization. The core algorithm is inspired by Stephan M. Bernsee's smbPitchShift and supports mono pitch shifting, polyphonic pitch shifting (multiple simultaneous pitch shifts in a single frame), and optional RMS normalization.
Use it for:
- Shift vocal recordings to different keys without changing playback speed.
- Correct pitch issues in recorded audio or apply creative pitch effects.
- Preserve vocal formants while shifting pitch to avoid unnatural-sounding results.
- Combine multiple pitch shifts simultaneously in a single STFT frame for harmonic synthesis.
- Batch-process .wav files from the command line with configurable window sizes and overlap.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Shifts the pitch and timbre of audio signals using Short-Time Fourier Transform (STFT) analysis, with optional formant preservation to avoid the Mickey Mouse effect.
Yes, if you need STFT-based pitch shifting with formant preservation. The library is stable, permissively licensed, has low install friction, and no known vulnerabilities. The aging maintenance status (last release December 2023) is a minor concern for long-term support but not a blocker for current use. Install if you're building audio processing tools or need precise spectral pitch control.
Install
stftpitchshift on PyPI
pip
pip install stftpitchshiftuv
uv add stftpitchshiftpoetry
poetry add stftpitchshiftInstalling stftpitchshift
Before you install
Low friction install via pip with only three runtime dependencies (click, matplotlib, numpy). Repository is aging but not abandoned—last commit September 2025, 194 stars, no recent releases since December 2023.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.
Quickstart
pip install stftpitchshift
from stftpitchshift import StftPitchShift
pitchshifter = StftPitchShift(1024, 256, 44100)
x = [0] * 44100
y = pitchshifter.shiftpitch(x, 1)
Requires audio data as a list or array-like object; no built-in file I/O in the library itself, though the command-line tool handles .wav files.
Verify before relying
- Real-time performance characteristics and latency for interactive applications.
- Accuracy of formant preservation across different voice types and frequencies.
- Poly pitch shifting quality when combining many simultaneous pitch shifts.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — click, matplotlib, numpy |
| Maintenance | aging — 976 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 80,775/month — #14,273 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: stftpitchshift-2.0-py3-none-any.whl
Keywords: digital, audio, signal, processing, dasp, fft, stft, pitch, shifting, formants, spectrum, cepstrum, algorithms, analysis, synthesis, cpp, python
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
python-stretchPitch-shifts and time-stretches audio using the…
permissive · top 15,000 on PyPI
basic-pitchBasic Pitch converts audio files to MIDI…
unclear · top 15,000 on PyPI
pyrubberbandProvides Python wrappers for time-stretching…
permissive · top 15,000 on PyPI
audiomentationsAudiomentations applies randomized audio…
permissive · top 15,000 on PyPI
soxPython wrapper that exposes SoX audio…
permissive · top 5,000 on PyPI
pyworldPyWorld wraps the WORLD vocoder to decompose…
unclear · top 15,000 on PyPI
torchcrepePyTorch implementation of the CREPE pitch…
permissive · top 15,000 on PyPI
torchfcpeTorchFCPE estimates fundamental frequency…
permissive · top 15,000 on PyPI
vocosVocos is a neural vocoder that synthesizes…
unclear · top 15,000 on PyPI