// Update is called once per frame void FixedUpdate() { t -= Time.fixedDeltaTime; if (t <= 0f) { int [,] notes = BackgroundMusic.GetNextEvent(); for (int inst = 0; inst < 4; inst++) { int degree = notes[inst, 0] - 1; int alteration = notes[inst, 1]; float frequency = 0f; int power = 0; if (degree >= 0) { switch (inst) { case 0: frequency = Scale.GetNoteFrequency(degree, alteration) / 4f; chuck.RunCode(ChuckSynths.BG_Plucked_String(frequency)); break; case 1: power = degree; chuck.RunCode(ChuckSynths.BG_Bass(power)); break; case 2: power = degree; chuck.RunCode(ChuckSynths.BG_Snare(power)); break; case 3: power = degree; chuck.RunCode(ChuckSynths.BG_Hi_Hat(power)); break; } } } // Debug.Log(notes); t = eventDelta; } }