GetSpectrumData Why last element in array allways is zero?
Hello everyone! It's okay?
     void Update()
     {
 
 
         float[] spectrum = new float[256];
 
         AudioListener.GetSpectrumData(spectrum, 0, FFTWindow.Rectangular);
         Debug.Log(spectrum[255]);
         for (int i = 1; i < spectrum.Length - 1; i++)
         {
             Debug.DrawLine(new Vector3(i - 1, spectrum[i] + 10, 0), new Vector3(i, spectrum[i + 1] + 10, 0), Color.red);
             Debug.DrawLine(new Vector3(i - 1, Mathf.Log(spectrum[i - 1]) + 10, 2), new Vector3(i, Mathf.Log(spectrum[i]) + 10, 2), Color.cyan);
             Debug.DrawLine(new Vector3(Mathf.Log(i - 1), spectrum[i - 1] - 10, 1), new Vector3(Mathf.Log(i), spectrum[i] - 10, 1), Color.green);
             Debug.DrawLine(new Vector3(Mathf.Log(i - 1), Mathf.Log(spectrum[i - 1]), 3), new Vector3(Mathf.Log(i), Mathf.Log(spectrum[i]), 3), Color.blue);
         }
     }
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
How to play a random audio clip from an array in C#? 1 Answer
Quick Audio Question - Trying to add sound to gun 2 Answers
Ubuntu 16.04 No audio 1 Answer
c# sound in unity 5 1 Answer
Second AudioClip won't play 0 Answers