C++ – Changing tempo (speed) of audio


I want to change the tempo of a stereo audio stream in near realtime – the audio is loaded from a file and the buffer should not be longer than 1 second.
I tried SoundTouch (http://www.surina.net/soundtouch/) but the quality when decreasing the tempo is very bad. Now I am looking for alternative means to time-stretch the audio signal. One method implemented in Audacity which produces very good results is based on "Subband Sinusoidal Modeling" but it is very slow.

Then there is the Rubber Band Audio processor library (http://breakfastquay.com/rubberband) and Dirac (http://www.dspdimension.com/technology-licensing/dirac/) which are both commercial / GPL and are not fully cross-platform compatible.

Can you recommend me algorithms and/or libraries which match the following criteria?:

  • Cross platform compatible (e.g. iOS, Android, Windows, Linux, MacOS)
  • Suitable for real-time processing as stated above
  • Better quality than the time-stretching method used in the SoundTouch library
  • Tempo change without affecting the pitch

Best Solution

Take a look at BASS Audio Library http://www.un4seen.com/bass.html and its companion BASS FX Extension

BASS is an audio library for use in software on several platforms. Its purpose is to provide developers with powerful and efficient sample, stream (MP3, MP2, MP1, OGG, WAV, AIFF, custom generated, and more via OS codecs and add-ons), MOD music (XM, IT, S3M, MOD, MTM, UMX), MO3 music (MP3/OGG compressed MODs), and recording functions. All in a compact DLL that won't bloat your distribution.

BASS is available for Win32, Win64, MacOS, Linux, WinCE, iOS, Android, and ARM Linux platforms.

BASS FX plugin extension provides several effects, including reverse playback and tempo & pitch control.

Related Question