Play car engine sound respectively to acceleration pedal pressed!

Hello everyone!
I need to give my car a realistic sound, I can increase/decrease the engine sound(idle)
according to the user input (pedal pressed), but this is not how the car sound reacts since the nature of sound changes and not just volume/pitch.

I though of having to different sounds, one as idle and other as “rev” and as pedal pressed
I would decrease “idle” pitch and increase “rev” sound…
There must be a better way, I need hints or tutorials to acheive this…
We see this effect in pro car games.
Thanks

1 Answer

1

You can do it by this code.

audio.pitch = Mathf.Abs(EngineRPM / MaxEngineRPM) + 1.0f;
			if (audio.pitch > 2.0f) 
			{
				audio.pitch = 2.0f;
			}