float lookAhead = 1.0f; //how far in the future will audio samples be calculated void Update() { //Simple timer that will act as a metronome if (Time.time + lookAhead > nextSubdivision) { playhead.Advance(); //Move the music forward nextSubdivision += subdivisionLength; //Move the timer forward //Add Samples to the Sample Manager here drums.DetermineSamplesToAdd(nextSubdivision); int currentSubdivision = (Metronome.playhead.currentMeasure * signatureHi * Metronome.playhead.subdivisions + Metronome.playhead.currentSubdivision + (Metronome.playhead.currentBeat - 1) * Metronome.playhead.subdivisions) - 1; if (currentSubdivision % 64 == 0) { composer.DetermineSamplesToAdd(nextSubdivision); } } }