- Paulstretch Usage Guide
Paul's Extreme Sound Stretch (Paulstretch) is an algorithm for time-stretching audio files to create ambient sounds by slowing them down dramatically without the typical pitch-shifting effects. This repository contains three Python implementations of the algorithm:
paulstretch_mono.py- Basic implementation for mono audio filespaulstretch_stereo.py- Implementation that processes stereo audio filespaulstretch_newmethod.py- Advanced implementation with onset detection
- Python (2.7 or 3.x)
- NumPy
- SciPy
- (Optional) Matplotlib (only for
paulstretch_newmethod.pywith plot_onsets=True)
Install dependencies:
pip install numpy scipy
# Optional
pip install matplotlib-
Create a virtual environment:
python3 -m venv paulstretch-env
-
Activate the environment:
- On macOS/Linux:
source paulstretch-env/bin/activate - On Windows:
paulstretch-env\Scripts\activate
- On macOS/Linux:
-
Install dependencies from the requirements.txt file:
pip install -r requirements.txt
- Ensure your virtual environment is activated (you'll see
(paulstretch-env)in your terminal prompt) - Run the Paulstretch scripts as described in the sections below
- When you're done, deactivate the virtual environment:
deactivate
This is the simplest implementation that only processes mono audio files with hardcoded parameters.
python paulstretch_mono.pyThis script expects:
- An input file named
input.wavin the same directory - Produces an output file named
out.wav - Uses fixed settings (8x stretch, 0.25s window size)
This implementation handles stereo audio files and provides command-line options.
python paulstretch_stereo.py [options] input_wav output_wav| Option | Long form | Description | Default |
|---|---|---|---|
-s |
--stretch |
Stretch amount (1.0 = no stretch) | 8.0 |
-w |
--window_size |
Window size in seconds | 0.25 |
python paulstretch_stereo.py -s 10.0 -w 0.5 input.wav output.wavThis is an improved implementation that includes onset detection for better quality stretching.
python paulstretch_newmethod.py [options] input_wav output_wav| Option | Long form | Description | Default |
|---|---|---|---|
-s |
--stretch |
Stretch amount (1.0 = no stretch) | 8.0 |
-w |
--window_size |
Window size in seconds | 0.25 |
-t |
--onset |
Onset sensitivity (0.0=max, 1.0=min) | 10.0 |
python paulstretch_newmethod.py -s 20.0 -w 0.3 -t 5.0 input.wav stretched_output.wavControls how much to stretch the sound. For example:
1.0= original length (no stretch)8.0= 8 times longer than the original20.0= 20 times longer than the original
Higher values create more ambient, drawn-out sounds.
Controls the size of the processing window in seconds. This affects the quality and character of the stretched sound:
- Smaller values (e.g.,
0.1) preserve more transients but may introduce artifacts - Larger values (e.g.,
1.0) create smoother sounds but may lose detail - Default
0.25is a good balance for most audio material
Controls how sensitive the algorithm is to detecting onsets (attacks) in the audio:
- Lower values (closer to
0.0) = more sensitive to onsets - Higher values (closer to
1.0) = less sensitive to onsets - Default is
10.0(low sensitivity)
- Use high-quality WAV files as input
- For extremely long stretches (>50x), use larger window sizes
- Experiment with different window sizes to find the best sound quality
- The newmethod implementation often produces better results for complex audio
These files are released under Public Domain by Nasca Octavian PAUL.
- Author's website: http://www.paulnasca.com/
- Original project: http://hypermammut.sourceforge.net/paulstretch/