- Home /
Audio Lag Between Multiple Listeners
Hello,
I'm working on a simple music mixer, I have 15 track loops within Unity, each have their own game object within the scene with an audio source attached to it.
By default, all the game objects/track loops are muted. All loop tracks are exactly 8.28 seconds long, and the loop audio themselves finish exactly on 8 seconds (meaning I have to cut off the 0.28 seconds).
When I run the app, the user can select what loops to play with one another - to mix them. Unity just simply mutes / unmutes the track accordingly.
The loops are running within a loop themselves, so they just keep going on and on.
After sometime, the track start to desync with one another, and all the beats become misaligned.
This is the script that is attached to all my loop game objects within the scene:
private var cutOff : float = 0.28;
var controller : GameObject;
var audioLength : float;
function Start(){
audio.loop = false;
yield WaitForSeconds(2);
audioLength = (audio.clip.length) - cutOff;
print("[Music Loop] Song Length: " + audioLength);
controller.GetComponent(OSCListener).beatLength = audioLength;
while(true){
audio.Play();
yield WaitForSeconds(audioLength / singleLoop);
}
}
As for the loop selection, its basically (PodBravo is just a bunch of input booleans):
for(var b = 0; b < grimBasic.length; b++){
if(PodBravo[b])
grimBasic[b].audio.mute = false;
else
grimBasic[b].audio.mute = true;
}
Is there any reason for this?
---- Extra Info ----
All my audio files are MP3, and are 2D sounds, I have also changed the load type to 'Stream from disk'
Your answer
Follow this Question
Related Questions
Audio loop after time 2 Answers
Audio lag/loop after weplayer gets focus again 1 Answer
iOS - Audio Lag? 1 Answer
How to make my music come on for a certain amount of time every few minutes 0 Answers
How to delay a audio loop? 1 Answer