Skip to main content
Known Participant
July 30, 2015
Answered

Expression to select all active audio layers?

  • July 30, 2015
  • 1 reply
  • 988 views

I'm trying to get an Array of all audio layers in the current comp that are currently ON and in frame (ie. In point < CTI < Out point).

Any tips on how to do this with expressions?

This topic has been closed for replies.
Correct answer Dan Ebberts

It would be something like this:

myArray = [];

for (i = 1; i <= thisComp.numLayers; i++){

  myLayer =  thisComp.layer(i);

  if (myLayer.hasAudio && myLayer.audioActive && (time >= myLayer.inPoint) && (time <= myLayer.outPoint)){

    myArray.push(myLayer);

  }

}

Dan

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
July 30, 2015

It would be something like this:

myArray = [];

for (i = 1; i <= thisComp.numLayers; i++){

  myLayer =  thisComp.layer(i);

  if (myLayer.hasAudio && myLayer.audioActive && (time >= myLayer.inPoint) && (time <= myLayer.outPoint)){

    myArray.push(myLayer);

  }

}

Dan

Mathias Moehl
Community Expert
Community Expert
July 30, 2015

You cannot select layers with expressions. But you can do it with scripts as suggested by Dan.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects