ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Using expressions to create stepped graph

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jt Pase
Using expressions to create stepped graph
on Feb 20, 2013 at 9:25:10 pm

Hi, I'm trying to achieve a sort of stepped waveform like in the picture attached. I'm planning to use Particular with expressions to guide the movement. Basically I need to visualize frequency, not amplitude of an audio file. So my goal is to be able to manually enter a number, say 50Hhz, and then be able to generate random numbers around that value for the Y position.

I hope that makes sense, any help would be much appreciated, thank you!


Return to posts index

Jt Pase
Re: Using expressions to create stepped graph
on Feb 20, 2013 at 9:27:26 pm

Sorry this is the image I'm trying to reference:

http://static.electro-tech-online.com/imgcache/2935-aug03f3.jpg


Return to posts index

Dave LaRonde
Re: Using expressions to create stepped graph
on Feb 20, 2013 at 10:21:41 pm

That's an image of color bars from a waveform monitor. Any significance?

Dave LaRonde
Former Sr. Promotion Producer
KCRG-TV (ABC) Cedar Rapids, IA


Return to posts index


Jt Pase
Re: Using expressions to create stepped graph
on Feb 20, 2013 at 10:39:32 pm

Thanks for your reply. No there's no significance, I was just after an interesting way waveform and decided to use that to represent frequency. Is it possible to do it with expressions? Many thanks.


Return to posts index

Stephan Walsch
Re: Using expressions to create stepped graph
on Feb 20, 2013 at 11:02:05 pm

Yes, this is possible.
I'd emitt from a light with split dimensions in position. have it move at a constant speed in X via keyframes and on Y have an expression that moves through a noise field with rounded time. something like

value + 1000*noise(Math.round(time))


This should generate a stepping in Y. 1000 is just a random factor that would change the amplitude. An additional factor behind time would change the frequency.
Cheers!

Stephan


Return to posts index

Jt Pase
Re: Using expressions to create stepped graph
on Feb 20, 2013 at 11:34:34 pm

Oh wow! Thanks very much! I now have a stepped graph that's fantastic!



The steps are all different widths at the moment, is there a way to make them all the same width as in the reference?

Thanks very much, I really appreciate your help!


Return to posts index


Stephan Walsch
Re: Using expressions to create stepped graph
on Feb 21, 2013 at 12:22:06 am

actually the steps are all the same width, and you can change that width by changing the factor right after time. the problem lies in my expression moving through the noise field in way to large steps. let's fix this:

----------

amp = 100;
freq = 4;
soft = 5;

value + amp*noise(Math.round(time*freq)/soft)

----------

changing amp will change the height of the spikes, freq changes their width and soft changes how "related" they are to each other. I would recommend linking those three to expression sliders. Play with the "soft" parameter to get a better result. you can move the whole graph by simply changing the Y value of your light emitter.

don't let soft be 0 ;)

Cheers!
Stephan


Return to posts index

Jt Pase
Re: Using expressions to create stepped graph
on Feb 21, 2013 at 1:11:08 am

Thanks so much! That works beautifully.

If I may just bother you with a further question please. In this reference:


On the right side of the image, there are graduated bars that descend from the peak of the graph. I tried achieving that by emitting auxiliary particles but of course they're emitted in turn and so they don't fall as a uniform bar but more like a continuous cascade.

I'm guessing that I need to be able to read when the Y value hits a peak / plateau, and then tell another emitter to emit a block right at that point. Does that sound right to you?

Thanks so much for your help!


Return to posts index

Stephan Walsch
Re: Using expressions to create stepped graph
on Feb 21, 2013 at 1:32:09 am

auxillary particles sound okay, try really cranking up the gravity so they fall down fast and then cut them off with a mask at the bottom.

this will be a big performance hit though...

If you only want bars with alternating height next to each other just duplicate a bunch of solids and wiggle their Y position. If you wiggle with no frequency they won't move:

-------
amp = 100;
w = wiggle(0,amp);
[value[0],w[1]]
-------


Cheers!
Stephan

-------
Freelance
Motion Graphics / Grading
Berlin - Germany


Return to posts index


Jt Pase
Re: Using expressions to create stepped graph
on Feb 21, 2013 at 12:36:13 pm

Thanks very much for your reply!

I actually need to fill the area under the line created by the stepped graph rather than creating the solids on their own.

Using aux particles I get this effect:



Because they are emitted in order there's a sloping / cascading effect.

Can I check with the code you've kindly provided for the line, is there a way to stop any movement in the x axis when the line is travelling in the y axis? So that I end up with straight vertical lines between each bar graph?

hope I'm making sense,thanks ever so much for your help!


Return to posts index

Jt Pase
Re: Using expressions to create stepped graph
on Feb 21, 2013 at 6:26:23 pm

Hi,

I'm having a problem keying the parameters with this code. Animating the freq, amp or soft variables gives me really jerky and weird animation, where the entire graph will suddenly expand or jump. Is there something I'm doing wrong please?

Thanks very much!


Return to posts index

Stephan Walsch
Re: Using expressions to create stepped graph
on Feb 22, 2013 at 1:24:14 am

I think particular isn't the right choice if you want to have the whole graph respond to keyframe changes, since it's created in sequence. especially keyframing the frequency will definitely create jumps. amp should be fine though. If you're using cs6, there are still some bugs with particular and the disk cache, so emptying that from time to time could help.

you could approach this from another angle by using shape layers but at this point I would need to know a bit more about what exactly you are trying to achieve?

Cheers!
Stephan

-------
Freelance
Motion Graphics / Grading
Berlin - Germany


Return to posts index


Jt Pase
Re: Using expressions to create stepped graph
on Mar 5, 2013 at 12:33:52 pm

Thank you very much for your help on my problem. Luckily in the end, my client just decided to go for a more accurate visualization so I ended up using audio beam which is much simpler. I've attached a frame of what I ended up.



I haven't solved the problem of using particular, I would actually think that since the particle has been already emitted, changing the amp or frequency parameter should only change future particles so I didn't expect the weird behavior I got.

In any case, that's a bridge I shall cross if I have to do something similar in the future. Thanks very much for your time and help on this, it's much appreciated!


Return to posts index

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