title: Get Basic audio spectrum data in unity
body: <p>I want to visualize if an audio clip has sound or not. The microphone and the 
   audiosource is working correctly but I am stuck with its visualizing part. I have hard time understanding the official document and I want a solution. </p>
  
  <p>I tried the following code:</p>
  
  <pre><code>    void Update () {
  
      AnalyzeSound();
  
      text1.text = "sound!\n"+ " rmsValue : " + rmsValue ;
  }
  
  
  void AnalyzeSound()
  {
      audio.GetOutputData(samples, 0);
  
      //GetComponent rms
  
      int i = 0;
      float sum = 0;
  
      for (; i &lt; SAMPLE_SIZE; i++)
      {
          sum = samples[i] * samples[i];
      }
  
      rmsValue = Mathf.Sqrt(sum / SAMPLE_SIZE);
  
      //get the dbValue
      dbValue = 20 * Mathf.Log10(rmsValue / 0.1f);
     }
  </code></pre>
  
  <blockquote>
    <p>Can I take rmsValue as the input of sound on microphone? or should I take the dbValue? what should be the threshold value?
    in a few words, When can I say the microphone has sound?</p>
  </blockquote>