tracktion_engine icon indicating copy to clipboard operation
tracktion_engine copied to clipboard

[Bug]: DemoRunner Pitch Shift and Timing chipmunk effect

Open jerryseigle opened this issue 11 months ago • 2 comments

Detailed steps on how to reproduce the bug

On macOS I was testing the DemoRunner Pitch Shift and Timing demo. I loaded an audio clip that had vocals and music. When Adjusting the pitch I notice that vocals sound like chipmunks. I selected both algorithms but both had the same effect. I did not adjust the pitch by much. Also I noticed that with the timing when I adjusted the slider it will pause the audio clip for a brief moment and start back playing. Is there a way to speed up audio without the momentarily Pause? Also I noticed that while I did adjust the speed/tempo slider the tempo did not speed up or slow down.

reproduce: run the DemoRunner and select Load Demo, select Pitch and Time. load a audio file and try to adjust the sliders

What is the expected behaviour?

I was expecting to slide the pitch slider and the pitch adjust higher or lower without chipmunk effect. I was expecting to slide the time(tempo.speed) slider and the audio speed up or slow down. Also was expecting it to do this without the audio stopping when making timing adjustment

Unit test to reproduce the error?

I am using the code from the example for pitch and time in the DemoRunner

Operating systems

macOS

What versions of the operating systems?

I am on the latest version of macOS 2025

Architectures

ARM

Stacktrace


Plug-in formats (if applicable)

No response

Plug-in host applications (DAWs) (if applicable)

No response

Testing on the develop branch

The bug is present on the develop branch

Code of Conduct

  • [x] I agree to follow the Code of Conduct

jerryseigle avatar Mar 04 '25 00:03 jerryseigle

Have you set the "root tempo" for the file that you've loaded? This needs to be set in order to sync the clip to the Edit's tempo sequence (which is what this demo is showing).

As for the "chipmunk" sound, how much have you changed the tempo? This uses the SoundTouch time stretching engine so could just be an artefact of this. We also support RubberBand and Elastique but these require their own licenses.

drowaudio avatar Mar 05 '25 11:03 drowaudio

You can use the setUsesProxy (false) mode to render the time-stretching in real-time. Enable it like this in the demo code:

        if (auto clip = EngineHelpers::loadAudioFileAsClip (edit, f))
        {
            // Disable auto tempo and pitch, we'll handle these manually
            clip->setAutoTempo (false);
            clip->setAutoPitch (false);
            clip->setUsesProxy (false); //<--- ADD THIS LINE
            clip->setTimeStretchMode (te::TimeStretcher::defaultMode);

drowaudio avatar Mar 05 '25 12:03 drowaudio