Copy link to clipboard
Copied
I need help with an expression...i took a solid applied sound keys to it the parented the values of sound keys to rotation of the circle i took and gave it expression
//
p=thisComp.layer("sk").effect("Sound Keys")("Output 1")
t=(time*100)
if (p>0) p+t;
else
t
//
My main motive is to start the rotation when the beat drops(in short when the soundkey gets value more the 1) and when the beat drops the circle should start rotating and slowly coming back to rest until another beat drops and also the circle should keep rotating in the same direction.....basically rotation the object on the beat but it should be smooth not like jerk....it should be like giving a push to the free rotating wheel which eventually comes in rest slowly until another force is applied to it....(the force m talking about is the value of the soundkeys).The expression is at armature stage,,,Your contributions will be graceful.
Copy link to clipboard
Copied
Use the Ease expression on the result, this can be use to define the value range as well as soften the result ever so slightly.
so on your second line something like;
e = ease(p,100,120, 300,350)
on subsequent lines replace p with e
Copy link to clipboard
Copied
its not helping things....now its not even stoping..its just doing what (time*100) does.
is there any other way to do it?
Copy link to clipboard
Copied
I haven't got time to write it for you but there are errors in your thinking and in your expression. The first line has no "Slider" so it's not pointing to anything.
Here's the logic you should follow:
I hope you can figure this out. It might take me a half-hour or more digging through reference materials to come up with an accumulator Even when the errors in your expression are fixed it is not going to do what you want it to do what you describe without a fair amount of additional code. It's also going to be recursive so the render time is going to increase exponentially as you move down the timeline. If you post this question in the AE Expressions forum (find it in the menu bar) you might be lucky enough to have Dan Ebberts see the post and volunteer a solution. I don't know anybody else that could write the required code without referring to reference materials or opening up AE and trying a few things.
Copy link to clipboard
Copied
Hello rick thank you so much for taking time to contribute your ideas to the members....actually i tried the thing you said but its not giving the output i want.Just want to clarify your confusion that you misunderstood the way m trying get things done.The thing is to get values for any audio track,we use 2 ways :-
1) Convert audio into key-frames which is by right clicking on the audio track and selecting the option {Convert audio into key-frames}
2)By using Red giant trapcode sound keys,were u take a solid and apply the soundkeys effect and select your audio layer in the effect control panel( to get accuracy of required beats ) ,at the end the solid having soundkeys effect will produce the output keyframes (just like convert to keyframes does)..which is what i took
In the expression i posted the layer is called "SK" and not slider like you assumed.
so i guess its all right except the missing line which will actually give me the correct output by easing things...
for your reference m attaching a video just have a look.
or
Dan Ebberts​angie_taylor​ also for you..
Copy link to clipboard
Copied
I did understand exactly what you were trying to achieve with rotation and I explained that you have to create an accumulator to that the value you are getting from Audio Amplitude or Sound Keys starts to decrease the rotation stops, then when it starts to increase again the rotation continues. I just can't write that kind of code without a bunch of fiddling and checking the reference materials. I would be surprised if Dan Ebberts could not do it in just a few minutes.
The logic goes something like this:
ALev = audio level;
if (the ALev value of the previous frame < the ALev value of the current frame) {
increase the rotation by a percentage of the difference between the ALev}
if (the ALev value of the previous frame > the ALev value of the current frame) {
rotation = the rotation value of the previous frame}
As I said, I could not do that without a fair amount of research and experimentation, but that is the idea.
I did miss that you were using Sound Keys and incorrectly assumed you were using Audio Amplitude which does generate a slider.
So did you get the problem solved? Just easing the value of Output 1 is not going to keep the rotation from changing direction. Did I incorrectly assume that you wanted to keep the rotation to always be counter-clockwise as it is in the video?
Copy link to clipboard
Copied
Rick Gerard No i didnt got the problem solved ,m still trying to crack this...
And yes rick you assumed it correct that i want the rotation always in counter clockwise.
lets see what i do....The video i showed was also taken down from the YouTube ( Don't know may be copyright issues) or else i would have surely contacted the Editor . Thanx for the logic you explained...if you crack it let me know please.
Copy link to clipboard
Copied
Try posting the question on the Adobe After Effects Expressions Forum. Dan Ebberts could probably write the code in about 2 minutes.
Copy link to clipboard
Copied
ok will do that
Copy link to clipboard
Copied
If you look at Dan's site, http://motionscript.com you'll find a section on frequency and speed control. The expression he applies to time remapping could be used with rotation. I don't have time to fiddle with it completely understand how it works but if you modify that expression as follows you get something close to what you want, a constant rotation modified by the keyframe values. If you are still using sound keys then the expression would look like this:
spd = thisComp.layer("sk").effect("Sound Keys")("Output 1");
mult = -10; // controls speed and direction of rotation
n = spd.numKeys;
if (n > 0 && spd.key(1).time < time){
accum = spd.key(1).value*(spd.key(1).time - inPoint);
for (i = 2; i <= n; i++){
if (spd.key(i).time > time) break;
k1 = spd.key(i-1);
k2 = spd.key(i);
accum += (k1.value + k2.value)*(k2.time - k1.time)/2;
}
accum += (spd.value + spd.key(i-1).value)*(time - spd.key(i-1).time)/2;
}else{
accum = spd.value*(time - inPoint);
}
value + accum*mult
That will get you close and maybe you can figure out where to go from there to get more control. This is the accumulation method I was talking about. Take some time to read Dan's page and maybe you'll get some more ideas on how to get more control on how it works with rotation.
Copy link to clipboard
Copied
Obviously you also need to experiment with the numbers used in the Ease expression. Don't use the numbers I wrote, these are just example numbers. To find out the range you need, go to the Info panel in AE, click on the sound keys KF and you should see the Min and Max values displayed. These are the first two numbers you'll need in the Ease parenthesese. I'd suggest using sliders for the second two values as you can then adjust these easily while watching it loop in real time till they reach the correct value.
Also, have you tried using the Sound Keys settings to dampen the effect and adjust the interpolation? It sounds like you could adjust the interpolation settings there to help without having to worry about expressions? The Range Falloff setting should allow you to control how the values change from and "on" state to an "off" state.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now