Search Unity

Help with Audio Analisis question

Discussion in 'Scripting' started by AlexFormoso, Sep 19, 2013.

  1. AlexFormoso

    AlexFormoso

    Joined:
    Aug 12, 2012
    Posts:
    25
    Hello. First of all, i must clarify that im making this post because i dont know anything about audio in sorts of frequency, pitch and whatnot. Then, this is my problem:

    I want to have a Point light in my scene, and have it reduce and increase its intensity based on an AudioClip playing. Im going to make and example with a popular song, even tho if that song is far from similar to the ones im going to use in the scene. Lets take, Gangnam Style for example, At first, what you hear its the tune fading and in the background, a bass noting the rythm of the song (bum bum bum bum bum), then you hear a high-volume voice saying GANGNAM STYLE. What i want its the Point Light to "blink" with the audio, so, at the begining of the song, the light will be increasing and increasing intensity between lets say, 0.2 and 0.4 and when the GANGNAM STYLE part comes, it will blink 3 times (GANG-NAM-STYLE) between 0.6 and 0.8 intensity.

    To give another example, im going to use a Flash, here in Zombiegrinder you will see how the "light" of the level matches the battery rythm and thats exactly what im trying to achieve (maybe not by lowering intensity, but turning lights off and on, or enabling and disabling then) . In this Flash game, those lights are scripted to work like that, because it has 3 or 4 predefined songs, but i want it to work with every song, doesnt matter if its soft-rock or death-metal.

    http://www.coolstreaming.us/forum/arcade/game/5111.html


    Anyone have any ideas how to achieve this? Should i take this into Unity Answers or the forum its ok??

    Thanks in advance
     
  2. Hikiko66

    Hikiko66

    Joined:
    May 5, 2013
    Posts:
    1,304
  3. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
  4. AlexFormoso

    AlexFormoso

    Joined:
    Aug 12, 2012
    Posts:
    25
    @Changchun

    Yeah that is Similar to what im looking for, just that, i need to focus on the left-most bars because it seems that the samples in that fragment are the ones that provide better information about when the beat is up or not.