Shahid Raza
Forum Replies Created
-
Shahid Raza
July 7, 2017 at 9:24 pm in reply to: Best way to create an 88-key piano (incl. pressed keys) without many layers / low render time?Anyone able to help with this?
-
Shahid Raza
July 5, 2017 at 10:07 pm in reply to: Best way to create an 88-key piano (incl. pressed keys) without many layers / low render time?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 0For 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 100What 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!
-
Shahid Raza
July 3, 2017 at 7:01 pm in reply to: Best way to create an 88-key piano (incl. pressed keys) without many layers / low render time?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_88key_piano_with_onoff/
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. -
Shahid Raza
January 29, 2017 at 12:17 am in reply to: How to target multiple keyframe to check their values from Slider ControlI’ve never scripted before, so challenged accepted ☺
Worse case, I’m going to try and develop my own program / app like Synthesia if the rendering becomes an issue (which is even more of a challenge lol).
Thanks for the help with the keyframe stuff though.
-
Shahid Raza
January 28, 2017 at 6:35 pm in reply to: How to target multiple keyframe to check their values from Slider ControlDepending on the MIDI piece, it can vary. This comp is 3min 30sec and it does look like the estimated time keeps increasing.
How would I go about writing a script for the keyframe analysis on the midi layer or would you have something handy to do this kind of stuff?
Thanks again.
-
Shahid Raza
January 28, 2017 at 6:11 pm in reply to: How to target multiple keyframe to check their values from Slider ControlAwesome stuff! Works like a charm! However, the render times are really slow with it.
Is there anyway I make my code and structure efficient? I can send you the .aep file if needed.
I have 216 layers this code is applied to and it’s taken 2hrs 30mins to get 50% through the render on 720p settings whereas the one I had previous expression was exporting at the same settings in 30 mins max.
Maybe my hopes of this template being something similar to Synthesia won’t really work well… =/
But thanks for your help on this!
-
Shahid Raza
January 27, 2017 at 11:02 pm in reply to: How to target multiple keyframe to check their values from Slider ControlHm, that’s really odd. I have only one channel (ch_0) and the pitch slider has 2-3 or more in some cases within the same slider…
Could this be a bug with om_midi script or am I doing something wrong?
If you see this image from my previous post you’ll see I have only highlighted the midi layer’s ch_0_pitch slider:
There are no other layers down selected here. Just the midi layer.
-
Shahid Raza
January 27, 2017 at 10:25 pm in reply to: How to target multiple keyframe to check their values from Slider ControlSorry, I’m not quite sure what you mean — might be that I’m new to After Effects and all (like literally a week of proper messing about with it).
The keyframes were created by using the om_midi script from here: https://omino.com/pixelblog/2011/12/26/ae-hello-again-midi/
After importing the midi file, it created a null layer named midi with several Slider effects full of keyframes.
So those keyframes you are seeing are only on the midi layer’s ch_0_pitch, ch_0_vel and ch_0_dur effects.
Would this be of help? I’m sorry if I’m sounding too noobish!
-
Shahid Raza
January 27, 2017 at 9:12 pm in reply to: How to target multiple keyframe to check their values from Slider Control -
Shahid Raza
January 26, 2017 at 1:26 am in reply to: How to target multiple keyframe to check their values from Slider ControlI’ve changed the code slightly to this now per .ai file’s layer in the comp:
midiNote = thisComp.layer( 'midi' ).effect( 'ch_0_pitch' )( 'Slider' );
noteActive =thisComp.layer("midi").effect("ch_0_vel")("Slider");
midiNumber = parseInt(name.split("/")[0]);
if ( midiNote == midiNumber && noteActive > 0 ) 100 else 0;
Still need to figure out how to target the multiple keyframes.
Hope someone can give me a hand here… Thanks 🙂


