Skip to content

This repository is useful for generating the LP file to be used with Gurobi Optimizer for determining optimal right hand guitar fingerings.

Notifications You must be signed in to change notification settings

mskarha/rhfingerings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Integer Programming for Optimal Right Hand Guitar Fingerings

By Matt Skarha, Isabel Taylor, and Mohit Dubey

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:

\text{minimize}

\sum_{i=1}^{n} p^{BC}_i + p^T_i + \frac{1}{2} p^F_i

\text{subject to:}

b_i*f_i<4+p^T_i \qquad \forall \ i

|f_i-s_i| - (t_i*M) \leq p_i^F \qquad \forall \ i

-(s_i-s_{i+1})(f_i-f_{i+1})\leq M*p^{BC}_i \qquad \forall \ i < n-1

f_i + f_{i+1} + f_{i+2} \geq 5 \qquad \forall \ i < n-2

|f_i-f_{i+1}| \geq 1 \qquad \forall \ i < n-1

An explanation of this model as well as other information about this project can be found in this paper.

Using this on your own music

If you would like to use this model to determine RH fingerings for your own music, simply download the Python rhfingerings.py file. At the beginning of the code, there is a dictionary s. This dictionary is where one would input the ordered sequence of strings to be played. Use the following notation for each string:

  • e string: 1
  • B string: 2
  • G string: 3
  • D string: 4
  • A string: 5
  • E string: 6

Simply run the Python code and it will generate the .lp file that can then be used with Gurobi Optimizer to determine the optimal fingerings for your music.

About

This repository is useful for generating the LP file to be used with Gurobi Optimizer for determining optimal right hand guitar fingerings.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages