Skip to content

Animated 2D Hands in Synthesia Clone

PASHKULI

Here is how to separate the keys and set equal tail (Xt) to "blacks" (b):

• yes, the heads of the "white" keys are different as grouped but do not worry, most MIDI rolls in DAWs (Reaper for example) are also like that
• the hardware synth Osmose (by Expressive E) also has these proportions
• if you'd like to have equal respective widths the setup is much more intricate but for such UIs is not that crucial

t — tail width
b — "black" width
h — head width
g — gap width

• gaps you can set them as 1px (one pixel) or 2px, 3px depending on the resolution of the display (SD and HD displays g = 1px is ok)
All Xt = b and lets say they will be = 30px (exceptions will be the tails at each end for keys\notes A₀ and C₈), so

86 tails + C₈h + 87 gaps = ScreenWidth - A₀t

ScreenWidth (for full screen) can also be WindowWidth if you'd like it scaled.
We know the gaps, let g = 2px (or 1px) and the tails to be 30px (for 2K monitors) or 25px (for HD monitors) or whatever.
On average t = 14g or 15g or 16g… if g = 1px then t = 20g or 22g (dark gaps might make "black" keys look wider but "white" keys emit the pixels' light so will get balanced).
Length of "blacks" are about ⅔ × the whole length of "white".
Anyway, take a look at .svg attached or you might draw it with a code, you can see the basic structure above and try it from there.

I mean, tell me it is not perfect. Only if you know about the width discrepancy you could spot that the white heads are not equal where explained as constructed.
Whet keys → white finger number symbol. Black → black number. I think it is very simple and meaningful this way.


PASHKULI

Here is a version with "standard" width (not narrow) HD format 1920×1080 resolution:


here is the corresponding .svg


PASHKULI

Final fancy version in .svg (opens great in Inkscape, the recent one) with shadows, rounded edges, reflections.
Keep in mind shadows are tricky: for example if E and F arpe pressed together then F should loose the shadow from E (E will have the deeper shadows from the keys on its left).
If black and next to the right white are pressed together then the deeper shadow from the black should be off.


Prestissimo

Implemented the equal keys as an optional toggle in the main menu, as well as other features like glissandos and the ability to sync rendered audio to the animations. There's now also an .exe release on the GitHub page, so no need for Python if you just want to run it https://github.com/V9011N/pygame-piano-animator/releases/tag/Executable

Gonna leave this one alone for now, it was a nice experiment, but I think if you want to make convincing procedurally animated hands you HAVE to go 3D.



PASHKULI

Prestissimo

Brother, do not leave so fast. This tool is almost magnificent.
I loaded it some of those single channel midi files from Rousseau and it "split" the hands… well not perfect but well enough! It is much better than that "Split" paid tool which I reviewed in the other thread and it was terrible.

Here me out:
• now we can get a MIDI export function, but each hand (blue and green) needs to get assigned to their own MIDI channels (1 and 2, or 3 and 4)
• this will get some very tedious manual work done to at least 80% (yes, it does not match the hand's finger moves of Rousseau to 100%) but it is there very close!
• midi editor is there
• the hands (forearms do not need to be so long) → it will be great the keyboard to get closer to bottom edge of screen (see screenshots) → will leave more space for shorter notes to get larger in size and time scope

You got no idea but I have been looking for such tool for probably 20 years!
Your work is not done yet: the midi channels separation (export) per hand is a must!

I understand it is "vibe‑coded" with Claude but squeeze that AI bot a bit more (a lot more!) for the sake of comprehensiveness this tool should be able too pull off.


jenpal

I use Notation Composer (by Notation Software) to split my piano recording from MIDI below. It’s not accurate, but I think it’s okay. Then I use the Synthesia app to show the falling notes with left and right hands in different colours, but it doesn’t show the animated hands, though.


PASHKULI

jenpal I use Notation Composer (by Notation Software) to split my piano recording from MIDI below. It’s not accurate, but I think it’s okay.

The question is, do you split them yourself by selecting and so on? If so, you do not need a special software — you can do that with any free MIDI editor or such within a DAW: Reaper DAW (somewhat free, but not expensive) is what I typically use or Cubase (rather quite expensive).
In fact there is no really good dedicated MIDI editor for that purpose but some free are not that bad such as http://www.midieditor.org/.

The idea behind 'hand split' should come from real score (scanned, recognized and digitized). Typically bass clef is = left hand, treble clef = right hand (regardless whether the pianist is right or left handed → pianos are ignorant about that fact of human nature).

So, typically such score editors (most of them paid) such as Sibelius, Dorico, Finale (r.i.p.), MuseScore (free but the score base is a subscription), have their own formats and export to MIDI should be able to separate the hands into 2 separate MIDI channels. Bu most people today record their performances directly from a keyboard controller to a piano roll and do not bother to separate the hands (first they need to 'split' the hardware keyboard output typically at C₄ = 'middle C'). Some notes will have to be assigned in post‑recording edits (crossing hands and such). This 'split' on the output should be default behaviour, at least when piano\organ sounds are involved.

Scanning scores is also an option but is the most expensive one: you need good scanner, ScoreScan software, great condition score books. I have experimented with such and it is very time consuming and also needs edits in post.

@Pianissimo so far has done almost 90% of the job in a single app. It can not guess perfectly, but it is about 80% there. Just needs channel separation on the guessed hands.
I hope he adds this to the functionality. It is there, just needs to be finished.


Prestissimo

PASHKULI

Fear not, just my usual bout of self-doubt embarking on new, especially experimental projects like this. As you may have noticed on the GitHub I am still updating this. I'll keep up with this page and keep reading your suggestions. Please, please be nitpicky about anything that seems off with the hands, that's the hardest part to even verbalize to Claude to implement.


PASHKULI

Prestissimo

Unfortunately, I am not a pianists, therefore my finger assignment related questions (prompts) to Claude would be pointless. More so, because I think the left hand notes direction on piano should be… flipped. Essentially making learning piano 4 to 5 times faster\easier more intuitive for the brain, muscles.

But please, let Claude know that the left hand notes should get exported to the next MIDI channel out. If right hand is on channel one, left hand notes should get exported (Save as… midi) to channel 2. This will be the best really and I have been looking for such a feature for 20 years, which is a (hopefully you can make it) biproduct of your Handthesia.
I really prefer to call your app Handtasia (from hand and fantasia).


Prestissimo

PASHKULI

Yeah, that's a good name for it too!


jenpal

PASHKULI The question is, do you split them yourself by selecting and so on? If so, you do not need a special software — you can do that with any free MIDI editor or such within a DAW: Reaper DAW (somewhat free, but not expensive) is what I typically use or Cubase (rather quite expensive).

The Notation software I use automatically splits the right and left hands, but not accurately, though. I’m hoping AI will improve this or at least eventually.

Thanks for mentioning manual splitting in DAWs and other free software. I haven’t explored that yet and might try it with my Ableton Live if it has that feature and if it is easy to use.

When I made my tutorial video above, I considered manually splitting it, but my notation software presented it as sheet music, which I can’t read, or at least not easily. I prefer visual falling notes with simulated hands and would like to easily modify hand assignments as I work through the piece and adjust the tempo as necessary.


PASHKULI

jenpal

Yes, I searched about this 'Notation Composer' scoring software (German?). It seems to not support MIDI roll view and does not have a MIDI editor.
I can only recommend you using Overture 5.x (it does it all). It offers a cross‑grade discount if you fill in the current scoring program you use (ah, sorry it does not mention 'Notation Composer', oh well).
It does hands (bass and treble staves) to MIDI channels export.

Yes, Ableton has great and extensive MIDI edit and import\export support.

I have Overture 5.x alongside MuseScore (free) and Notion 6 (by Presonus, recently acquired by Fender). The problem with score notation programs is that they all have their own format file, which is a pain for exchange. Using MusicXML as interchangeable export format works only partially (for simple scores).


PASHKULI

Prestissimo

Brother, I just tweaked the hand anatomy editor. Really great stuff! As far as UI, seems you did full Synthesia workflow with more improved MIDI roll background.
I mean Synthesia might go in the archives soon.

Are you a programmer? I would like to use Claude and tried for a few ideas but it was total garbage. I mean, probably my prompts were.
If you do not mind, give us more info on the dev. as Hand‑thesia is now in version 26.x from what I can see.


Prestissimo

PASHKULI

I have enough programming experience to give detailed technical instructions to my exact specifications. And Pygame engine is something I'm familiar with but never knew it could be taken this far. But if you're asking for a roadmap, I'm just going with the flow. I'm thinking of adding the ability for 3 or more hands or multiple pianos for the next major version 26.2.xx


PASHKULI

Prestissimo

Before you go on that a bit bloated tangent (to include 3, 4 hands — why?) can you do some reiteration on current design:
• refresh rate of MIDI piano roll — can it go to at least 48fps or better even 60fps?
• hands to get shortened to about just behind wrist — gives more height for MIDI piano roll and "zoom in" time (larger MIDI notes\blocks)
• better size of finger numbers on MIDI notes
• the .mid file export — each hand's notes to separate channels (the most anticipated of all)

It is getting to 90%+ perfect.


Prestissimo

PASHKULI

Can you elaborate on the second point? What do you mean by shortening the hands?


PASHKULI

Just to have more space for the MIDI roll notes


Prestissimo

PASHKULI

Ohhhh, okay! I'll have that as a setting in a new general settings menu in the main menu. That's definitely worth implementing!


Prestissimo

Implemented your suggestions as well as the ability to choose your soundfont. Dev build is here: https://github.com/V9011N/pygame-piano-animator/tree/equal-key

Steps:

Click on Code, then Download ZIP. Extract file to a location on your PC.

Install latest Python

Right click inside the folder where all the .py folders are at and Open in Terminal

First time only:

pip install -r requirements.txt
pip install --no-deps tinysoundfont

Then:

python main.py

For those curious about FPS performance, there is an option in settings to show FPS and frametime graph in the corner, as well as set an FPS cap (uncapped all the way to the right). Let me know what your performance is, I get 150-250 FPS in a 1080p window while a MIDI playing.


Next Page »