# Passing parameters to FMOD in JavaScript

**URL:** https://qa.fmod.com/t/passing-parameters-to-fmod-in-javascript/11821
**Category:** Unity
**Created:** [February 5, 2015, 9:26am UTC](https://qa.fmod.com/t/passing-parameters-to-fmod-in-javascript/11821 "2015-02-05T09:26:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![creativeheroes](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@creativeheroes](https://qa.fmod.com/u/creativeheroes)
#### Post date: [February 5, 2015, 9:26am UTC](https://qa.fmod.com/t/passing-parameters-to-fmod-in-javascript/11821/1 "2015-02-05T09:26:52Z")

</div>

Hi! Just set up FMOD in Unity from scratch for the first time. I love the workflow! I’m currently trying to pass through variables, but FMOD does not respond to variable changes. Am I doing something wrong with the following JS? All documentation is in C# so I distilled this example from the Angry Bots project, where it seems to work fine. The Awe parameter is found on the music event, the event is correctly set up in FMOD Studio (responds to changes of the awe parameter in the GUI if I change it manually) and the music is playing as it should.

#pragma strict

var awesomeMusic : FMOD.Studio.EventInstance;  
var Awe : FMOD.Studio.ParameterInstance;  
var aweParam: float;

function Start ()  
{  
awesomeMusic = FMOD\_StudioSystem.instance.GetEvent("{longcodeyepyep-pastehere}");  
if (awesomeMusic.getParameter(“Awe”, Awe) != FMOD.RESULT.OK)  
{  
Debug.LogError(“Awe parameter not found on music event”);  
return;  
}

```
Awe.setValue(0.0f);

```

}

function Update ()  
{  
if (Input.GetKeyDown ("="))  
{  
if(aweParam\<1.0) aweParam=aweParam+0.05;  
print ("Awe "+aweParam);  
Awe.setValue(aweParam);  
}

```
if (Input.GetKeyDown ("-"))
{
	if(aweParam>0.0) aweParam=aweParam-0.05;
	print ("Awe "+aweParam);
	Awe.setValue(aweParam);
}

```

}

---

<div class="post-metadata">

### Author: ![nick1](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@nick1](https://qa.fmod.com/u/nick1)
#### Post date: [February 6, 2015, 2:13am UTC](https://qa.fmod.com/t/passing-parameters-to-fmod-in-javascript/11821/2 "2015-02-06T02:13:35Z")

</div>

Add awesomeMusic.start() to start the event.

---

<div class="post-metadata">

### Author: ![creativeheroes](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@creativeheroes](https://qa.fmod.com/u/creativeheroes)
#### Post date: [February 13, 2015, 10:59am UTC](https://qa.fmod.com/t/passing-parameters-to-fmod-in-javascript/11821/3 "2015-02-13T10:59:36Z")

</div>

Thanks, awesomeMusic and parameter now work like a charm! We were triggering the FMOD instance via FMOD\_StudioEventEmitter but apparently then the parameters change does not work.
