Search Unity

Recording in-game audio of arbitrary duration to file

Discussion in 'Audio & Video' started by cecarlsen, Jan 3, 2015.

  1. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
  2. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
    After messing with the script I found that it actually does record arbitrary durations. I also found that I could reduce latency by 1) calling Microphone.Start, 2) wait until Microphone.GetPosition started to increase, 3) set audioSource.timeSamples to Microphone.GetPosition 4) and finally start writing to file.