Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ROTATION ON BEAT USING SOUND KEYS.

Community Beginner ,
Jul 25, 2019 Jul 25, 2019

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.

2.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 25, 2019 Jul 25, 2019

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 26, 2019 Jul 26, 2019

its not helping things....now its not even stoping..its just doing what (time*100) does.

is there any other way to do it?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 26, 2019 Jul 26, 2019

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:

  1. Open the graph editor and select value scale, then select Audio Amplitude>Both Channels>Slider and make a decision on the values you want to use to trigger the animation. A typical value would be something like 10 for the start and 40 for the high. It all depends on your waveform
  2. use the easeIn(t, tMin, tMax, value1, value2) to set up the rotation values. If you define the slider as t then the r, for rotation expression would look like this if you wanted to have the rotation value increase by 45º each time the threshold min and max values were reached: r = easeIn(t, 10, 40, 0, 45). Now every time the level passes 10 on the way to 40 the r value would increase from 0 to 45. Does that make sense
  3. Then you throw in an accumulator function, something I can't write without checking references, to store the accumulated r values over time. Dan Ebberts could write that in a couple of seconds, but I would need to check references.
  4. If you want the trigger level, say 10, to start the rotation and have it increase to the maximum value before the level falls below 10 next time you have a lot more complexity to include.

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 02, 2019 Aug 02, 2019

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.

https://file.io/T0hQzp

or

WeTransfer

Dan Ebberts​angie_taylor​ also for you..

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 02, 2019 Aug 02, 2019

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 03, 2019 Aug 03, 2019

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 03, 2019 Aug 03, 2019

Try posting the question on the Adobe After Effects Expressions Forum. Dan Ebberts could probably write the code in about 2 minutes.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 03, 2019 Aug 03, 2019

ok will do that

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 03, 2019 Aug 03, 2019

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 18, 2019 Sep 18, 2019
LATEST

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.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines