Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Move objects to music

Discussion in 'Audio & Video' started by Subcursion, Dec 16, 2014.

  1. Subcursion

    Subcursion

    Joined:
    Nov 5, 2014
    Posts:
    1
    I'm looking to move a object up and down, or scale it up and down, to music. Now, I'm ok with just gettng the intensity of the music at points and using that to scale it appropiately but if I can get more in depth audio analysis, like having different objects reacting to different frequency ranges and then using that range to scale that would be awesome. I'm looking for a part of the audio methods to access this information and so far have not found much. I hope there's something I'm missing?
     
  2. Veemix

    Veemix

    Joined:
    Dec 5, 2014
    Posts:
    25
    Aeleck, have a look at OnAudioFilterRead(). That will provide you with the raw audio data from a Unity scene as arrays of floats. There is a blog post here which may be useful to you...they determine the amplitude of the audio using an absolute value function and a smoothing filter. If you want to determine the "energy" of the audio across frequency ranges, you will likely need to implement a Fourier Transform.
     
    Last edited: Dec 17, 2014