how do i change the pitch of a roblox audio so the pitch stays the same but the audio is sped up?

83 Views Asked by At

i'm trying to change the walking sound of the game using a script (i do have a PitchShiftSoundEffect in the audio), but when i speed it up cause the character is sprinting and i made it decrease the pitch of the audio the pitch is still high

my code:

runtime.Heartbeat:connect(function()
    if walking then
        local material = getMaterial()
        if material ~= lastmat and lastmat ~= nil then
            materials[lastmat].Playing = false
        end
        local materialSound = materials[material]
        game.StarterPack["Put in Starterpack"].FootstepSounds.Snow.PitchShiftSoundEffect.Octave = 1
        if hum.WalkSpeed == 16 then
            materialSound.PlaybackSpeed = 1.3333333333
            game.StarterPack["Put in Starterpack"].FootstepSounds.Snow.PitchShiftSoundEffect.Enabled = false
        else
            materialSound.PlaybackSpeed = 2.6666666666
            game.StarterPack["Put in Starterpack"].FootstepSounds.Snow.PitchShiftSoundEffect.Enabled = true
            game.StarterPack["Put in Starterpack"].FootstepSounds.Snow.PitchShiftSoundEffect.Octave = 0.5
        end
        materialSound.Playing = true
        lastmat = material
    else
        for _,sound in pairs(materials:GetChildren()) do
            sound.Playing = false
        end
    end
end)

i want it to sound like it's at a normal speed but be shorter

i tried changing the octave of the PitchShiftSoundEffect using a script to the perfect amount, but it still sounded sped up

i needed it to sound like normal pitch but the audio is shorter

0

There are 0 best solutions below