Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Audio Stretching An Audioclip Without Changing It's Pitch (sync To Humanoid Animation)?

Discussion in 'Audio & Video' started by CloudyVR, Apr 10, 2019.

  1. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    709
    I have several humanoid animation that I would like to sync audioclips to, but the animation lengths can differ slightly in length compared to the audioclip (and I have very little ability to alter the animation controller or any keyframe data).

    I am however able to calculate a multiplier that compensates for the difference, when I apply it to the pitch of the audioSource I can sometimes hear the that pitch is too far in one direction (Slightly too high/low pitch).

    Is it possible (in Unity) to change the speed of an audioclip but not affect the pitch of the clip?

    I have some experience working with raw (unmodified) wav data, but I have no idea how to "stretch" the audio data to a desired time duration.

    Any ideas on how to do this would be extremely useful!
     
  2. RickshawDerpyDerp

    RickshawDerpyDerp

    Joined:
    Nov 6, 2018
    Posts:
    23
    I also need this capability. I have a slide-whistle sound that needs to play while a character falls, which can vary in time.
     
  3. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    709
    I ended up not needing this feature for my project. However I did learn a bit about TDPSOLA algorithm which was what I was looking for. One very valuable resource I found during my research was a website that showed how to create a Audacity project then manually process the audio data (splice and overlap) exactly as the TDPSOLA algorithm - and is very easy to follow:

    http://www.speech.zone/td-psola-the-hard-way/