Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Song time tracker/timer help

  • Song time tracker/timer help

    Posted by Dennis Eriksson on August 22, 2024 at 9:16 pm

    I have a bit of a problem, I mean, I got it to work semi-automatically, I’m making a time elapsed / end time timer for songs, so example: “01:23 / 03:21”.

    I’ve been able to make the “current time” track automatically, but I’d like the “end time” to be defined based on the end point of the layer length, would that be possible?

    Current expression:

    endtime = " / 02:30" //end time;

    slider = Math.round(effect("Slider Control")("Slider")) //Treat slider numbers as rounded up;

    sec = slider%60 //When the slider hits 60;

    min = Math.floor(slider/60) //reset and add a number to the minute counter;

    function addZero(n){ if (n<10) return "0" + n else return n } //convert 0:00 to 01:23 or current time counter;

    addZero(min) + ":" + addZero(sec) + endtime //Show 01:23 / 03:21;

    And the slider only has:

    time;

    But yeah, as you can see, I have to set endtime myself, but it would be more convenient if it could just do everything automatically. If it’s not possible, setting the endtime manually isn’t the end of the world.

    Brie Clayton
    replied 2 weeks, 2 days ago
    3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    August 22, 2024 at 9:59 pm

    Like this maybe:

    slider = Math.round(effect("Slider Control")("Slider"));
    function addZero(n){return (n < 10 ? "0" : "") + n}
    et = Math.round(outPoint);
    sec = et%60;
    min = Math.floor(et/60);
    endtime = addZero(min) + ":" + addZero(sec);
    sec = slider%60;
    min = Math.floor(slider/60);
    function addZero(n){return (n < 10 ? "0" : "") + n}
    addZero(min) + ":" + addZero(sec) + " / " + endtime
  • Dennis Eriksson

    August 22, 2024 at 11:03 pm

    DUDE! You’re my savior, thanks so much 🙂

  • Dan Ebberts

    August 22, 2024 at 11:15 pm

    You’re welcome. It turns out I defined the addZero() function twice. It shouldn’t hurt anything, but this is better:

    slider = Math.round(effect("Slider Control")("Slider"));
    function addZero(n){return (n < 10 ? "0" : "") + n}
    et = Math.round(outPoint);
    sec = et%60;
    min = Math.floor(et/60);
    endtime = addZero(min) + ":" + addZero(sec);
    sec = slider%60;
    min = Math.floor(slider/60);
    addZero(min) + ":" + addZero(sec) + " / " + endtime
  • Dennis Eriksson

    August 22, 2024 at 11:17 pm

    It works anyway, thanks again 🙂

  • Brie Clayton

    August 23, 2024 at 12:45 am

    Thank you for solving this, Dan!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy