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
6
Question by Tyler 2 · Nov 25, 2010 at 06:37 AM · musicvisualize

Music Visualizer?

Does anyone have any ideas on how I can make some function react to music, like an audio visualizer (ex: there is a sudden jump in the music, so I use a particle animator color script to change the color to red or something like that)? I have looked into this

But there is not much info on it.

Comment
Add comment · Show 1
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 skovacs1 · Nov 25, 2010 at 07:31 PM 4
Share

What is a "jump in the music"? A volume change? A frequency change? The addition of a new frequency? The AudioSource.GetOutputData returns a bunch of audio samples and if you want more information on that, feel free to ask, however UnityAnswers is for questions about Unity. Teaching the ins and outs of digital audio signal analysis is beyond the scope of UnityAnswers. If you have Unity Pro for desktop or mobile, you may consider leveraging an external library (like Clam (clam-project.org)) through a plug-in, but otherwise you must roll your own solution if you cannot find one built for Unity.

7 Replies

· Add your reply
  • Sort: 
avatar image
9

Answer by jonas-echterhoff · Dec 14, 2010 at 05:37 PM

You don't need to do any heavy calculations to get spectrum data in Unity - at least not yourself. Just use AudioSource.GetSpectrumData. That gives you all the values, you just need to render it somehow.

Comment
Add comment · Show 3 · 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 Tyler 2 · Dec 15, 2010 at 12:41 AM 0
Share

Ok, I found a script using that, that prints several values in the console...what do they mean? The frequency, the amplitude...there are many values, are they taken every few seconds from the song?

avatar image jonas-echterhoff ♦♦ · Dec 15, 2010 at 08:48 AM 0
Share

What GetSpectrumData does is it gives you an array of floats representing the volumes of different frequencies currently playing. So, the lower indices of the array represent low frequencies. If you see high values there, you have a lot of bass. The higher indices represent high frequencies. Like a spectrum analyzer in some consumer electronics.

avatar image Tyler 2 · Dec 15, 2010 at 10:06 PM 0
Share

Is it calculating new values every frame? How do I access these values in another function? Can I calcculate things like BP$$anonymous$$ and audio pikes (as BerggreenD$$anonymous$$ said), using the GetSpectrumData or GetOutputData? Tyler 0 secs ago

avatar image
2

Answer by miketucker · Oct 03, 2011 at 12:12 PM

I wrote a fairly long tutorial on how to do music visualization in Unity: http://www.creativeapplications.net/mac/visuals-for-sonar-festival-vdmx-to-unity3d-tutorials/

Comment
Add comment · 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
1

Answer by BerggreenDK · Dec 09, 2010 at 07:44 AM

I guess you want to build some kinda spectrum analyzer like Winamp visualizations or MediaPlayer screens?

What I've learned from examining this kinda task, is that you have certain heavy calculations to perform each frame if you want a realistic reaction on the sound.

The reason is that music comes with "beats" so there would be some "pikes" in the volume where the drums etc. hits. But there is also a frequence of the waveform you need to put into the equation to get these data out.

My answer would be, go look for a c# example on how to detect BPM on an MP3/OGG and then grab the parts from those.

Its pretty hardcore math to build yourself, I've heard. Sorry that I cant provide you with the actual codesolution, but I havent found it myself. So if you do, please post it to the community as many people might find this very interesting too. Including me. :-)

Comment
Add comment · 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
0

Answer by rook · Apr 10, 2011 at 03:07 PM

if your interested in beat-detection you can download the source for the processing library, minim (http://code.compartmental.net/minim/distro/minim-2.0.2-full.zip) and look at BeatDetect.java ; perhaps you could port the code to work with Unity3d. hope this helps, -rook

Comment
Add comment · 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
0

Answer by AlteredReality · Sep 12, 2011 at 07:16 PM

I recently released a Unity Scripting Package for music visualization, called Visualizer Studio. It should help you out quite a bit! :-)

[Link removed by mod]

Comment
Add comment · Show 2 · 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 Meltdown · Sep 12, 2011 at 07:51 PM 0
Share

Umm which moderator approved this? Its a spoofed link to an asset store on a foreign domain.

avatar image AlteredReality · Sep 12, 2011 at 08:07 PM 1
Share

I added the link to Visualizer Studio in the asset store. It was simply the URL that I got when getting the external link from the asset store page. Not sure what the problem was with the link...

  • 1
  • 2
  • ›

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Major Latency on Android when using Microphone 1 Answer

Audio volume change? 1 Answer

Lorenz Attractor Music Visualizer 0 Answers

C sharp cant play Audio 2 Answers

Sound effect doesn't play correctly 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