Created
March 30, 2015 01:41
-
-
Save gmodeblog/487771aa6dd37d28df13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const int SAMPLE_NUM = 512; | |
| LineRenderer line; | |
| line = gameObject.AddComponent<LineRenderer>(); | |
| //好きな色を指定しています。 | |
| line.material.color = Color.cyan; | |
| //ちょうどいい太さを指定しています。 | |
| line.SetWidth(0.065f, 0.065f); | |
| line.SetVertexCount(SAMPLE_NUM); | |
| float[] audioWaveFloat = new float[SAMPLE_NUM]; | |
| audioWaveFloat = extraAudioSource.audio.GetSpectrumData(SAMPLE_NUM, 0, FFTWindow.BlackmanHarris); | |
| for (int i = 0; i < SAMPLE_NUM; i++) | |
| { | |
| line.SetPosition(i, new Vector3(Mathf.Log(i + 1), audioWaveFloat[i], 0)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment