# Sync animation with beat

**URL:** https://qa.fmod.com/t/sync-animation-with-beat/14863
**Category:** FMOD Studio
**Created:** [July 16, 2019, 11:49pm UTC](https://qa.fmod.com/t/sync-animation-with-beat/14863 "2019-07-16T23:49:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Gexxx](https://avatars.discourse-cdn.com/v4/letter/g/35a633/32.png) [@Gexxx](https://qa.fmod.com/u/Gexxx)
#### Post date: [July 16, 2019, 11:49pm UTC](https://qa.fmod.com/t/sync-animation-with-beat/14863/1 "2019-07-16T23:49:03Z")

</div>

Recently i tried to make some assets animations in sync with the bgm, basically a 2 sprite animation that changes with the beat. So i added a parameter with a square LFO that changes value in every beat, from 0 to 1, and from 1 to 0.  
I’m using this code to get that value on unity:

public class SoundManager : MonoBehaviour  
{  
private FMOD.Studio.EventInstance bgm;  
public Animator anim;

```
void Start(){
    anim = GetComponent<Animator>();
    bgm = FMODUnity.RuntimeManager.CreateInstance("event:/Typhoon Stage");
    bgm.start();
}

void Update(){
    bgm.getParameterByName("sprite", out float i);

    if(i == 0)
    {
        anim.SetFloat("idle", 1);
    }
    else
    {
        anim.SetFloat("idle", 0);
    }
    
}

```

}

Can someone explain me what im doing wrong?

---

<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: [July 23, 2019, 4:23am UTC](https://qa.fmod.com/t/sync-animation-with-beat/14863/2 "2019-07-23T04:23:53Z")

</div>

What is the issue you are having?

Also, you may be better off using something like Timeline beat callbacks instead.  
[https://www.fmod.com/resources/documentation-unity?version=2.0&page=examples-timeline-callbacks.html](https://www.fmod.com/resources/documentation-unity?version=2.0&page=examples-timeline-callbacks.html)
