Skip to main content
Participating Frequently
May 28, 2024
Answered

Looping through a QE Sequence to add audio transitions

  • May 28, 2024
  • 2 replies
  • 501 views

I'm attempting to loop through a sequence and apply two frame audio fades at the head and tail of each audio track. Each audio track only has a single item on it.

 

My issue is that the loop stops after only two tracks, despite there being audio on the third track. Here's the code:

 

app.enableQE();
var transitionToApply = qe.project.getAudioTransitionByName("Constant Power");
var activeSeq = qe.project.getActiveSequence();

 

for(var i=0; i < activeSeq.getAudioTrackAt(i).numItems; i++){
var clips = activeSeq.getAudioTrackAt(i).getItemAt(0);

 

clips.addTransition(transitionToApply, false, "00;00;00;02");
clips.addTransition(transitionToApply, true, "00;00;00;02");
}

 

I've verified that alert(activeSeq.getAudioTrackAt(2).getItemAt(0).name); gives me the name of the first item on the third audio track and that I can apply fades manually, but I'm unable to accomplish this with a loop. Any insight would be appreciated!

This topic has been closed for replies.
Correct answer Bruce Bullis

QE DOM is not supported, and not recommended; we will not provide support for it, here. 

However, the logic error in the code above is not specific to QE DOM...

You're looping over the number of items IN a given audio track; at some point, shouldn't you be looping over the available audio tracks, IN the active sequence? 

2 replies

Participant
September 10, 2024

Hello,

My code is very similar to you but the transition applies only to the tail and the head has no transition...Do you see that problem too?

I assume the true & false are for the head and tail separations.

Thank you

Bruce Bullis
Community Manager
Bruce BullisCommunity ManagerCorrect answer
Community Manager
May 29, 2024

QE DOM is not supported, and not recommended; we will not provide support for it, here. 

However, the logic error in the code above is not specific to QE DOM...

You're looping over the number of items IN a given audio track; at some point, shouldn't you be looping over the available audio tracks, IN the active sequence?