Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
trioptic
Topic Author
Posts: 6
Joined: Sat May 21, 2005 10:17 am
Contact:

video "scratching" effect

Sat Aug 06, 2005 5:31 am

I realize this is so incredibly simple, but it works well, with many diff techniques:

maxAmp = 30;
minAmp = 1;
spanAmp = maxAmp - minAmp;
incAmp = sqrt(spanAmp);

if(varAmp < spanAmp/2){
  (varAmp / incAmp) - incAmp;
} else {
  (varAmp / incAmp) + incAmp;
}


basically maxAmp is the highest amplitude you want the code to react to. anything higher than maxAmp will be treated the same as maxAmp. varAmp (which is not assigned by the code) is your INPUT. so that would be audio1.level or whatever.

inAmp divides everything up evenly, so in case your amp is higher than 30, the code will adjust accordingly.

put this code in your time-remap layer. (some playing with would probably be required for a special look).

.. more comin soon
Image
 
afaj
Posts: 5
Joined: Fri Feb 02, 2007 9:30 pm

AF rejects expression

Sat Feb 03, 2007 11:41 am

When trying to use this expression text I get the message:

"Function sqrt is undefined. Expression disabled."

Any ideas? Thanks.
 
Colin Braley
Posts: 13
Joined: Thu Jul 14, 2005 7:33 pm
Location: VA
Contact:

Sat Feb 03, 2007 1:56 pm

Try this instead:

maxAmp = 30;
minAmp = 1;
spanAmp = maxAmp - minAmp;
incAmp = Math.sqrt(spanAmp);

if(varAmp < spanAmp/2){
  (varAmp / incAmp) - incAmp;
} else {
  (varAmp / incAmp) + incAmp;
}
 
afaj
Posts: 5
Joined: Fri Feb 02, 2007 9:30 pm

Sat Feb 03, 2007 2:15 pm

Colin,

This time I get the error message: "Class 'Layer has no property or method named 'varAmp'. (error occured at line six).

Who is online

Users browsing this forum: No registered users and 2 guests