FORUMS: list search recent posts

Best way to create an 88-key piano (incl. pressed keys) without many layers / low render time?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Shahid Raza
Best way to create an 88-key piano (incl. pressed keys) without many layers / low render time?
on Jul 2, 2017 at 10:11:50 pm
Last Edited By Shahid Raza on Jul 2, 2017 at 10:31:40 pm

In case anyone missed my last project, here is where I left off with this: https://redd.it/5pdszq

I'm looking at trying to make the piano as efficient as possible with less render time before I move onto other bits for it like the piano roll etc.

Originally I added a piano background to the comp and each individual active key was a separate layer (88 layers). The expressions got really messy.

The idea I have in mind is to only use 12 keys (C, C#, D, D#, E, F, F#, G, G#, A, A#, B) and repeat this in the comp to create the 88 keys. Something like this: http://oi64.tinypic.com/2ekriaf.jpg

But I'd like to be able to activate each individual key of the 88 keys separately and not turn on every F# key for example in the comps.

How would I go about doing this while being able to control each individual key and its active state?

I'll be passing MIDI data to each key, by the way, using the om_midi.jsx script.

Thanks.


Return to posts index

Shahid Raza
Re: Best way to create an 88-key piano (incl. pressed keys) without many layers / low render time?
on Jul 3, 2017 at 7:01:58 pm

To answer my own question, I've a solution through reddit so posting here in case anyone comes across this thread ☺

https://www.reddit.com/r/AfterEffects/comments/6kw2yj/best_way_to_create_an...

Hill0's reply was:

First download true comp duplicator for free. It will make unique comps so that each one can be animated differently.
Then I'd make your 12 key comp and duplicate it as needed. Then make a null layer with 88 checkbox expression controllers. Then it's up to you to link each key to its corresponding checkbox.
Personally I'd pick whip one, then copy that expression and paste it into each key layer. If you increment your layer names by one, you'll only have to change that for each expression.


Return to posts index

Shahid Raza
Re: Best way to create an 88-key piano (incl. pressed keys) without many layers / low render time?
on Jul 5, 2017 at 10:07:14 pm

So I got stuck with the checkbox controls and null objects since I've not done anything like that before and decided to try get a working version at least. Just need a hand in tidying up my expressions now or simplifying the whole structure of the compositions.

Basically, in each octave composition, I have the following layer structure:



The comps are numbered with the C note MIDI value. In this case, it is number 24 with is the first C note on an 88-key piano in MIDI.

The next octave(s) would be 36, 48, 60 (middle C) and so on...

Here's a chart of each key's MIDI value:



The expression below is for the Active C# Left layer's opacity. The Active [piano note name] Right layer version just targets the ch_1_pitch slider which then shows a different colour note press.

Dan kindly helped me out in the last thread where I was struggling with markers for MIDI chords and I've modified the code slightly.

midiNote = comp('Main comp').layer( 'midi' ).effect( 'ch_0_pitch' )( 'Slider' );
thisMidiKey = parseInt(thisComp.name,10)+1;
n = 0;
for (i = 1; i <= midiNote.numKeys; i++){
if (midiNote.key(i).time > time) break;
if (midiNote.key(i).value == thisMidiKey) n++;
}
if (n%2) 100 else 0


For the standard non-active notes (i.e. C# in this case as labelled in the screenshot above), I've added this expression to the opacity:

leftHand = thisComp.layer( 'Active C# Left' ).transform.opacity;
rightHand = thisComp.layer( 'Active C# Right' ).transform.opacity;
if (leftHand == 100 || rightHand == 100 ) 0 else 100


What is happening is if ch_0_pitch slider value is equal to the MIDI key note number per key, it will turn the opacity to 100% otherwise it's at 0%.

The problem is I'm repeating this in every individual layer and I'm sure is has a slow processing time when I have 88 keys, each key note with 3 layers that have expressions running - left hand note, right hand note and the non-active state. That's 264 layers!

I'd like to make the whole structure efficient if possible. If null objects and control layers can do this or anything else, can someone please give me a breakdown on how to achieve it (with expressions if possible?).

Thanks!


Return to posts index


Shahid Raza
Re: Best way to create an 88-key piano (incl. pressed keys) without many layers / low render time?
on Jul 7, 2017 at 9:24:01 pm

Anyone able to help with this?


Return to posts index

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