Trying to increase playback speed of walking sound without increasing pitch

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:

Char = script.Parent
Hum = Char:WaitForChild("Humanoid")
HRP = Char:WaitForChild("HumanoidRootPart")

Hum.Running:connect(function(speed)
	HRP.Running.PlaybackSpeed = speed / 14
end)

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.

1 Like

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.

1 Like

The sound effect is multiple footsteps. Even if I were to just play the beginning of the audio file with each step, it would be too repetitive.

You can download the audio and isolate each footstep into their own sound file using something like Audacity, or you could use PlaybackRegions.

1 Like

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.

1 Like

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:

	Running = {
		SoundId = "rbxassetid://4416041299",
		Looped = true,
		Volume = 1,
		Pitch = 1,
	},

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.

Check the code for any references to a sound instance. To my knowledge, a sound cannot be played without an instance.

1 Like

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.

1 Like