Skip to main content
Known Participant
February 9, 2021
Answered

AE Scripting how to set audio keyframes via scripting.

  • February 9, 2021
  • 3 replies
  • 1797 views

Hello, I've been tearing my hair simply trying to address the "Audio levels" of a layer, 

 

My script is below, whittled down from just trying to get the property layers from being anything other than "underfined". I've written a handful of small scripts to set layers, trim, make templates, etc. but nothing mroe advanced,  Do I not have the match names right? Just don't know (enough) why this isn't working and hoping I can get some help. Thank you in advance.

 

var myLayers = app.project.activeItem.selectedLayers;
var setProp = myLayers.property('ADBE Audio Group').property('ADBE Audio Levels');
setProp.setValueAtTime(1, -45);
 
I ultimately want to automatically add small fades to the ins and outs of my selected audio layers as is our post workflow for editing dialogue, but for now I'd just be happy being able to address the audio at all.
 
Thank you
This topic has been closed for replies.
Correct answer Tomas B. aka Tom10

As an additional approach for audios adjustment, consider applying Stereo Mixer effect, and setting audio levels in more convenient [0..100] range, where 0 is fully muted, and 100 - full original levels of sound.

 

 

3 replies

Participant
March 2, 2023

Ok so I had the same issue on this matter and I did a heavy research. But the simple solution to your problem is that The audio property is an array which has left and right values.


setProp.setValueAtTime(1, [-45,-45]);

This will work

Cheers!

Tomas B. aka Tom10
Tomas B. aka Tom10Correct answer
Inspiring
February 9, 2021

As an additional approach for audios adjustment, consider applying Stereo Mixer effect, and setting audio levels in more convenient [0..100] range, where 0 is fully muted, and 100 - full original levels of sound.

 

 

Known Participant
February 10, 2021

I suppose that makes it so that you could make your audio adjustemtns as usual,a dn this script would them paste keyframes in a manner that does not interfere with the audio levels youve already dialed in. thank you I think I've sen a script example of this somewhere.

Community Expert
February 9, 2021

selectedLayers is an array. you should add:

for(var i = 0; i < selectedLayers.length; i++) {

    var layer = selectedLayers[i];

    //now address each layer's audio levels property.

}

Known Participant
February 10, 2021

Thank you this is helpful