Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by KnightRiderGuy · Nov 26, 2014 at 05:17 PM · guiwindowpopup

Is it possible to have a spectrum analyzer display for each song in a playlist?

This is going to sound a little complicated but I am wondering if it is possible for me to have a spectrum analyzer display running for each song being played in a music player. I'm not very good with code. I think I have seen it done but I'm not sure how to go about making one or if it is even possible. This is an example of the type of thing I am trying to create, I'm wondering if I could have a spectrum analyzer display in the middle of the knight head logos or maybe even as a closable pop up window that could be called to display with a texture GUI button. Is this possible? And if so how would I go about doing this? alt text

screen shot 2014-11-25 at 2.44.27 pm.png (446.0 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Graham-Dunnett · Nov 26, 2014 at 05:17 PM

Something like:

http://docs.unity3d.com/ScriptReference/AudioSource.GetSpectrumData.html

???

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image KnightRiderGuy · Nov 26, 2014 at 05:44 PM 0
Share

You'll have to forgive me but I'm not really sure what that does. I'll try to see if I can show an example: Something like this that could be displayed in the middle or top of my interface when any given song is being played.

Video on YouTube

avatar image KnightRiderGuy · Nov 26, 2014 at 05:47 PM 0
Share

This is another good example of the look and feel I am trying to go with: 2nd YouTube Video sample

avatar image KnightRiderGuy · Dec 04, 2014 at 01:54 PM 0
Share

These are not bad but is there a descent tutorial out there anywhere on how to make one that will play for each song in a playlist.

avatar image AlucardJay · Dec 04, 2014 at 08:25 PM 0
Share

https://www.youtube.com/watch?v=V_8JSWVT36k

http://answers.unity3d.com/questions/157940/getoutputdata-and-getspectrumdata-they-represent-t.html

avatar image KnightRiderGuy · Dec 07, 2014 at 02:16 PM 0
Share
 using UnityEngine;
 using System.Collections;
 
 public class Spectrum : $$anonymous$$onoBehaviour {
 public AudioSource asource;
 public int channel;
 float[] spectrum; 
 float[] volume;
 public int numSamples;
 public GameObject enem;
     // Use this for initialization
     void Start () {
     volume = new float[numSamples];
     spectrum = new float[numSamples];
     
         for (int i=1; i<255; i++)
         
         {
             
         GameObject enemyClone = Instantiate(enem,new Vector3(i,0,0), transform.rotation) as GameObject ;
         enemyClone.name = "sp"+i;
             
         }
     
     
     }
     
     // Update is called once per frame
     void Update () {
     asource.GetOutputData(volume, channel);
     asource.GetSpectrumData(spectrum, channel, FFTWindow.Rectangular);
     
     for (int i=0; i<255; i++) {
         string    sp = "sp"+(i+1);
             GameObject sp1 = GameObject.Find(sp);
         sp1.transform.localScale= new  Vector3(1,200*spectrum[i],1);
         sp1.GetComponent<$$anonymous$$eshRenderer>().material.color= new Color(100*spectrum[i],1f/(20*spectrum[i]),1f/(20*spectrum[i]),1);
             
             
         }
         
     /*GameObject sp1 = GameObject.Find("sp1");
         sp1.transform.localScale= new  Vector3(1,100*spectrum[0],1);
     GameObject sp2 = GameObject.Find("sp2");
         sp2.transform.localScale= new  Vector3(1,100*spectrum[1],1);
     GameObject sp3 = GameObject.Find("sp3");
         sp3.transform.localScale= new  Vector3(1,100*spectrum[2],1);
     GameObject sp4 = GameObject.Find("sp4");
         sp4.transform.localScale= new  Vector3(1,100*spectrum[3],1);
     GameObject sp5 = GameObject.Find("sp5");
         sp5.transform.localScale= new  Vector3(1,100*spectrum[4],1);
     GameObject sp6 = GameObject.Find("sp6");
         sp6.transform.localScale= new  Vector3(1,100*spectrum[5],1);
     GameObject sp7 = GameObject.Find("sp7");
         sp7.transform.localScale= new  Vector3(1,100*spectrum[6],1);
     GameObject sp8 = GameObject.Find("sp8");
         sp8.transform.localScale= new  Vector3(1,100*spectrum[7],1);
     GameObject sp9 = GameObject.Find("sp9");
         sp9.transform.localScale= new  Vector3(1,100*spectrum[8],1);
     GameObject sp10 = GameObject.Find("sp10");
         sp10.transform.localScale= new  Vector3(1,100*spectrum[9],1);
     GameObject sp11 = GameObject.Find("sp11");
         sp11.transform.localScale= new  Vector3(1,100*spectrum[10],1);
     GameObject sp12 = GameObject.Find("sp12");
         sp12.transform.localScale= new  Vector3(1,100*spectrum[11],1);
     GameObject sp13 = GameObject.Find("sp13");
         sp13.transform.localScale= new  Vector3(1,100*spectrum[12],1);
     GameObject sp14 = GameObject.Find("sp14");
         sp14.transform.localScale= new  Vector3(1,100*spectrum[13],1);
 
         */
     }
     
 
 }
Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

What's a great way to make a custom information window pop up 1 Answer

problem with a pop-up window 1 Answer

GUI Window problem 2 Answers

Make a pop up window work on a key press 1 Answer

GUI Window on GameObject location? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges