Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

simple Microphone Input problem

Discussion in 'Audio & Video' started by wheatgrinder, Feb 11, 2016.

  1. wheatgrinder

    wheatgrinder

    Joined:
    Mar 20, 2015
    Posts:
    21
    I just started working with mic input and have been searching for confirmation that Im doing it right and that something else (dodgy driver etc) must be the problem.

    The expected behavior is that I play this game and I can hear my self in the microphone.
    The actual behavior is that I play the game and I do hear my self in the microphone, however after about 5 mins. the sound starts to get loopy.. i can hear what I said before and then the sound quickly breaks down to a noisy glitchey crackly mess.

    I broke this down to a simple to reproduce steps.
    Create new project
    Add AudioSource to my main camera
    Add new script to my main camera : micInputScript
    Contents of new script are:

    using UnityEngine;
    using System.Collections;
    using UnityEngine.Audio;

    public class micInputScript : MonoBehaviour {
    private AudioClip _clip;

    // Use this for initialization
    void Start () {

    AudioSource aud = GetComponent<AudioSource>();
    _clip = aud.clip = Microphone.Start(null, true, 10, 16000);
    aud.loop = true; // Set the AudioClip to loop

    while (!(Microphone.GetPosition(null) > 0)) { } // Wait until the recording has started

    aud.Play(); // Play the audio source!


    }


    }

    All pretty typical from all the examples I can find on the Internets. Anyone else have this type of problem.

    Thanks
     
  2. wheatgrinder

    wheatgrinder

    Joined:
    Mar 20, 2015
    Posts:
    21
    The issue was indeed caused by dodgy hardware. Not a unity issue at all