Search Unity

Microphone playback latency to minimum (internet combed)

Discussion in 'Audio & Video' started by Nirvan, Aug 6, 2016.

  1. Nirvan

    Nirvan

    Joined:
    Nov 16, 2013
    Posts:
    134
    Hi all, I creating application (windows) for playing samples (in a little complex way) and for applying vocal effects in realtime.
    I managed everything and now I want to have signal from my interface (microphones etc.) in unity audio source.
    So I did something like:

    s.clip = Microphone.Start( Microphone.devices[0], true, 1, AudioSettings.outputSampleRate );
    // device[0] is my default device which is my audio interface (Line6 Pod HD Pro and Pod GX)
    s.loop = true;

    while ( !( Microphone.GetPosition( Microphone.devices[0] ) > 0 ) ) { }

    s.Play();

    But it not helped, latency is big, then I setted in AudioSettings -> DSPBufferSize to "Best Latency" and latency is smaller indeed but it's still too much, you say word "can you?" and then you hear yourself, I need latency to be very very small. In my DAW I can set it to be this small, with ASIO drivers it's cheap in CPU too, but I think I can't do this in Unity unfortunately :(

    I was changing settings for asio buffer sizes etc. but it not helped, I tried with this script: https://yuueducation.wordpress.com/2015/07/01/asynchronous-microphone-control-in-unity/ but there is still big latency :/

    I also found this http://forum.unity3d.com/threads/real-time-audio-from-microphone.145686/ but this is code for old unity, and don't know if it could increase something, (couldn't try because of error when doing code with mic)

    But today I found it, https://www.assetstore.unity3d.com/en/#!/content/19291 this could work but I don't want pay 30$ for something I don't know will work with my situation. Is there warranty of money back or someone of you guys managed how to get microphone signal in ~50ms?
     
  2. rorywalsh

    rorywalsh

    Joined:
    Apr 10, 2015
    Posts:
    114
    Can you not set the buffer sizes yourself to something quite small, like 64 or 32? I used a microphone for something lately and latency was the finest. Can you select the asio drivers within Unity? I can't recall and don't have access to Unity at the minute..