ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

NEED GUIDANCE! with expression scripting!

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Daniel Nam
NEED GUIDANCE! with expression scripting!
on Oct 12, 2018 at 8:05:50 am

12788_newenew.mov.zip
if no download video can be found here
https://www.reddit.com/r/AfterEffects/comments/9nibid/need_help_with_script...

I am trying to make the red box to be displayed by all the falling notes hitting the piano but as you can see it only recognizes the top part.



This is the pitch slider graph from the midi file imported (This is the chord data in dots but the values are always the peak values at that time)



This is the expression I used for the shape layer (red rectangle)
transform.position + 21.5*(0,thisComp.layer("midi").effect("ch_0_pitch")("Slider")-60)
the midi note value for the far left piano is 21 to far right piano 108
The position of the rectangle starts at midi note value 60 which is the middle c (one white key to the left from the video preview thumbnail)


Return to posts index

Kalleheikki Kannisto
Re: NEED GUIDANCE! with expression scripting!
on Oct 13, 2018 at 7:39:42 am

It seems to me it would be way easier to use the piano roll of the notes and a small area right above the keyboard to see which notes are being hit. For example, a combination of keylight to pull out the green and blue areas and then a mask or track matte to limit it to a small area above the keyboard. Then you can stretch the result and fill it with red.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Daniel Nam
Re: NEED GUIDANCE! with expression scripting!
on Oct 13, 2018 at 3:44:01 pm

What I am actually trying to replicate is this






when the note hits the piano roll, after effects plays combination of 'particular' effects.
I was demonstrating it with red rectangle just for testing with faster rendering.
Could you elaborate what you mean by 'easier to use the piano roll of the notes and a small area right above the keyboard to see which notes are being hit'
By the way, the background with the green and blue box and piano roll is

this app called synthesia. I just screen recorded the app and imported it into AE.


Return to posts index


Kalleheikki Kannisto
Re: NEED GUIDANCE! with expression scripting!
on Oct 14, 2018 at 10:16:01 am

Ok, in that case it makes even more sense to do it in the fashion I described, as you can then use the result in Particular as a layer emitter. I'll put a dummy project together for you, that's easier than a long-winded explanation.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Kalleheikki Kannisto
Re: NEED GUIDANCE! with expression scripting!
on Oct 14, 2018 at 10:58:18 am
Last Edited By Kalleheikki Kannisto on Oct 14, 2018 at 11:08:53 am

Here's a dummy project using your still image as source. I don't have the latest version of Particular, but this should translate over nonetheless. If you don't have Optical Flares, turn that layer off. If you do, that gives you the light glow as the keys are being played. If you get a "missing footage file" in the project, that is the still image of the piano roll you uploaded, just use that.

12803_pianorolldummyproject.aep.zip

Looks like this (shortened version)

12804_pianoroll.mp4.zip

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Daniel Nam
Re: NEED GUIDANCE! with expression scripting!
on Oct 15, 2018 at 5:13:38 am

Wow, at first I did not know what you meant by keylighting but this is a lot simpler than i thought!!
I do not even need to import the midi info.... I spent 5 days trying to figure out LOL
THANK YOU SO MUCH FOR THE DUMMY FILE! YOU ARE MY HERO!

P.S
If I want to use the actual video footage of the still image posted above, can I just import the video file on the project?


Return to posts index


Kalleheikki Kannisto
Re: NEED GUIDANCE! with expression scripting!
on Oct 15, 2018 at 8:26:05 am

Quite likely you don't need Keylight to do this, you can probably use one of the RGB channels in the piano roll footage and get a cleaner black and white output of the notes from it.

I had to animate the still image, so you need to take out the position keyframes after replacing with video. I don't know if it works directly, the still image is not the same resolution nor dimensions as the comp, so you may need to adjust accordingly.

The important thing is to end up with a slice of the piano roll right above the keyboard, white pieces over transparent, that way you can use it as the emitter for both Particular and Optical Flares.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Daniel Nam
Re: NEED GUIDANCE! with expression scripting!
on Oct 16, 2018 at 8:20:27 am

Thanks to your help, I was able to create the video footage.
I have one more question for you.
The prticular particles do not show unless I set the prticles to 100,000+ (Video size is 1920x1080).
Is having that many particles usual? Because it seems to slow down rendering time by a lot.
(I want to layer at least three particular effects but i barely see the particles unless they are all 100,000+)


