8 Replies Latest reply on Jul 22, 2008 6:15 AM by Newsgroup_User

    Tracking audio clips

    rafa@mediatech Level 1
      Hi everyone:
      Currently when I need to track voice over, I add cue points to my audio. Then I convert the clips to shockwave audio to save space. It works great!
      Is there a way, thru lingo, that I can track my clips. Some code I can place in my script channel, that tells the playhead to wait for the audio to reach a certain point (in this case seconds into the audio). This way I can track directly in Director and can edit that cue point if it needs to be refined then and there.
      Thanks for you help.

      Rafael.
        • 1. Re: Tracking audio clips
          robdillon Most Valuable Participant
          Have a look at the sound channel's elapsedTime property. You can track this and build a set of playback points.
          • 2. Re: Tracking audio clips
            rafa@mediatech Level 1
            Hi Rob:
            Thanks for replying. I looked into the elapsedTime prop and this is what I came up with:

            on exitFrame me
            if sound(1).elapsedTime = (5000) then
            go (the frame)+1
            end if
            end

            I do not get any errors, but the play head goes straight pass the command. Any idea what am I doing wrong?

            Thanks!
            Rafael
            • 3. Re: Tracking audio clips
              Level 7
              Unless there is more code in there that you have not mentioned, there is
              nothing telling Director to NOT simply move on to the next frame. You
              could change your code like this to tell it to hold still...

              on exitFrame me
              if sound(1).elapsedTime = (5000) then
              go (the frame)+1
              else
              go to the frame
              end if
              end
              • 4. Re: Tracking audio clips
                Level 7
                By the way, you also may not want to be checking that the elapsedTime is
                EXACTLY 5000, since the polling is not really frame specific... It may
                jump from 4990 on one frame to 5002 on the next. It is usually best to
                give it a range, like this:

                on exitFrame me
                if sound(1).elapsedTime >= 5000 then
                go to the frame +1
                else
                go to the frame
                end if
                end
                • 5. Re: Tracking audio clips
                  rafa@mediatech Level 1
                  Go it, this worked:

                  on exitFrame me
                  if sound(1).elapsedTime < (2000) then
                  go (the frame)
                  if sound(1).elapsedtime = (2000) then
                  go (the frame) +1
                  end if
                  end if
                  end

                  but I guess I need to come up with something more general that I can use for all markers. Something that looks for most recent CUE point, or something like that.

                  Rafael
                  • 6. Tracking audio clips
                    rafa@mediatech Level 1
                    oops, Mike I think we posted at the same time. My project is running from a CD, so what you mentioned about not being frame specific, it my affect the animations I am trying to play at a certain time. I guess on slower older computers it will be slower, meaning the animation would play later, right? Unless I use the "if sound(1).elapsedTime >= 5000 then" version.

                    Thanks!
                    Rafael.
                    • 7. Re: Tracking audio clips
                      Level 7
                      The 2nd if..then in there is completely ignored since it is inside the
                      1st if..then. The 1st one checks to see if the elapsedTime is less than
                      2000. Therefore, the 2nd one can NEVER be true. Since it will only be
                      looked at if the elapsedTime is <2000, it will never be 2000 (which is
                      not less than 2000). The reason that the playhead progresses to the next
                      frame is not due to the code telling it to... it is doing that since
                      there is no longer anything telling it NOT to.

                      Therefore you can condense the code like this and it will do the same thing:

                      on exitFrame me
                      if sound(1).elapsedTime < (2000) then
                      go (the frame)
                      end if
                      end
                      • 8. Re: Tracking audio clips
                        Level 7
                        It is not really a question about the speed at which the audio plays.
                        It is the polling rate. It will play at the normal speed. But Director
                        is not aware of the elapsedTime all the time. It only looks on the
                        exitFrame event where it is called. There will be more than 1ms between
                        exitFrames, so it may not be looking when the audio is at exactly 2000.

                        To illustrate what I'm on about, put this code and watch the message window:

                        on exitFrame me
                        if sound(1).elapsedTime < (2000) then
                        go (the frame)
                        put sound(1).elapsedTime
                        end if
                        end


                        You might expect the results to look like this:

                        -- 1
                        -- 2
                        -- 3
                        -- 4

                        etc...

                        But it is not reading in each one.. It depends on the frame rate of the
                        Director movie and how complex the current frame is (animation, etc)