I have this script, and part of the script deals with opening the comp in the viewer so that it can select the audio layer and create an audio null from it. I was wondering if there is a way to do this without opening the composition in the viewer, as this makes After Effects pop up over any active windows and makes the computer unusable for the duration the script is running.
I have other issues with my script but this is the most important one which will make the most difference.
Code: Select all
myComp.layers.add(sel[i]); //This adds the VO track the composition is based on to the composition myComp.layers.add(bodyComp); myComp.layers.add(mouthComp); myComp.openInViewer(); //This opens the composition the loop is currently working on in the comp viewer. It is the reason AE constantly goes to the front of the screen and a highly inefficient part of the script, but it is the only way I know of extracting audio from the VO. myComp.layer(1).timeRemapEnabled = true; myComp.layer(1).selected = false; myComp.layer(3).selected = true; //These two lines make sure that the audio layer is selected for the next step app.executeCommand(app.findMenuCommandId("Convert Audio to Keyframes")); //This extracts audio data from voice over track in the form of keyframe data in a null layer myComp.layer(2).timeRemap.expression = "X = thisComp.layer(\"Audio Amplitude\").effect(\"Both Channels\")(\"Slider\"); linear(X,0,"+finalMaxVal+",0,"+tolerance+");" myComp.layer(3).position.expression = "comp(\""+bodyCompName+"\").layer(\"DogTransform\").transform.position"; myComp.layer(3).scale.expression = "comp(\""+bodyCompName+"\").layer(\"DogTransform\").transform.scale" myComp.layer(3).rotation.expression = "comp(\""+bodyCompName+"\").layer(\"DogTransform\").transform.rotation" myComp.layer(3).selected = false; myComp.layer(1).selected = true; app.project.activeItem.layer(1).effect("Both Channels")(1).expression = "smooth("+smooth1+", "+smooth2+", time);"; //This adds a smooth expression to the null, this is the only way I've found to do this to date myComp.layer(2).outPoint = compDur;