# Change parameter over Time

**URL:** <https://qa.fmod.com/t/change-parameter-over-time/11498>\
**Category:** Unity\
**Created:** [June 6, 2014, 6:14pm UTC](https://qa.fmod.com/t/change-parameter-over-time/11498 "2014-06-06T18:14:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![t\_ippy](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@t\_ippy](https://qa.fmod.com/u/t_ippy)\
**Post date:** [June 6, 2014, 6:14pm UTC](https://qa.fmod.com/t/change-parameter-over-time/11498/1 "2014-06-06T18:14:17Z")

</div>

Can someone please tell me now to change a parameter overtime in unity C# script. I’ve been trying everything I can think of and can’t figure out how to do it. I can get the parameter to jump to different points, but I can’t get it to be a gradual change. Like fade from 1 type of music to another. I think I need to use the getParameter or something. All help is appreciated.

Here is my code:

```auto
using UnityEngine;
using System.Collections;

public class soundManager : MonoBehaviour {
	FMOD_StudioSystem soundSystem;

	public FMODAsset asset;
	FMOD.Studio.EventInstance evt;
        //FMOD.Studio.ParameterInstance pMusic;

	// Use this for initialization

	void Start ()
        {
		
		soundSystem=FMOD_StudioSystem.instance;

		evt = FMOD_StudioSystem.instance.GetEvent(asset.id);
		 
    }  

	
	// Update is called once per frame
	void Update () 
		
	{
	

		if (Input.GetKeyDown ("p"))
		    {
			evt.start();

		}

		//change an events parameters based on a key input:

		if (Input.GetKeyDown ("o")) 
		
		{

				evt.setParameterValue ("music", 1.0F)	

		}

		if (Input.GetKeyDown ("i")) {
			
			evt.setParameterValue ("music", 0.0F);
		
		}
}

```

---

<div class="post-metadata">

**Author:** ![t\_ippy](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@t\_ippy](https://qa.fmod.com/u/t_ippy)\
**Post date:** [June 18, 2014, 7:58pm UTC](https://qa.fmod.com/t/change-parameter-over-time/11498/2 "2014-06-18T19:58:56Z")

</div>

First thanks both of you for the suggestions.

@ Peter, thanks for the coroutine stuff. You can probably tell I’m new to programming, but slowly getting the hang of it. I was able to figure it out using a coroutine and it works great.

Although I am curious about seek speed. What is it? where do I find it. I googled and looked in the fmod docs, but I didn’t find any thing. Any thoughts of where I can lean about it?

---

<div class="post-metadata">

**Author:** ![dnishimura](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/dnishimura/32/25_2.png) [@dnishimura](https://qa.fmod.com/u/dnishimura)\
**Post date:** [June 10, 2014, 9:04pm UTC](https://qa.fmod.com/t/change-parameter-over-time/11498/3 "2014-06-10T21:04:23Z")

</div>

You need to either interpolate the value you’re passing in your code, or increase the “seek speed” in your FMOD Studio Project .

---

<div class="post-metadata">

**Author:** ![Guest1](https://avatars.discourse-cdn.com/v4/letter/g/ecccb3/32.png) [@Guest1](https://qa.fmod.com/u/Guest1)\
**Post date:** [June 12, 2014, 2:04am UTC](https://qa.fmod.com/t/change-parameter-over-time/11498/4 "2014-06-12T02:04:38Z")

</div>

Seek speed is a good option, that offers linear interpolation to smooth out parameter changes. If you want more control you could update the parameter each frame from Update or using a [Coroutine](http://docs.unity3d.com/Manual/Coroutines.html)
