Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up time stretching ~3x on Linux with FFTW3. #349

Merged
merged 32 commits into from
Jul 2, 2024
Merged

Conversation

psobot
Copy link
Member

@psobot psobot commented Jun 30, 2024

From: https://github.com/breakfastquay/rubberband/blob/default/COMPILING.md#7-fft-and-resampler-selection

Using the following test script:

import time

import numpy as np

from pedalboard import time_stretch

sr = 44100
duration = 60
x = np.random.rand(2, sr * duration).astype(np.float32)
for high_quality in (True, False):
    start = time.time()
    time_stretch(x, sr, 1.5, high_quality=high_quality)
    end = time.time()
    print(f"[{high_quality=}] Time Stretch speed: {duration / (end - start) :.2f}x")

...and on a Google Cloud c4-standard-8:

# Prior to this change (Pedalboard v0.9.8):
[high_quality=True] Time Stretch speed: 3.70x
[high_quality=False] Time Stretch speed: 12.05x

# With this change:
[high_quality=True] Time Stretch speed: 16.11x
[high_quality=False] Time Stretch speed: 34.65x

@psobot psobot added the enhancement New feature or request label Jun 30, 2024
@psobot psobot changed the title Speed up time stretching by linking against third-party FFT and resampler libraries. Speed up time stretching ~3x on Linux and Windows with FFTW3. Jul 2, 2024
@psobot psobot marked this pull request as ready for review July 2, 2024 05:58
@psobot psobot changed the title Speed up time stretching ~3x on Linux and Windows with FFTW3. Speed up time stretching ~3x on Linux with FFTW3. Jul 2, 2024
@psobot psobot merged commit 60404dd into master Jul 2, 2024
32 checks passed
@psobot psobot deleted the psobot/fftw3 branch July 2, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant