Automatic piano fingering generator.
Find the optimal fingering combination to play a piano score. Optionally visualize it in 3D with vedo.
pip install pianoplayer
to enable sound you may need to:
sudo apt install libasound2-dev pip install simpleaudio
To only install the core functionality and skip everything else, use the following:
pip install music21 pip install --no-deps pianoplayer
Example command line from terminal:
pianoplayer scores/bach_invention4.xml --verbose -n10 -rvzm
will find the right hand fingering for the first 10 measures, pop up a 3D rendering window and invoke musescore.
The output is saved as a MusicXML
file with name
pianoplayer # if no argument is given a GUI will pop up (on windows try `python pianoplayer.py`) # Or pianoplayer [-h] [-o] [-n] [-s] [-d] [-k] [-rbeam] [-lbeam] [-q] [-m] [-v] [--vedo-speed] [-z] [-l] [-r] [-XXS] [-XS] [-S] [-M] [-L] [-XL] [-XXL] filename # Valid file formats: MusicXML, musescore, midi (.xml, .mscz, .mscx, .mid) # # Optional arguments: # -h, --help show this help message and exit # -o , --outputfile Annotated output xml file name # -n , --n-measures  Number of score measures to scan # -s , --start-measure Start from measure number  # -d , --depth [auto] Depth of combinatorial search, [2-9] # -rbeam  Specify Right Hand beam number # -lbeam  Specify Left Hand beam number # --quiet Switch off verbosity # -m, --musescore Open output in musescore after processing # -b, --below-beam Show fingering numbers below beam line # -v, --with-vedo Play 3D scene after processing # -z, --sound-off Disable sound # -l, --left-only Fingering for left hand only # -r, --right-only Fingering for right hand only # -XXS, --hand-size-XXS Set hand size to XXS # -XS, --hand-size-XS Set hand size to XS # -S, --hand-size-S Set hand size to S # -M, --hand-size-M Set hand size to M # -L, --hand-size-L Set hand size to L # -XL, --hand-size-XL Set hand size to XL # -XXL, --hand-size-XXL Set hand size to XXL
pianoplayer in a terminal
(or double click the
Escto quit the application)
(If fingering numbers are not visible enough try
The algorithm minimizes the fingers speed needed to play a sequence of notes or chords by searching through feasible combinations of fingerings.
One possible advantage of this algorithm over similar ones is that it is completely dynamic, which means that it takes into account the physical position and speed of fingers while moving on the keyboard and the duration of each played note. It is not based on a static look-up table of likely or unlikely combinations of fingerings.
Fingering a piano score can vary a lot from individual to individual, therefore there is not such a thing as a "best" choice for fingering. This algorithm is meant to suggest a fingering combination which is "optimal" in the sense that it minimizes the effort of the hand avoiding unnecessary movements.
-lbeamcommand line options.