skillfed

stftpitchshift

STFT based pitch and timbre shifting

stftpitchshift v2.0 80.8K downloads/30d#14,273 on PyPI194
Permissive license MIT AGING released

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 stftpitchshift

uv

uv add stftpitchshift

poetry

poetry add stftpitchshift

Installing 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

Intended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Other AudienceIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseProgramming Language :: C++Programming Language :: Python :: 3Topic :: Artistic SoftwareTopic :: EducationTopic :: Multimedia :: Sound/AudioTopic :: Multimedia :: Sound/Audio :: AnalysisTopic :: Multimedia :: Sound/Audio :: Sound SynthesisTopic :: Scientific/EngineeringTopic :: Software Development :: Libraries

Tags

pitch shifting audiostft pitch shiftaudio timbre shiftingformant preservationreal-time pitch shiftingspectral audio processingpolyphonic pitch shift
audio-processingdspspectral-analysis

More Libraries packages