# Using FMOD with JavaScript

**URL:** <https://qa.fmod.com/t/using-fmod-with-javascript/13056>\
**Category:** Unity\
**Created:** [March 22, 2017, 3:12pm UTC](https://qa.fmod.com/t/using-fmod-with-javascript/13056 "2017-03-22T15:12:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Miggen291](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@Miggen291](https://qa.fmod.com/u/Miggen291)\
**Post date:** [March 22, 2017, 3:12pm UTC](https://qa.fmod.com/t/using-fmod-with-javascript/13056/1 "2017-03-22T15:12:20Z")

</div>

I am unsure what the procedure is (if there is one/if it’s possible?) if I wanted to insert FMOD events in a script written in JavaScript.

I am comfortable with setting it up to work in scripts written in C# so at the top there is

[FMODUnity.EventRef]  
public string eventName = “event:/pathtoevent”;  
private FMOD.Studio.EventInstance eventNameRef;  
private FMOD.Studio.ParameterInstance parameterNameRef;

and then in Start() you have  
eventNameRef = FMODUnity.RuntimeManager.CreateInstance(“eventName”);

and then call these events at the appropriate time.

However how do you do this in JavaScript?

For example if the player controller script is in JS and every time they press jump a PlayOneShot event is triggered. Or if the up key is pressed then a footsteps event is triggered.

Having no luck so far ☹

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [March 24, 2017, 3:49am UTC](https://qa.fmod.com/t/using-fmod-with-javascript/13056/2 "2017-03-24T03:49:37Z")

</div>

It is very similar to c#, this should start you off.  
`
@FMODUnity.EventRef
public var fmodEvent : String;
`  
A lot of Unity’s tutorials are available in both c# and Javascript: [https://unity3d.com/learn/tutorials](https://unity3d.com/learn/tutorials).
