Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects NEED GUIDANCE! with expression scripting!

  • NEED GUIDANCE! with expression scripting!

     Gould Lin updated 3 years, 6 months ago 3 Members · 15 Posts
  • Daniel Nam

    October 12, 2018 at 8:05 am

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

    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)


    NEED HELP! with scripting! from AfterEffects

  • Kalleheikki Kannisto

    October 13, 2018 at 7:39 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

  • Daniel Nam

    October 13, 2018 at 3:44 pm

    What I am actually trying to replicate is this

    https://youtu.be/H1Dvg2MxQn8
    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.

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

  • Kalleheikki Kannisto

    October 14, 2018 at 10:16 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

  • Kalleheikki Kannisto

    October 14, 2018 at 10:58 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

  • Daniel Nam

    October 15, 2018 at 5:13 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?

  • Kalleheikki Kannisto

    October 15, 2018 at 8:26 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

  • Daniel Nam

    October 16, 2018 at 8:20 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 1920×1080).
    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+)

  • Kalleheikki Kannisto

    October 16, 2018 at 9:28 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

  • Daniel Nam

    October 17, 2018 at 8:07 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?

Viewing 1 - 10 of 15 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy