Registry / ai-ml / stftpitchshift

stftpitchshift

JSON →
library2.0pypypi✓ verified 79d ago

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.

pip install stftpitchshift
INSTALL
IMPORT
SIG · STFTPITCHSHIFT
S
stftpitchshift
ai-mlpythonv2.0
Install
7.8s avg
Import
Disk
181MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 178.5MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 7.8s · import 0.000s · 171MB
181MB installed
● package 181MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

StftPitchShift
from stftpitchshift import StftPitchShift
from stftpitchshift import PitchShift

Load an audio file, apply pitch shifting, and save the result.

import numpy as np from stftpitchshift import PitchShift, load, save # Load audio (mono, float32) audio, samplerate = load('input.wav') # Create pitch shifter with default settings shifter = PitchShift() # Shift pitch by 2 semitones (factor = 2^(2/12) ≈ 1.1225) shifted = shifter.shiftpitch(audio, samplerate, 1.1225) # Save result save('output.wav', samplerate, shifted.astype(np.float32))
Debug
Known issues
breakingIn v2.0, the API changed: `PitchShift.shiftpitch` replaces the old `stft` method. The timbre shifting is now a separate `TimbreShift` class.
fix
Update code to use `PitchShift().shiftpitch(audio, samplerate, factor)` instead of `stft(...)`.
affects: >=2.0
breakingIn 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.
fix
Use `TimbreShift().shifttimbre(audio, samplerate, factor)` for timbre shifting.
affects: >=2.0
gotchaThe input audio must be monaural (single channel) and of type `numpy.float32`. Multi-channel or different dtypes may cause errors.
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)`.
affects: all
deprecatedThe previous `stft` function and the old import path `from stftpitchshift import stft` are removed in v2.0.
fix
Use the new `PitchShift` and `TimbreShift` classes.
affects: >=2.0
Upgrade
Version history
2.0latest on PyPI · released Dec 12, 2023
Audit
Dependencies
numpyrequiredUsed for array operations in Python implementation
scipyoptionalOptional, provides additional FFT backends
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
stftpitchshift — pip install stftpitchshift · libregistry