Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Audio Android Microphone and Playback has significant delay

Discussion in 'Audio & Video' started by dormouse, Jun 10, 2019.

  1. dormouse

    dormouse

    Joined:
    Mar 1, 2011
    Posts:
    65
    Dear all developers,

    Recently, we would like to use microphone to capture voice input and playback immediately without latency in the game play. but with following native functions, we have a significant delay with the sound playback:

    Code (CSharp):
    1.         var audio = this.GetComponent<AudioSource>();
    2.         audio.clip = Microphone.Start(null, true, 10, 44100);
    3.         //audio.loop = false;
    4.         while (!(Microphone.GetPosition(null) > 0)) { }
    5.         audio.Play();
    We would like to know whether there's a solution to remove the delay or not ?