How to Sync Vehicles sounds to Speed?

Hey, pretty much the title.
I believe it has something to do with pitch, however I’m unsure on it.
Looking for a way to set this up if anyone has any suggestions,
Thanks in advanced!

I’ve done it before. You basically make a formula that converts the vehicle speed to Pitch. It takes a few test runs to get it just right.
I’m not at home at the moment but when I get there I’ll dig up a script I use in my vehicles for you if noone else comes up with a solution in the next 6 hours.
It also has a check to see if the pitch is below a certain limit and keeps it at a minimum for stuff like when the vehicle is idling but not moving.

This is very broad:

if your changing the pitch based off the velocity of the car you can just do Sound.PlaybackSpeed = Part.Velocity.Magnitude / 50

if you want other systems like Car revs thats a whole other story.

1 Like

Play with the +1 to change the playback speed to your liking.

Also, obviously change the Sound to your sound name and make sure its defined in the right location, or put it in DriverSeat.

local maxSpeed = 25

script.Parent.DriverSeat.Sound:Play()
game:GetService("RunService").Heartbeat:Connect(function()
		local velocity = script.Parent.DriverSeat.AssemblyLinearVelocity.Magnitude
		script.Parent.DriverSeat.Sound.PlaybackSpeed = (velocity / maxSpeed) + 1
2 Likes

Syncing sound to velocity is one way to do it. You might run into weird sounds if your vehicles ever fall from a height. (the pitch will get very high and squeaky)

A better way might be to tie the pitch to the thrust or wheel angular rotation speed depending on how you power your vehicle.

2 Likes

Here’s what I’ve used:

--put a server script into your vehicleseat with this in it
--put the sound you want into the vehicleseat as well

vehicleSeat = script.Parent   
sound = script.Parent["whatever you have as the sound's name in the vehicleseat"*
maxpitch = 2.8 -- the sound's maximum pitch, change it to whatever sounds best as your full speed pitch.
idlespeed = .3 -- the pitch of the sound when the car is at a standstill, again, adjust as necessary.
 
vehicleSeat.Changed:Connect(function(prop)
	if prop == "Occupant" then
		local humanoid = vehicleSeat.Occupant
		if vehicleSeat.Occupant then
			sound:Play()
			while vehicleSeat.Occupant do
				local speed = (script.Parent.Velocity.Magnitude / 60) + idlespeed  --depending on your sound you may have to change the "/ 60" to another value
				if speed < maxpitch then
					sound.PlaybackSpeed = speed
				else
					sound.PlaybackSpeed = maxpitch
				end
				wait(.03) --I just wait a little bit so the script isn't changing instantly
			end
		else
			sound:Stop()
		end
	end	
end)
2 Likes

you could just limit the pitch of the sound.

if velocity < MaxSpeed then
Sound.PlaybackSpeed = velocity
else
Sound.PlaybackSpeed = MaxSpeed
end

Hey.
Luckily the sound isn’t exactly for a car, so I won’t need to be worrying about revs lol

2 Likes