skillfed

python-stretch

Simple python library for pitch shifting and time stretching

python-stretch v0.3.1 183.3K downloads/30d#10,069 on PyPI16
Permissive license Active released

What it is and what it does

python-stretch is a Python wrapper around the Signalsmith Stretch C++ library that provides time stretching and pitch shifting for audio. It accepts audio as 2D arrays (channels × samples) and outputs processed audio in the same format, supporting both mono and multichannel audio with independent control of pitch (via semitone shifts) and playback speed (via time factor).

The package is actively maintained, has prebuilt wheels for Python 3.10–3.12 across macOS, Linux, and Windows, and carries no known security vulnerabilities. It is a thin binding to a mature C++ algorithm library, so installation is straightforward on supported platforms, though building from source requires a C++ compiler and CMake.

Use it for:

  • Transpose audio by semitones while preserving original tempo for music analysis or remixing.
  • Slow down or speed up audio playback without changing pitch for speech processing or practice.
  • Batch process multichannel recordings with consistent pitch and tempo adjustments.
  • Integrate pitch and time stretching into audio processing pipelines.
  • Create pitch-shifted or time-stretched augmentations of audio data for training.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Pitch-shifts and time-stretches audio using the Signalsmith Stretch C++ library, working with mono and multichannel audio data.

Yes. The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and offers a straightforward interface to a proven C++ algorithm. Install friction is moderate but manageable via prebuilt wheels on common platforms. It is a good choice if you need reliable pitch shifting and time stretching.

Install

python-stretch on PyPI

pip

pip install python-stretch

uv

uv add python-stretch

poetry

poetry add python-stretch

Installing python-stretch

Before you install

Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.10–3.12 on macOS, Linux, and Windows, but building from source requires a C++ compiler and CMake.

License in practice

MIT license (permissive); you can use, modify, and distribute this package freely with minimal restrictions.

Quickstart

import python_stretch as ps

# Assume audio is a 2D array (channels × samples)
stretch = ps.Signalsmith.Stretch()
stretch.preset(audio.shape[0], sr)  # numChannels, sampleRate
stretch.setTransposeSemitones(12)   # Shift up one octave
stretch.timeFactor = 0.75           # Slow down to 75% speed
audio_processed = stretch.process(audio)

If building from source, requires a C++ compiler and CMake.

Verify before relying

  • Real-world latency or quality characteristics compared to other pitch-shifting libraries.
  • Whether the package supports streaming or only batch processing of audio.
  • Performance scaling with audio length or channel count.
  • Compatibility with audio libraries beyond those mentioned in the description.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.8)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 546 days since the last release
Last repo commit
First released
Downloads 183,267/month — #10,069 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: python_stretch-0.3.1-cp310-cp310-macosx_10_14_x86_64.whl; python_stretch-0.3.1-cp310-cp310-macosx_11_0_arm64.whl; python_stretch-0.3.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl; python_stretch-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; python_stretch-0.3.1-cp310-cp310-musllinux_1_2_i686.whl; python_stretch-0.3.1-cp310-cp310-musllinux_1_2_x86_64.whl; python_stretch-0.3.1-cp310-cp310-win32.whl; python_stretch-0.3.1-cp310-cp310-win_amd64.whl; python_stretch-0.3.1-cp311-cp311-macosx_10_14_x86_64.whl; python_stretch-0.3.1-cp311-cp311-macosx_11_0_arm64.whl; python_stretch-0.3.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl; python_stretch-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; python_stretch-0.3.1-cp311-cp311-musllinux_1_2_i686.whl; python_stretch-0.3.1-cp311-cp311-musllinux_1_2_x86_64.whl; python_stretch-0.3.1-cp311-cp311-win32.whl; python_stretch-0.3.1-cp311-cp311-win_amd64.whl; python_stretch-0.3.1-cp312-abi3-macosx_10_14_x86_64.whl; python_stretch-0.3.1-cp312-abi3-macosx_11_0_arm64.whl; python_stretch-0.3.1-cp312-abi3-manylinux_2_17_i686.manylinux2014_i686.whl; python_stretch-0.3.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

License :: OSI Approved :: MIT LicenseProgramming Language :: C++Programming Language :: PythonTopic :: Multimedia :: Sound/Audio

Tags

pitch shifting audio pythontime stretching libraryaudio pitch and temposignalsmith stretch wrapperaudio resampling pitch shifttempo change audioaudio processing pitch shift
audio-processingpitch-shiftingtime-stretching

More Sound/Audio packages