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

**URL:** <https://qa.fmod.com/t/i-am-using-fmod-to-create-car-engine-sound-with-unity-but-i-got-problem-i-cant-solve-it/20309>\
**Category:** Unity\
**Tags:** unity, csharp\
**Created:** [June 12, 2023, 11:56pm UTC](https://qa.fmod.com/t/i-am-using-fmod-to-create-car-engine-sound-with-unity-but-i-got-problem-i-cant-solve-it/20309 "2023-06-12T23:56:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![M0ajod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/m0ajod/32/5124_2.png) [@M0ajod](https://qa.fmod.com/u/M0ajod)\
**Post date:** [June 12, 2023, 11:56pm UTC](https://qa.fmod.com/t/i-am-using-fmod-to-create-car-engine-sound-with-unity-but-i-got-problem-i-cant-solve-it/20309/1 "2023-06-12T23:56:44Z")

</div>

# 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](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

```auto
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
```

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [June 14, 2023, 4:36am UTC](https://qa.fmod.com/t/i-am-using-fmod-to-create-car-engine-sound-with-unity-but-i-got-problem-i-cant-solve-it/20309/2 "2023-06-14T04:36:14Z")

</div>

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

```auto
// 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:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/d/d08a83af959eea75cbde40ce56e58d524c16b975.png)  
Connecting your profiler is explained here: [FMOD Studio | Profiler](https://fmod.com/docs/2.02/studio/profiling.html).

Let me know if that helps!

---

<div class="post-metadata">

**Author:** ![M0ajod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/m0ajod/32/5124_2.png) [@M0ajod](https://qa.fmod.com/u/M0ajod)\
**Post date:** [June 14, 2023, 12:28pm UTC](https://qa.fmod.com/t/i-am-using-fmod-to-create-car-engine-sound-with-unity-but-i-got-problem-i-cant-solve-it/20309/3 "2023-06-14T12:28:07Z")

</div>

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

[![](https://img.youtube.com/vi/dBj6lWvyv1Y/hqdefault.jpg "Bop") ](https://www.youtube.com/watch?v=dBj6lWvyv1Y)

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [June 15, 2023, 4:12am UTC](https://qa.fmod.com/t/i-am-using-fmod-to-create-car-engine-sound-with-unity-but-i-got-problem-i-cant-solve-it/20309/4 "2023-06-15T04:12:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![M0ajod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/m0ajod/32/5124_2.png) [@M0ajod](https://qa.fmod.com/u/M0ajod)\
**Post date:** [June 15, 2023, 11:27am UTC](https://qa.fmod.com/t/i-am-using-fmod-to-create-car-engine-sound-with-unity-but-i-got-problem-i-cant-solve-it/20309/5 "2023-06-15T11:27:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [June 18, 2023, 11:28pm UTC](https://qa.fmod.com/t/i-am-using-fmod-to-create-car-engine-sound-with-unity-but-i-got-problem-i-cant-solve-it/20309/6 "2023-06-18T23:28:48Z")

</div>

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.

> [@M0ajod](#):
>
> but when i drive car not good

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.

---

<div class="post-metadata">

**Author:** ![M0ajod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/m0ajod/32/5124_2.png) [@M0ajod](https://qa.fmod.com/u/M0ajod)\
**Post date:** [June 19, 2023, 1:35am UTC](https://qa.fmod.com/t/i-am-using-fmod-to-create-car-engine-sound-with-unity-but-i-got-problem-i-cant-solve-it/20309/7 "2023-06-19T01:35:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [June 21, 2023, 12:18am UTC](https://qa.fmod.com/t/i-am-using-fmod-to-create-car-engine-sound-with-unity-but-i-got-problem-i-cant-solve-it/20309/8 "2023-06-21T00:18:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![M0ajod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/m0ajod/32/5124_2.png) [@M0ajod](https://qa.fmod.com/u/M0ajod)\
**Post date:** [June 21, 2023, 12:20am UTC](https://qa.fmod.com/t/i-am-using-fmod-to-create-car-engine-sound-with-unity-but-i-got-problem-i-cant-solve-it/20309/9 "2023-06-21T00:20:16Z")

</div>

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
