void Awake() { #if UNITY_WEBGL && !UNITY_EDITOR // WebGL needs thi Microphone.Init(); Microphone.QueryAudioInput(); #endif // init microphone (use first microphone available) if (Microphone.devices.Length > 0) { microphoneInput = Microphone.Start(Microphone.devices[0], true, 30, SAMPLE_FREQUENCY); } microphoneSource = gameObject.AddComponent <AudioSource>(); InvokeRepeating("ProcessMicrophoneData", PROCESS_INTERVAL, PROCESS_INTERVAL); // route the microphone source to a special mute mixer group var mixer = Resources.Load("MasterMixer") as AudioMixer; muteMixerGroup = mixer.FindMatchingGroups("mute")[0]; microphoneSource.outputAudioMixerGroup = muteMixerGroup; // start recording IsRecording = true; }
void Awake() { Microphone.Init(); Microphone.QueryAudioInput(); }