5 Replies Latest reply on Jan 7, 2014 9:39 PM by Rick Gerard

    Switching between clips (by changing opacity) on audio claps

    Jamesbwills1

      I want to take a song, and use the claps as triggers to switch between scenes.

       

      What I've done so far:

       

      Used Soundkeys to isolate the claps, the signal looks like this:

       

      0 0 0 0 0 0 0 0 0 0 0 100 100 100 0 0 0 0 0 0 0 0 0 0 0 100 100 100 0 0 0 0 0 0 0 0 0 100 100 100 0 0 0 0 0 0 0 0

                                                ^                                                     ^                                             ^

                                             Clap 1                                             Clap 2                                    Clap 3

       

      I can't figure out how to write an expression that will set the opacity to 100 between the first two claps, then back to 0 between 2 and 3, then up to 100 at clap 3. The issue appears to be because expressions can't grab data from previous frames.

       

      Ideally I'd want the code to be like this:

       

      Opacity [This frame] = {

       

      if (clapSignal [previous] == 0 && clapSignal [current] == 100) {

           if (Opacity [last frame] == 100) { 0 }

           else { 100 }

      } else { Opacity [previous] }