ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Convert audio to keyframes then select all those below a given value ?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Peter DexterConvert audio to keyframes then select all those below a given value ?
by on Mar 10, 2014 at 9:50:32 pm

HI
Just wondering here if there was a method by which one could select keyframes of a property by their value.
Similar to selecting 'of equal value' but instead to select all keyframes below lets say a value of 20.
I am looking to use 'Audio to keyframes' and then tweak my resulting keyframes.
The returned values are all rather close.. from around 14 - 29 and each is different 29.1342 or 29.1346 so so it would be nice to create an on and off type result using those key frames. I know sound keys does something similar but just wondered if there was a way to 'cheat' that in AE.
To sum up. I want to be able to change all the keyframe values that are higher than 20 to a chosen value and all those above 20 to another chosen value.
Hope that makes sense and thanks in advance for any help :)

We spent all the budget on doughnuts and now we have no money to make our film.


Return to posts index

Walter SoykaRe: Convert audio to keyframes then select all those below a given value ?
by on Mar 11, 2014 at 12:03:35 am

This is very easy with an expression.

Alt-click the stopwatch for the property with the keyframes (such as Both Channels) and enter the following expression:

if (value > 20) 100 else 0;

Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog - What I'm thinking when my workstation's thinking
Creative Cow Forum Host: Live & Stage Events


Return to posts index

Peter DexterRe: Convert audio to keyframes then select all those below a given value ?
by on Mar 11, 2014 at 8:54:41 am

Thanks a lot. It is indeed simple and elegant.
Thanks

We spent all the budget on doughnuts and now we have no money to make our film.


Return to posts index


Peter DexterRe: Convert audio to keyframes then select all those below a given value ?
by on Mar 11, 2014 at 9:24:15 am

Thanks again that is great. Just one little thing. I used action script 2 years ago quite a bit so it is all rather vague these days. I am sure that I can use that little snippet and tweak it.

I want to use it with a slider and an existing expression.

I have this on my slider: effect("Both Channels")(1)
and this on my opacity property: thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")

If you had an example how to integrate the: If (value > 20) 100 else 0:
In either of those lines it would be great.

Also to extend the if else so that: if greater than twenty but less than twenty five 100 if greater than 25 80 else 0

That would make my day. I think I could roll from there and then find a good basic expressions page somewhere to embeish.

Expressions are addictive :)

We spent all the budget on doughnuts and now we have no money to make our film.


Return to posts index

Roland R. KahlenbergRe: Convert audio to keyframes then select all those below a given value ?
by on Mar 11, 2014 at 10:02:21 am

This should do it -

propVal = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");

if (propVal > 25) {
80
} else if (propVal > 20 && propVal < 25) {
100
} else {
0
}


I've found this URL a good resource for Javascript Conditionals - http://stackoverflow.com/questions/253030/best-way-to-format-if-statement-w....

http://www.w3schools.com/ is also good.

HTH
RoRK
Latest AE Workshop - MoGraph Intensity - Shapes & Text

Intensive mocha & AE Training in Singapore and Other Dangerous Locations

Imagineer Systems (mocha) Certified Instructor
& Adobe After Effects CS6 ACE/ACI


Return to posts index

Peter DexterRe: Convert audio to keyframes then select all those below a given value ?
by on Mar 11, 2014 at 9:41:16 pm

Thanks very much.
I will for sure make a visit to the site mentioned

We spent all the budget on doughnuts and now we have no money to make our film.


Return to posts index


Roland R. KahlenbergRe: Convert audio to keyframes then select all those below a given value ?
by on Mar 12, 2014 at 12:27:28 am

I've just realized that there is an issue with the script if the referenced value is at exactly 25. Currently, a value of 25, for the referenced property, will result in an opacity value of 0.

If that is not intended behavior, then add an = sign to either one of the two explicit conditionals in the script - something like this:

if (propVal >= 25) OR
(propVal > 20 && propVal <= 25)

HTH
RoRK
Latest AE Workshop - MoGraph Intensity - Shapes & Text

Intensive mocha & AE Training in Singapore and Other Dangerous Locations

Imagineer Systems (mocha) Certified Instructor
& Adobe After Effects CS6 ACE/ACI


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]