Free, Open-Source Audio Time-Stretching and Pitch-Shifting

Patrick Vlaskovits

Superpowered Time-Stretching and Pitch Shifting

Audio time-stretching is one of the most complex audio processing tasks, and as such, is incredibly hard to create from scratch. It’s not something one developer can quickly code, which is why they will search the internet for free, open source audio time-stretching and pitch-shifting solutions first.

The two most promising and often cited findings are Rubber Band and SoundTouch. Let's take a look at their pros and cons, and then compare Superpowered’s Time Stretching and Pitch-Shifting to those.

Rubber Band Library

This is a big library with lots and lots of code inside. The audio quality is great, as the author did a solid job researching audio algorithms. It handles audio transients well (not losing them) and does a great job in preserving audio quality (reducing so-called “phasiness”).

But the digital signal processing work is not stellar, Rubber Band’s CPU load is so high that you cannot run it on a mobile device for real-time processing, even if you try to utilize every DSP hack and trick you might know.

You can learn more here.

SoundTouch Audio Processing

A nice, compact library with an acceptable CPU load, it can work real-time on a mobile device. But SoundTouch’s time-stretching works in the time domain.

There are basically two kinds of time-stretching methods: time-domain and frequency domain. The aforementioned Rubber Band (and all quality commercial audio libraries) work in the frequency domain for highest audio quality.

Time-domain stretching works with overlapping windows, providing absolutely no “phasiness” with the cost of missing or doubling some parts of the audio, which sounds strange. And, even if you handle transients somehow, the overall result sounds too “compressed”.

SoundTouch does not handle transients, so it doesn’t work for most modern music, unfortunately. A prominent unwanted audio artifact is oddness with drum kicks. It either misses them completely or doubles them.

You can learn more here.

The Reality of Free, Open-Source Audio Time-Stretching and Pitch-Shifting

“Free” time-stretching and pitch-shifting solutions cannot be used for commercial mobile projects, typicall because of audio quality or CPU problems (or both!). Solving either of those is so complex that only commercial solutions should be relied on -- that said, many commercial solutions still don’t run well on mobile devices!

Allow us to suggest: Superpowered Real-Time Time Stretching and Pitch-Shifting

It has outstanding audio quality (you can test it) and has the highest performance on mobile devices.

Last thing, check out C++ Audio Library List (2018) here.

  • Audio Codecs
  • Audio Library
  • Audio Transient
  • Pitch Shift
  • Soundtouch