Integer Programming for Optimal Right Hand Guitar Fingerings
The Western canon of European classical music includes a substantial amount of scale-based, fingerstyle guitar music. When presented with a piece of sheet music, a classical guitarist must make a number of decisions regarding its performance. These decisions include notating the tablature, the left hand fingerings, and the right hand fingerings. This process, especially for right hand guitar fingerings, is often a trivial, yet cumbersome task.
For example, consider the III. Allegro Solemne movement from the 1921 piece “La Catedral” by Paraguayan composer Agustín Barrios. Due to its fast tempo, the performer must pay careful attention to the fingerings to adhere to proper technique while maintaining such a tempo. The problem then becomes how can we use math and computer science to determine optimal fingerings for this type of music?
Bernd Tahon began to answer this question with this 2017 Master’s thesis Fingers to frets - A Mathematical Approach where he examined how to utilize math and computer science to optimize left hand finger assignments. In this project, we tackled the separate, yet related problem of right hand finger assignments.
In fingerstyle music, the guitar is played using the thumb, index, middle, and ring fingers (not the pinky). At present, there is a notion within the classical guitar community of “proper right hand technique” which can be thought of as a set of rules that describe the physically optimal way of using the right hand to play scale-based, fingerstyle guitar music. These rules can be summarized as follows:
- Do not repeat fingers on consecutive notes
- The thumb plays the bassline
- Fingers stay in natural resting position
- Avoid backwards crossings
- Avoid ring-middle-ring alternation
We decided to formulate this problem as an integer program where each of these rules are a constraint imposed by the model. The integer program, then, consists of a minimization of a sum of penalty terms that are incurred by violating the “soft” constraints. The complete integer program can be found below:
An explanation of this model as well as other information about this project can be found in this paper.
We implemented the model with Gurobi Optimizer and tested it on some selected measures of “La Catedral”. Below are some examples of the results. The f i correspond to the finger assignment of each note as returned by our model and the f i* correspond to the optimal finger assignment.
Click here to access the Github repository of the Python code used to generate the .lp file in order to use our model on your own music.