Return to posts index

Kalleheikki Kannisto
Re: NEED GUIDANCE! with expression scripting!
on Oct 16, 2018 at 9:28:38 am

Yes, that is expected, and is the down side in using a layer emitter. The entire layer is used as an emitter, but particles get their original settings from the layer, so transparent parts produce transparent particles. On that count, if you know the maximum area the particles will be visible in, you can possibly make a solid that only covers that area for your Particular layer. Never actually tried it, but I believe it could work. (The emitter comp dimensions may or may not need to be adjusted to match the dimensions of the Particular solid.)

I would personally render each Particular pass separately and combine the outputs in another comp. That's usually faster than running multiple Particulars at the same time.

---

Now, it would be possible to get a similar end result with a light emitter for every piano key with a pixel-sampling expression to determine whether the key is being pressed or not, but in my experience that is just as slow to render, since you have 64 keys to deal with here, so that would involve 64 pixel sampling expressions running in each frame.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index


Daniel Nam
Re: NEED GUIDANCE! with expression scripting!
on Oct 17, 2018 at 8:07:19 pm

If i make a pre-comp of multiple layers of particular effects, Is it possible to have that pre comp emit layer or is it only possible with one particulr effect?


Return to posts index

Kalleheikki Kannisto
Re: NEED GUIDANCE! with expression scripting!
on Oct 19, 2018 at 6:11:48 pm

The layer emitter will have to be selected separately for each instance of Particular. You won't be able to precomp multiple instances of Particular and use a layer emitter that is outside that precomp.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Daniel Nam
Re: NEED GUIDANCE! with expression scripting!
on Oct 21, 2018 at 7:00:46 am

Thank you!
I just added layers to do multiple effects! It takes little more time to render but I am really satisfied with the result!
I have one more question!

Like the picture above, I want to make my piano keyboard light up with the shadows from the black keys.
When I record a video with top-down angle and add optical flare effect, it lights up the background but does not create shadows of the black piano keys like the picture above.
I think this has to do something with 3d.. stuff.
Is this possible to do in after effects?


Return to posts index


Kalleheikki Kannisto
Re: NEED GUIDANCE! with expression scripting!
on Oct 21, 2018 at 8:12:17 am
Last Edited By Kalleheikki Kannisto on Oct 21, 2018 at 8:14:03 am

Possible, yes; easy, no.

Had I known at the start you wanted to include that effect as well, I would have steered you toward the more complicated route of having a row of lights at the top of the keyboard, because you could use it for this effect.

I can think of two ways to accomplish a resemblance of this in AE without any extra plugins or 3D:

0A) In either case, you need a layer with just the black keys on it. A white solid with masks for each of the key would work.
0B) In either case, you need a point at the top of each key (black and white) where you sample the black and white piano roll emitter layer with a sampleImage() expression to determine if it is black or white (round it to one or the other). You could attach this expression to a row of nulls, each null sampling the point directly behind it.

1A) In option one you would also have a light source at the location of each of the keys, at the top, which would light up depending on the value of the sampleImage() at the previous step
1B) The white solid from 0A would have to be a 3D layer, and you would need another white solid layer behind it to catch the shadows from the keys. Making the solids white allows you to composite the over the keyboard in Multiply mode to get the shadows. (If that doesn't work too well, you can try gray solids and Overlay mode or even dark gray solids with Screen or Add.)

2) It might be possible to do this with a series of CC light rays effects, the centers of each placed in the same fashion at the top of each key and triggered by the sampleImage() results and using the black-keys solid to generate shadows. The layers would be 2D in this case. It would be a more complex matter to get an output that you can overlay on the keys. My guess is it would have to be in the Add transfer mode.

I'd personally go with the lights solution, knowing with greater certainty that it would work.

It is not going to be a simple operation either way.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Kalleheikki Kannisto
Re: NEED GUIDANCE! with expression scripting!
on Oct 21, 2018 at 8:27:23 am

This concurrent thread in the expression forum has a pretty ready-looking solution for the sampleImage() code you need
https://forums.creativecow.net/thread/227/40057

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Gould Lin
Re: NEED GUIDANCE! with expression scripting!
on Nov 7, 2018 at 11:02:43 am

Hi ~~
may I ask how to use optical flares to create the shiny blink point like the following fugure?
Is it possible to created only by optical flares?
Or need some extra effect (plugins) ?


Return to posts index

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