To rhythm a video according to a sound

Moderators: Disciple, zlovatt

FStop
Posts: 2
Joined: March 18th, 2008, 6:22 pm

I know this is quite an old post, however I signed up for this forum because I've gotta say this expression has blown my mind. Check out this video I made with it last night, also tying in opacity to certain keys:

http://www.youtube.com/watch?v=Duqet_xBXBY

I haven't really played around too much with expressions but I'm obsessed now. I wish I'd taken more math in school, but I'm going through tutorials now. this is obviously a rough video and next I'm going to plug in this expressions to trapcode Form / Particular, I'm looking forward to seeing what it can do.

I also have a question - could anyone kind of break this expression down into what it's doing? how would I go about modifying the "default" playback rate or adding my own mods to it?
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

I didnt write this expression, but I will try to break it down based on just looking at it.. the calculations get a little hard to follow but hopefully it will help you on your quest to understand what is happening.

-Lloyd

Code: Select all

t=timeToFrames(inPoint);  //convert the inPoint from time to frames and set it to the variable t
i=0;  // initialize variable i

// this while loop says that as long as the current time (converted to frames) 
// is greater than or equal to the inPoint (t); it should continue processing
while(timeToFrames() >= t)   
{
min=effect("frequence min")(1).valueAtTime(framesToTime(t));  //define the min freq value, read the value at time t
max=effect("frequence max")(1).valueAtTime(framesToTime(t));  //define the max freq, read the value at time t
a=effect("frames")(1).valueAtTime(framesToTime(t)); //define a as the frame at time t
f=thisComp.layer("Audio Amplitude").effect("Both Channels")(1).valueAtTime(framesToTime(t));  //read the amplitude value at time t

 // if the amplitude is greater than or equal to the min freq and lesser than or equal to the max freq
// then i should be incremented by 1 minus a which is the frame at time t
if(f>=min && f<=max){i+=1-a} 

t++;  //advance t 1 frame
}
timeRemap.valueAtTime(time-framesToTime(i))   // subtract the time of frame i from the current time and display the resulting frame
oscarus
Posts: 9
Joined: July 12th, 2004, 4:35 pm
Location: Paris
Contact:

Hi FStop,
Bravo for your video, the result is nice .
My English is not very good, that's why I don't often speak in this discuss.
__________________________
http://oscarvideo.free.fr
FStop
Posts: 2
Joined: March 18th, 2008, 6:22 pm

Hey, you guys might enjoy this one too, I've refined it a little bit and figured out how to get multiple eq bands for several trigger points. this one's just using three; bass, piano and snare affecting camera position, time remapping and shine, respectively. The footage is from night of the living dead.

http://www.youtube.com/watch?v=TQfvo9-K ... re=related

again thanks for your work oscarus!

in reference to someone who asked me a question on youtube - all you'd need to do to let your audio keys trigger opacity or gaussian blur is the following expression, modified for your effects. copypasta the expression to your effect, then highlight the red text and pickwhip to the sound keys output layer.

put this expression in Opacity/Blur/etc amount:
x=thisComp.layer("Audio Amplitude 1").effect("Output 2");
linear(x,11,25,1,100)

the linear expression basically converts between value scales. What this is saying is that when a graph of the audio output goes between 11 and 25, the opacity will fade from 1 to 100 in a linear manner. you can also use ease(X,1,2,3,4) for a falloff curve

You can do almost anything with this, including converting between x,y values or camera rotational position.
oscarus
Posts: 9
Joined: July 12th, 2004, 4:35 pm
Location: Paris
Contact:

Hello, I modified lightly my expression that we obtain a best result, easier and faster ! 8)
I changed my approach, rather than to examine music by fame as in the previous expression, I divided by level and the expression is far more effective. I made a tutorial (in french) in which I explain how this new expression and how proceed quickly to get a good result. You can watch here :http://www.weecast.fr/after-effects/ryt ... ,9144.html
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

@Llyod: So how do I use this expression?

Do I place it in a time remap field?

I discovered that I need to create 3 slider controls frequence min, frequence max, and frames. How do I use them? Is the frequency in hertz? What is frames for?

...Meanwhile...

After reading higher up in the threads, I got to this page 3 via a search, I gain a bit more understanding about the expression. frequency min and max are really misleading. They should be labeled amplitude min and max because they have nothing to do with the frequency of the wave file.

I still find this expression a bit difficult to tame. I am audio engineer so I have some really clean high end audio files, but I can't get smooth motion out of this beast.

I set my min and max values based upon the values I see in the Audio Amplitude graph channel and I set my frames to -3. I do get an effect, but it is not great.


What is the trick?
"Up And Atom

No...No

Up And At Them!"
oscarus
Posts: 9
Joined: July 12th, 2004, 4:35 pm
Location: Paris
Contact:

Hello Atomic :D ,
You're right, the word frequency has been badly chosen, and I actually use the max and min amplitude. I improved the expression for the result is easy to tame, I explained in my tutorial videos here: http://fr.tuto.com/after-effects/rythme ... ,9270.html
Or here: http://fr.tuto.com/after-effects/rythme ... ,9144.html
Oscarus
-------------------------------------------------- ------------------------
Site: http://oscarvideo.free.fr
email: oscarvideo@free.fr
tel: 0164221523
-------------------------------------------------- ------------------------
TeddyNall
Posts: 1
Joined: April 19th, 2011, 7:51 am

oscarus wrote:Hello Atomic :D ,
You're right, the word frequency has been badly chosen, and I actually use levitra the max and min amplitude. I improved the expression for the result is easy to tame, I explained in my tutorial videos here: http://fr.tuto.com/after-effects/rythme ... ,9270.html
Or here: http://fr.tuto.com/after-effects/rythme ... ,9144.html
Oscarus
That was ver interesting to watch, really knowlegeble.
Post Reply