{"id":24658,"library":"stftpitchshift","title":"stftpitchshift","description":"STFT-based pitch and timbre shifting library for audio processing, supporting real-time and file-based transformations. Version 2.0 includes major API changes, improved latency, and WebAssembly support. Released under the MIT license.","status":"active","version":"2.0","language":"python","source_language":"en","source_url":"https://github.com/jurihock/stftPitchShift","tags":["audio","pitch-shift","timbre-shift","stft","dsp"],"install":[{"cmd":"pip install stftpitchshift","lang":"bash","label":"Install from PyPI"},{"cmd":"pip install stftpitchshift[fft]","lang":"bash","label":"Install with custom FFT backend support"}],"dependencies":[{"reason":"Used for array operations in Python implementation","package":"numpy","optional":false},{"reason":"Optional, provides additional FFT backends","package":"scipy","optional":true}],"imports":[{"wrong":"from stftpitchshift import PitchShift","symbol":"StftPitchShift","correct":"from stftpitchshift import StftPitchShift"}],"quickstart":{"code":"import numpy as np\nfrom stftpitchshift import PitchShift, load, save\n\n# Load audio (mono, float32)\naudio, samplerate = load('input.wav')\n\n# Create pitch shifter with default settings\nshifter = PitchShift()\n\n# Shift pitch by 2 semitones (factor = 2^(2/12) ≈ 1.1225)\nshifted = shifter.shiftpitch(audio, samplerate, 1.1225)\n\n# Save result\nsave('output.wav', samplerate, shifted.astype(np.float32))","lang":"python","description":"Load an audio file, apply pitch shifting, and save the result."},"warnings":[{"fix":"Update code to use `PitchShift().shiftpitch(audio, samplerate, factor)` instead of `stft(...)`.","message":"In v2.0, the API changed: `PitchShift.shiftpitch` replaces the old `stft` method. The timbre shifting is now a separate `TimbreShift` class.","severity":"breaking","affected_versions":">=2.0"},{"fix":"Use `TimbreShift().shifttimbre(audio, samplerate, factor)` for timbre shifting.","message":"In v2.0, the `TimbreShift` class requires explicitly enabling timbre shifting via `shiftpitch` or separate `TimbreShift.shifttimbre`. The old `PitchShift` constructor parameter `timbre` no longer exists.","severity":"breaking","affected_versions":">=2.0"},{"fix":"Convert audio to mono and float32 before processing: `audio = audio.mean(axis=1) if audio.ndim > 1 else audio; audio = audio.astype(np.float32)`.","message":"The input audio must be monaural (single channel) and of type `numpy.float32`. Multi-channel or different dtypes may cause errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the new `PitchShift` and `TimbreShift` classes.","message":"The previous `stft` function and the old import path `from stftpitchshift import stft` are removed in v2.0.","severity":"deprecated","affected_versions":">=2.0"}],"env_vars":null,"search_vec":"'2.0':23 'api':26 'audio':11,38 'base':4,20 'chang':27 'dsp':46 'file':19 'file-bas':18 'improv':28 'includ':24 'latenc':29 'librari':9 'licens':37 'major':25 'mit':36 'pitch':5,40 'pitch-shift':39 'process':12 'real':15 'real-tim':14 'releas':33 'shift':8,41,44 'stft':3,45 'stft-base':2 'stftpitchshift':1 'support':13,32 'timbr':7,43 'timbre-shift':42 'time':16 'transform':21 'version':22 'webassembl':31","created_at":"2026-05-01T08:14:15.348056+00:00","updated_at":"2026-05-01T08:14:15.348056+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/jurihock/stftPitchShift","docs":null,"changelog":null,"pypi":"https://pypi.org/project/stftpitchshift/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}