Skip to main content

Automatic piano fingering generator. Finds and shows in 3D the best fingering combination to play a score.

Project description

PianoPlayer

Downloads Downloads / Month Downloads / Week lics DOI

Automatic piano fingering generator for MusicXML and MIDI scores.
PianoPlayer searches for a low-effort fingering sequence for one or both hands.
You can also inspect playback in 3D with vedo.

Download and Install:

pip install pianoplayer

Optional extras:

pip install "pianoplayer[visual]"  # 3D rendering with vedo
pip install "pianoplayer[midi]"    # MIDI input support
pip install "pianoplayer[sound]"   # pygame playback
pip install "pianoplayer[all]"     # all optional extras

To visualize the output annotated score install the latest musescore, or any other renderer of MusicXML files.

CLI Usage:

Example command line: pianoplayer scores/bach_invention4.xml -n 10 -r -v -z -m
This annotates the first 10 measures for the right hand, opens 3D playback, and then opens MuseScore.

The output is saved as a MusicXML file with name output.xml.

pianoplayer         # if no argument is given a GUI will pop up
# Or
pianoplayer [-h] [--gui] [-o] [-n] [-s] [-d] [-rbeam] [-lbeam] [--quiet] [-m] [-b] [-v] [--vedo-speed]
            [-z] [-l] [-r] [--hand-size {XXS,XS,S,M,L,XL,XXL}]
            filename
# Valid file formats: MusicXML, compressed MusicXML, MuseScore, MIDI (.xml, .mxl, .mscz, .mscx, .mid, .midi)
#
# Optional arguments:
#   -h, --help            show this help message and exit
#   --gui                 Launch the Tkinter GUI
#   -o , --outputfile     Annotated output xml file name
#   -n , --n-measures     [100] Number of score measures to scan
#   -s , --start-measure  Start from measure number [1]
#   -d , --depth          [auto] Depth of combinatorial search, [5-9]
#   -rbeam                [0] Specify Right Hand beam number
#   -lbeam                [1] 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
#   --hand-size           Hand size preset [XXS, XS, S, M, L, XL, XXL]

GUI Usage

Run pianoplayer with no filename to open the GUI, then:

newgui

  • press Import Score (valid formats: MusicXML/MXL, MuseScore, MIDI, PIG)
  • press GENERATE (output.xml is written)
  • press Musescore to visualize the annotated score
  • press Quit (or q / Ctrl+W) to close the GUI

Example output, as displayed in musescore:

(If fingering numbers are not visible enough try -b option.)

bachinv4

pianoplayer3d

How the algorithm works:

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.

Parameters you can change:

  • Your hand size (from 'XXS' to 'XXL') which sets the relaxed distance between thumb and pinkie.
  • The beam number associated to the right hand is by default nr.0 (nr.1 for left hand). You can change it with -rbeam and -lbeam command line options.
  • Depth of combinatorial search, from 5 up to 9 notes ahead of the currently playing note. By default the algorithm selects this number automatically based on the duration of the notes to be played.

Limitations

  • Some specific fingering combinations, considered too unlikely in the first place, are excluded from the search (e.g. the 3rd finger crossing the 4th).
  • Hands are always assumed independent from each other.
  • In the 3D representation with sounds enabled, notes are played one after the other (no chords), so the tempo within the measure is not always respected.
  • Small notes/ornaments are ignored.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pianoplayer-3.0.0.tar.gz (86.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pianoplayer-3.0.0-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

Details for the file pianoplayer-3.0.0.tar.gz.

File metadata

  • Download URL: pianoplayer-3.0.0.tar.gz
  • Upload date:
  • Size: 86.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pianoplayer-3.0.0.tar.gz
Algorithm Hash digest
SHA256 195512fc64db4d8356cdaa650b7bb781306d7acf572606bcd55c2229c91df7ec
MD5 42ddac8681af6b2da805ae095b0ff90f
BLAKE2b-256 80b0173f83c5ec6438c0c6044dab49edd118e777f48781a5302c1e5e34e6f384

See more details on using hashes here.

File details

Details for the file pianoplayer-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: pianoplayer-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 34.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pianoplayer-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e689a22ea3f29c1eac507feea6d25651a78d858ffc085c50696cced3d705a19
MD5 79bb2de160e03d93c844eeb018cd8a68
BLAKE2b-256 0effb62e5d455275d94eba895eb26a3d982cc9a4eb0c353d0154a000b0a62d1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page