SBSMS and PCM sound tempo / pitch changing

Hello!

I have my own fork of SDL Mixer library I have extended with additional functionality like more convenient functions, ability to control MIDI playback, ability to get seek position, full song length, loop points if they are available, more codecs like GME and extra MIDI synths, etc.

One of the features I working is the ability to change the tempo of the music. It’s already made for MIDI, GME, and tracker music (with using of libXMP). However, I looking for a solution to change the tempo of PCM-based streams without affecting the pitch. I have found the SBSMS library used by Audacity and some internal code that is also used to do this.

Is this good for real-time playback? Does this require a bigger chunk buffer size for good sound quality or it would work with lower latency streaming? Is here some similar solution with C-API? (otherwise, I’ll implement a C binding layer by myself)
Or there are some simpler algorithms to process this and they are can work in real-time without dangerous to get a choppy playback?

SBSMS is quite slow, so unless you are designing specifically for powerful hardware, it’s not well suited for real time playback.

The “SoundTouch” library is probably a better option for real-time: https://www.surina.net/soundtouch/
Audacity’s implementation of SoundTouch is probably not a good example to follow, as Audacity implements only as much as is required for a simple, non-real-time effect. Refer to the official SoundTouch documentation instead.

Okay, about SBSMS that was expected, and thanks for an explanation.
However, I have tested SoundTouch on my end locally, and this looks good, doesn’t break quality a lot even I slightly hear some minor distortions are dependent on scaling percent, and I see it has converted a long WAV file I had almost immediately on my machine!

Yeah, I’m designing the thing to work on any machines, include slow things like very old computers or mobile and embedded devices, so, this is a good thing. :fox_face:

So, will try to implement this thing into my library soon…