Matching the audio pitch to the animation speed
Many artifacts sound higher in pitch when accelerated and lower when slowed down. Car engines, fan coolers, a record player... the list goes on. If you want to simulate this kind of sound effect in an animated object that can have its speed changed dynamically, follow this recipe.
Getting ready
For this recipe, you'll need an animated 3D object and an audio clip. Please use the animatedRocket.fbx
and engineSound.wav
files, available in the 04_08
folder.
How to do it...
To change the pitch of an audio clip according to the speed of an animated object, please follow these steps:
- Create a new Unity 3D project.
- Create a new
Models
folder in theProject
panel, and into this import the providedanimatedRocket.fbx
file. - Create a new Sounds folder in the
Project
panel, and into this Import the provided audio clip,engineSound.wav
. - Select the
animatedRocket
file in the Project panel. In the Inspector foranimatedRocket
Import Settings, click theAnimations
button...