I am using fmod to create car engine sound with unity but i got problem i cant solve it

Hi Im Majed

recently i started using fmod to create sound engine for my game in unity so i got problem
im using the examples in documents/Fmod VEHICLE
and im using custom physics for car
and mathf.lerp
but when i run the game no sound audio work
fmod studio event emitter and listener in gameobject
actually im using and following this https://www.fmod.com/docs/2.02/unity/integration-tutorial.html
and iam new in fmod and unity 50 50 u can say !

can u please help me to run this and make it work with Max rpm and min and speed of car

Problem is this righthere my simple code

using UnityEngine;

    public class ArcadeEngineAudio : MonoBehaviour
    {
        PG.CarController rezx;
		
        void Awake()
        {
            rezx = GetComponentInParent<PG.CarController>();
        }
		
        void Update()
        {

            float effectiveRPM = Mathf.Lerp(rezx.MinRPM, rezx.MaxRPM, rezx.CurrentSpeed);
            var emitter = GetComponent<FMODUnity.StudioEventEmitter>();
            emitter.SetParameter("RPM", effectiveRPM);
        }
    }

thanks in advice

i tried to use engine rpm and min rpm and max rpm not works
even current speed

There are a few changes to the code that I would make:

// Having these as member variables is preferable over retrieving them every frame. 
private FMODUnity.StudioEventEmitter emitter;
float effectiveRPM = 0.0f;

PG.CarController rezx;

private void Awake()
{
	rezx = GetComponentInParent<PG.CarController>();
}

// Start is called before the first frame update
void Start()
{
    emitter = GetComponent<FMODUnity.StudioEventEmitter>();
}

// Update is called once per frame
void Update()
{
	effectiveRPM = Mathf.Lerp(rezx.MinRPM, rezx.MaxRPM, rezx.CurrentSpeed);
	emitter.SetParameter("RPM", effectiveRPM);
}

To make sure that we are changing the correct variables I would suggest connecting the profiler and checking checking the event’s parameter is changing:


Connecting your profiler is explained here: FMOD Studio | Profiler.

Let me know if that helps!

Hi Bro

I Did this script and its run and working but the sound of car look like annnnnnnnnnnnnn just like this
not playing the full track and iam use the example of carengine fmod
this video i recorded explain everything

Hi,

So the issue may be with the effectiveRPM. Maybe try logging it and make sure it is the right value. It may need some changes to its math.

Hi

there another parameter named Load do i need to connect it to current speed
when the car natural Gear and make rev limit rev only work and sound good
but when i drive car not good
by the way i changed the rpm in fmod to big value to test

thanks on advice

Hi,

The description for load in our FMOD Studio Example project is “Load is the amount of load the engine is under, from -1.00 to 1.00”, or the forces acting against the power of the engine. I am not sure what value this will be in your game but once you have the value it can be assigned in the same way as the RPM value.

I think debugging the variable you are assigning to the parameter in Unity and making sure it is of values you’d expect might point you in the right direction.

Hope this helps.

hi
when change the gear the pitch of sound should change too
and i tried variables
from 0 to 7500 rpm
or from 0 to 1
or random value
didnt work with me

do u have any video tutroial about this saddly fmod car engine work in unreal engine better and in unity nothing talking about this thing saddly !

thanks for your help

Hi,

When you say it didn’t work, in what way was it not working? Were there errors or was it not sounding as expected? Would it be possible to get a code snippet that you are using to change the values?

Unfortunately, there aren’t any video tutorials.

hi yes saddly no tutroial videos for this thing
ONLY For Unrealengine

i will use realistic engine sounds asset
fmod not working so i will use res

thank u

1 Like