ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

counting bars and notes with expressions from a known bpm

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sam Pauwels
counting bars and notes with expressions from a known bpm
on Jan 19, 2020 at 2:10:03 pm

Hi there,

I'm looking for an expression that counts up on every beat or bar or note from a known bpm. So I can just put in the bpm, and my text layer spits out 1,2,3,4,... on every sort of measure I would like.
Exactly like in this video:





thank you and cheerz
sam

Sam Pauwels


Return to posts index

Tomas Bumbulevičius
Re: counting bars and notes with expressions from a known bpm
on Jan 20, 2020 at 8:12:01 am

Hey Sam, what might be the possibilities, that this execution uses external data, with all notions of params?

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview


Return to posts index

Alex Printz
Re: counting bars and notes with expressions from a known bpm
on Jan 20, 2020 at 2:41:19 pm

place this onto a null property that you want to animate (I usually use it to generate a Tone); you will need two sliders, one for the beats per minute, and one for the number of beats in a measure.

Note that if your framerate doesn't work well with the BPM you've chosen, it might get messy and/or bleed between frames.

There are 3 outputs possible; Z (off), Y (minor beat), and X (major beat); set them to whatever you want and/or manipulate the code.

s = effect("BPM Slider")(1);
m = effect("Number of beats per measure")(1);

X = value;
Y = value/5;
Z = 0;

b = 60/s; //convert to seconds
d = thisComp.frameDuration;
t = time-inPoint; //current time

e = (d+(s/2000)); //slop for error

function p(x){ //previous frame value
return thisProperty.valueAtTime(Math.ceil(time-framesToTime(x))) };

if( (t/b) %1 <e && p(1) != 0) //if current frame for beat
((t/(b*m)) %1 <e && p(1/s) != 0) ? X : Y; //if major or minor beat
else Z; //else off


Alex Printz
Mograph Designer


Return to posts index

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