I have a local script under StarterCharacterScripts. The script changes the walking sound playback speed to match the speed the player is walking at. This is the script:
I want the sound of the player walking to stay the same pitch no matter the speed the player is moving at, but I’m not sure how to do that. With a normal sound, you could set the playback speed to 2, add a PitchShiftSoundEffect, set the octave to 0.5, and that would solve the problem, but with this I’m not sure how to do that since it’s dealing with an audio that doesn’t exist before the game starts.
There would also need to be a script that calculates the octave to match the speed the player is going at so it remains the same pitch all the time. In this case it would be to divide 14 by the current speed of the player, and set the octave to that.
Whenever I do footstep sounds, I separate each step into its own sound, and paly them when the walk animation hits a certain keyframe. If you’re not using a custom walking animation, you can just add a delay based on the player’s speed.
It would be much easier if I was able to change the pitch of the sound. It would fit much better, fit in smoother, and would (likely) be less complicated.
I’ve tried that. Changing the pitch causes a lot of distortion, and it wouldn’t sound better than using individual step sounds. If you don’t want to do all of that, you can create a PitchShiftSoundEffect instance and parent it to the sound when playing the footsteps.
The thing is, the sound doesn’t exist in the game, at least from what I can tell. This is the part of the script responsible for playing the walking audio:
If I was able to play a separate sound effect for when the player walks at a different speed, it would likely be a better option, although I’m not sure how I’d do that.
I found the sounds. The sounds are under the HumanoidRootPart.
The pitch change between walking and running isn’t super noticeable. I might just leave it as it is right now since a PitchShiftSoundEffect does distort the audio.