Changing audio speed without using AudioSource.pitch

I’m trying to change the audio speed at runtime without changing pitch.

Here is a project which almost does this:

I’m setting audio time every frame. The problem is there are noticeable audio artefacts when the speed is not 1.0.
Is there a better way to do this?

Cheers,
Nir hermoni

This is a very difficult thing to implement well. There are closed source implementations you can license but they are expensive. You could probably find an open source project that does it with some minor problems, but even then you’ll need to run the audio stream through a native plugin because it’s cpu intensive.

Thanks. Do you have some leads to the closed source solutions?

This is what Max MSP uses. It sounds pretty good.

Paulstretch? Open source and GPLed
http://hypermammut.sourceforge.net/paulstretch/

The GPL is incompatible with anything built in Unity unfortunately.

I have always assumed that if you make the source code open and available to anyone on request then there shouldn’t be any problem mixing GPL stuff with whatever you create in Unity. If someone writes a Unity plugin that interfaces with PaulStretch, why couldn’t they release it as open source? I can’t see how it would be any different, but I’m no expert.

The GPL is what you call a copyleft license. It’s open source and free (as in freedom). The catch is, if you use it in your software and release your software to people, you must do it under the same conditions (e.g. also under the GPL).

In other words, you can’t use a GPL licensed piece of software in a closed source program that you distribute.

The Unity engine is closed source. If you make something in Unity and distribute it, it has closed source pieces even if you make your code open. In that way you can’t include a GPL licensed piece of software in a game you distribute that was made in Unity, because the GPL requires the derivative to be also GPL.

Thanks, you’re absolutely right. If it was LGPL things would be different right?

Yeah, then you could link the binary it into your program. You couldn’t change the source to your own needs though.

Also, I should mention I’m not a lawyer or legal expert. This is a way better source than I for any questions regarding the GPL/LGPL:
https://www.gnu.org/licenses/gpl-faq.en.html

You can do this somewhat by offsetting the pitch with an audiomixer (pitch shifter effect) - although it is far from perfect

Oh dang I didn’t realize they built one into Unity. I’ll have to try it out.