Microphone Input to Spawn object

I’m following a tutorial on this site here:
http://www.kaappine.fi/tutorials/using-microphone-input-in-unity3d/
But the code is out of date and brings bace the following errors after Unity Upgraded it:

Assets/Scripts/MicrophoneInput.cs(13,49): error CS0103: The name `AudioInputDevice’ does not exist in the current context

Assets/Scripts/MicrophoneInput.cs(13,37): error CS1502: The best overloaded method match for `UnityEngine.Microphone.GetPosition(string)’ has some invalid arguments

Assets/Scripts/MicrophoneInput.cs(13,37): error CS1503: Argument #1' cannot convert object’ expression to type `string’

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(AudioSource))]
public class MicrophoneInput : MonoBehaviour {
	public float sensitivity = 100;
	public float loudness = 0;

	void Start() {
		GetComponent<AudioSource>().clip = Microphone.Start(null, true, 10, 44100);
		GetComponent<AudioSource>().loop = true; // Set the AudioClip to loop
		GetComponent<AudioSource>().mute = true; // Mute the sound, we don't want the player to hear it
		while (!(Microphone.GetPosition(AudioInputDevice) > 0)){} // Wait until the recording has started
		GetComponent<AudioSource>().Play(); // Play the audio source!
	}

	void Update(){
		loudness = GetAveragedVolume() * sensitivity;
	}

	float GetAveragedVolume()
	{ 
		float[] data = new float[256];
		float a = 0;
		GetComponent<AudioSource>().GetOutputData(data,0);
		foreach(float s in data)
		{
			a += Mathf.Abs(s);
		}
		return a/256;
	}
}

I think you should use “Microphone” instead of “AudioInputDevice”

Maybe you should pass the device name or null(default device) for Microphone.GetPosition:

Microphone.GetPosition(null)