5 Replies Latest reply on Oct 27, 2015 10:53 AM by joel_pau

    syncing animation to sound

    mikeh29565435

      I am trying to figure out how to synchronize an animation to play at a certain time code of an audio playing. Is there anything like that that has been done? I can manually scrub the timeline and place a trigger action so many seconds into the main timeline that has the audio in a layer, but I wanted to do it so that once a certain time code was reached, an animation would play. I"m working in EA 2015 CC.

       

      Thanks,

      Mike

        • 1. Re: syncing animation to sound
          joel_pau Level 5

          Hi,

           

          Well, Edge API provides you .currentTime: Adobe Edge Animate CC JavaScript API

          var audio = sym.$("my_audio_element")[0];

          if (audio.currentTime = 5) { sym.play ("aLabel") }

          • 2. Re: syncing animation to sound
            mikeh29565435 Level 1

            Hi Joel,

            Thanks for your response. I haven't been able to figure it out just yet. Here's what I did so far.

             

            On my main timeline is where the audio layer (element) is located. It is set to autoplay and is called "about_us_audio." At the 5 second mark of the audio (.mp3) I want to play a symbol containing an animation called "about_me_animation." On the first frame of the main timeline I put the following trigger action.


            var audio = sym.$("about_us_audio")[0];

            if (audio.currentTime = 10) { sym.play ("about_me_animation") }


            No luck yet. Am I placing the action in the right place, in a trigger action?

            • 3. Re: syncing animation to sound
              joel_pau Level 5

              1) "At the 5 second mark of the audio (.mp3)" ==> it means: if (audio.currentTime = 5)

              2) "I want to play a symbol containing an animation called "about_me_animation."" ==> it means: { sym.getSymbol("about_me_animation").play() }

              So it should be: if (audio.currentTime = 5){ sym.getSymbol("about_me_animation").play() };

              ?

              • 4. Re: syncing animation to sound
                mikeh29565435 Level 1

                Thanks, I now understand what the code is doing. But where should I place the code? On the timeline as a trigger action? If so, does it matter which frame? Right now I have placed this code on the first frame of the timeline as a trigger action:

                var audio = sym.$("about_us_audio")[0];

                if (audio.currentTime = 5){ sym.getSymbol("about_me_animation").play() };

                 

                The stage is set to autoplay. The audio element (layer) "Playback" is set to play from the first frame (0.00) of the main timeline.

                 

                But the "about_me_animation" plays from the very beginning, not when the audio reaches the 5 second mark (of the .mp3). I'm wondering if I placed the code in the wrong place.

                • 5. Re: syncing animation to sound
                  joel_pau Level 5

                  Because the stage is set to autoplay, i will use the compositionReady panel.

                  I quote Edge API: compositionReady fires after the composition is ready to play, but before autoPlay occurs.