Music Keyframes
Moderator: byronnash
-
- Posts: 6
- Joined: July 3rd, 2005, 1:03 am
- Location: Los Angeles
- Contact:
I'm looking for a way to write audio keyframes for the bass, mids, and treble of a song automatically. I have been using the hi/lo pass filter and making the audio keyframes manually for each band, but there has to be a better way, I would love to be able to break it into 5/7/9 bands and start animating a visual eq or trying to mimick some winamp visual. I am just learning scripting, so please let me know if this should be in the Expression requests forum.
-JV
There doesn't seem to be a way in scripting to Convert Audio to Keyframes. You could write a script to handle the High/Low filter though.
-
- Posts: 6
- Joined: July 3rd, 2005, 1:03 am
- Location: Los Angeles
- Contact:
That's what I suspected. I know there's lots of software out there to sync visuals to music, but I'm determined to do it througf AFX.
Could you get me started with a script to duplicate an audio layer (let's say ~3 times) with the hi/lo pass filter applied to each layer at different bandwidth settings for each layer? I'm sure I could modify it once I see how you write the code, I just can't find any scripting tutorials anywhere including effects.
Could you get me started with a script to duplicate an audio layer (let's say ~3 times) with the hi/lo pass filter applied to each layer at different bandwidth settings for each layer? I'm sure I could modify it once I see how you write the code, I just can't find any scripting tutorials anywhere including effects.
-JV
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
Here's a script that duplicates selected audio layers and adds the High-Low Pass effects.
Paul T
Paul T
Code: Select all
{
// Three Pass Audio Split
// Paul Tuersley, Aug 2005.
function threePassAudio(lowLayer) {
// duplicate the layer twice
var highLayer = lowLayer.duplicate();
var midLayer = lowLayer.duplicate();
// shorten layer name if too long
if (lowLayer.name.length > 27) {
lowLayer.name = lowLayer.name.substring(0,28);
}
// rename all three layers
highLayer.name = lowLayer.name + "_HI";
midLayer.name = lowLayer.name + "_MD"
lowLayer.name += "_LO";
// add effects to the duplicated layer
var highEffect = highLayer.Effects.addProperty("High-Low Pass");
var midHighEffect = midLayer.Effects.addProperty("High-Low Pass");
var midLowEffect = midLayer.Effects.addProperty("High-Low Pass");
var lowEffect = lowLayer.Effects.addProperty("High-Low Pass");
// rename the effects
highEffect.name = "High Pass";
midHighEffect.name = "High Pass";
midLowEffect.name = "Low Pass";
lowEffect.name = "Low Pass";
// set effect values
highEffect.property(2).setValue(1000);
midHighEffect.property(2).setValue(400);
midLowEffect.property(1).setValue(2);
midLowEffect.property(2).setValue(1000);
lowEffect.property(1).setValue(2);
lowEffect.property(2).setValue(400);
}
// main script
var activeItem = app.project.activeItem;
// check that a comp is active
if (activeItem == null || !(activeItem instanceof CompItem)) {
alert("Select a layer with audio before running this script");
} else {
var foundAudio = false;
var selectedLayers = activeItem.selectedLayers;
// loop through selected layers, checking for audio
for (var i = 0; i < selectedLayers.length; ++i) {
var curLayer = selectedLayers[i];
// if layer has audio, beginUndoGroup and loop again
if (curLayer.hasAudio) {
foundAudio = true;
}
}
if (foundAudio) {
app.beginUndoGroup("Three Pass Audio Split")
// loop through selected layers
for (var i = 0; i < selectedLayers.length; ++i) {
var curLayer = selectedLayers[i];
// if layer has audio, run the threePassAudio() function
if (curLayer.hasAudio) {
threePassAudio(curLayer);
}
}
app.endUndoGroup();
} else {
alert("Select a layer with audio before running this script");
}
}
}
-
- Posts: 6
- Joined: July 3rd, 2005, 1:03 am
- Location: Los Angeles
- Contact:
Thanks so much Paul. You're the man! as childish as it may sound... I can finally make a graphic EQ for any song with a little efficiency and a bit more control. And not only can I achieve my goal, but now I can finally begin to see how scripting language works. For some reason the online stuff on scripting wasn't as easy to understand as expressions, but something about this custom made recipe has turned on a light that has revealed much. Sweet!
-JV