Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Microphone Capture Not Working On Ubuntu 14.04 LTS

Discussion in 'Audio & Video' started by AceES, Jul 21, 2015.

  1. AceES

    AceES

    Joined:
    Aug 7, 2013
    Posts:
    3
    Hello,

    Our microphone capture code works fine on Win/Mac, but doesn't on Ubuntu 14.04 LTS. Ubuntu is configured right and we are able to record sound using other software as well as I can see FMOD Sound Helper in Sound Settings when our unity app running. Our code doesn't report any errors, but it doesn't capture any sound as well.
    Simplified version of code:

    var curDevice = Microphone.devices.FirstOrDefault();

    intminFreq,maxFreq;
    Microphone.GetDeviceCaps(curDevice,outminFreq,outmaxFreq);
    if(minFreq==0&&maxFreq==0){
    maxFreq=44100;
    }
    curSource.clip=Microphone.Start(_micDevice,true,10,maxFreq);

    while(!(Microphone.GetPosition(curDevice)>0)){
    }
    curSource.Play();

    I've tried every possible device on system and many other things. Would really appreciate microphone capture sample which works on Ubuntu 14.04 LTS or workarounds.
     
  2. AceES

    AceES

    Joined:
    Aug 7, 2013
    Posts:
    3
    Found and solved. Issue was caused by capturing same mic device more than once. Somehow it works on Win/Mac, but doesn't on Linux. If you capture same mic more than once on Ubuntu, only first attempt would get data.