All Possible Fretboard Positions

tl;dr: The fretting shell program on github.

IncorrectguitarpositionFor a while now, I have been burning with a desire to see (and practice) every playable guitar fingering position, in a mathematical (not musical chord based) order, for any arrangement of fingers.

This is actually a simple combinatorial problem of enumerating the “variations with repetition” but excluding those that are physically impossible to play.

As a programmer, it is exciting to feel “my brain on logic” and in this case, it has been in implementing the rules to flag “unplayable” positions.

Here is the main loop, that inspects fret groups and joins them with the finger symbols:

First here, we flag unplayable fingerings with two rules:

  1. Lower fingers on higher frets and higher fingers on lower frets are not allowed.
  2. Frets can’t be more than the allowed finger span.

When an unplayable fingering is seen, we skip to the next position, unless we are accumulating all the flags.

In order to facilitate “infraction detection” while allowing one or two fret finger spans, I created this cool function that uses an “adjacent finger span list.” It appears to be full of off-by-one errors, but works perfectly!

This is the output for three fingers in ascending order (i.e. i=index, m=middle, a=ring), covering the first three frets, plus the open string:

Here are three fingers, in different order, on four frets with no open strings:

Note the familiar lexicographic enumeration, but without impossible spans (for the average hand) or backward fingerings. Simple! :)

Next up: SVG diagrams…