How do I make a very realistic sound Train Traction Motor (IGBT/GTO-VVVF)

I have been working on a train simulator since 2021 (I still haven’t finished yet) and I want to make a realistic train propulsion or AC traction motor but I can’t seem to do it.
I don’t know how people nail it so perfectly, but I can’t do anything. I tried using TimePosition but it just sounds glitchy and choppy.

while true do
wait(0.05)
if script.Parent.AssemblyLinearVelocity.Magnitude > 0.1 then
if script.Parent.Engine.IsPlaying == false then
    script.Parent.Engine:Play()
end
script.Parent.Engine.TimePosition = script.Parent.Velocity.Magnitude/2.3
else
script.Parent.Engine:Stop()
end
end

I also tried to make it to where as the sound TimePosition increases, the train speeds up and it worked, but I can’t make the train slow down and again, if I use a script to increase or decrease the TimePosition of a sound, it’ll just sound glitchy.

I recommend having a seperate sound for every phase of the VVVF. This method is really tedious, But the end product is much better. To make the sound itself, You will need a good train accelerating / deaccelerating audio, a DAW (something like audacity). There is a great guide on how to make a motor sound at BVE Workshop (It is in japanese but you should be fine by utilizing automatic website google translation.) After your audio is done, You need to script it for the motor sounds to play and change pitches.

RunService.Heartbeat:Connect(function()

	local speed = script.Parent.AssemblyLinearVelocity.Magnitude

    Motor1.PlaybackSpeed = speed/2.5
    Motor2.PlaybackSpeed = speed/15
    Motor3.PlaybackSpeed = speed/30

	if speed < 5 then
		Motor1.Volume = 1
        Motor2.Volume = 0 
        Motor3.Volume = 0
	end

	if speed > 5 and speed > 20 then
		Motor1.Volume = 0
		Motor2.Volume = 1
		Motor3.Volume = 0
	end

	if speed > 20 and speed < 40 then
		Motor1.Volume = 0
        Motor2.Volume = speed*-0.05+2
		Motor3.Volume = speed*0.05-1
	end

end)

Something like this script. It changes the pitch (playbackspeed) and volume depending on the speed
(i also recommend using .heartbeat instead for constant loops because while true do can be a memory leak issue.)
Im sorry that i was only able to provide a basic tutorial, But let me know if you need any help!

3 Likes