[SOLVED] Sound Pitch Issue

Hi, I am trying to add a Throttle/Race effect in my game. I want my sound pitch to go from 0 to 1 when player’s car is moving forward and to go from 1 to 0 when it is reversing (Just for sample project, in original game it’s different), but the main requirement is that I want to tweak the value of pitch from 0 to 1 and 1 to 0. But it does not work, the sound just get’s noisy to feels deteriorated. Need help.

How can I change the pitch of a sound? I have also tried to change the pitch of Sound Component but it also does not work.

Editor Link: PlayCanvas | HTML5 Game Engine
Sound Script: PlayCanvas | HTML5 Game Engine
Note: Press “Up Arrow Key” to change pitch from 0 to 1 and “Down Arrow Key” to change the pitch from 1 to 0.


Is this the effect you were looking for? https://playcanvas.com/project/965244/overview/f-throttle-sound

If so, there were two main issues:

  • The slot was set to overlap which meant every time you pressed up, you are were adding a new engine sound on top of the existing one. I’ve set it to first.
  • What you play the sound slot, you set the pitch of the slot to a value. However, when you are changing the pitch via up/down, you are changing the pitch of the sound component, not the slot. AFAIK, the overall pitch is the sound component pitch * the slot pitch. I’ve changed this to only change the slot pitch.

Thank You!