Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Select a random segment from a list of sequenced clips inside composition.

  • Select a random segment from a list of sequenced clips inside composition.

    Posted by Jorge Devandas on March 10, 2023 at 8:05 pm

    For example, let’s say I have a bouncing ball animation loop, it lasts 1 second.
    I would like the animation to have a different random sound at the start of each 1 second cycle.

    I have a precomposition with 10 sequenced audio layers, each one of these sound clips with a duration of 1 second.

    Would it be possible to apply an expression to the time remapping of the Sounds Precomp so that it randomly chooses one of these 10 segments, plays it for a second and then plays another one?

    (I would guess it doesn’t require to identify each of the sound clips but the start/end of them since they all have the same duration, e.g. choose a random range from ‘0 to 1 sec’, ‘2 to 3’, etc.)

    Let me know if I need to be more specific, thanks in advance!

    Brie Clayton replied 1 year, 2 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    March 10, 2023 at 9:10 pm

    Something like this maybe:

    dur = 1;
    numSegs = 10;
    seedRandom(Math.floor(time/dur),true);
    segIdx = Math.floor(random(numSegs));
    t = time%dur;
    segIdx*dur + t
  • Jorge Devandas

    March 11, 2023 at 10:30 pm

    Yes, that’s exactly what I was looking for. Thank you so much Dan!

  • Brie Clayton

    March 11, 2023 at 11:55 pm

    Thank you, Jorge, for letting us know that Dan has solved your issue. In Creative COW’s new reward system, Dan has earned a COW Solve Coin.

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