spotify / pedalboard

🎛 🔊 A Python library for audio.
https://spotify.github.io/pedalboard
GNU General Public License v3.0
5.15k stars 260 forks source link

Upgrade to RubberBand v3.3.0 and expose extra options in `time_stretch`. #251

Closed psobot closed 1 year ago

psobot commented 1 year ago

This PR upgrades Pedalboard to use RubberBand v3.3.0 (still GPL licensed) and exposes a large number of additional RubberBandStretcher::Options as Python function arguments:

  • high_quality (the default) enables a higher quality time stretching mode. Set this option to False to use less CPU power.
    • transient_mode controls the behavior of the stretcher around transients (percussive parts of the audio). Valid options are "crisp" (the default), "mixed", or "smooth".
    • transient_detector controls which method is used to detect transients in the audio signal. Valid options are "compound" (the default), "percussive", or "soft".
    • retain_phase_continuity ensures that the phases of adjacent frequency bins in the audio stream are kept as similar as possible. Set this to False for a softer, phasier sound.
    • use_long_fft_window controls the size of the fast-Fourier transform window used during stretching. The default (None) will result in a window size that varies based on other parameters and should produce better results in most situations. Set this option to True to result in a smoother sound (at the expense of clarity and timing), or False to result in a crisper sound.
    • use_time_domain_smoothing can be enabled to produce a softer sound with audible artifacts around sharp transients. This option mixes well with use_long_fft_window=False.
    • preserve_formants allows shifting the pitch of notes without substantially affecting the pitch profile (formants) of a voice or instrument.