You may find this project useful if you're planning to create a chord chart or a complete database of chord voicings for the guitar.
The code enumerates all possible lowest position moveable chord shape combinations within the first 5 frets. The resulting shapes may then be easily slid or transposed to other frets like barre chords.
Approximately 31,000 distinct shapes are produced for a 6 string guitar while 201,811 shapes are produced for a 7 string guitar. Processing time may take about 1 to 3 minutes depending on the number of strings selected.
For now, the app still generates awkward chord shapes or wide stretches which may be impossible to press on a real instrument. Exceptional open string possibilities have been excluded from the calculation.
After all combinations have been found, the shapes are then sorted according to their intervallic structure. I've used binary numbers and decimal numbers to represent and abbreviate the intervals of conventional chord formulas. Here are a few examples:
||CONVENTIONAL MUSIC FORMULA
Table of Upper Ranges
I would suggest that you download the entire .zip file which contains the supporting procedures. Here is one function I've used:
Function NumberSystemEquivalent(ByVal DecimalInput As Long, BaseNumber As Integer) As String
Dim Exponent As Integer
Dim Num As Long
Num = DecimalInput
Exponent = 0
If Num < BaseNumber ^ Exponent Then
Exponent = Exponent + 1
Exponent = Exponent - 1
If Exponent < 0 Then
Exponent = 0
Dim y As Integer, PositionalValue As Long
For y = Exponent To 0 Step -1
PositionalValue = BaseNumber ^ y
If (Num \ PositionalValue) >= 1 Then
NumberSystemEquivalent = NumberSystemEquivalent & (Num \ PositionalValue)
Num = Num Mod PositionalValue
ElseIf (Num \ PositionalValue) < 1 Then
NumberSystemEquivalent = NumberSystemEquivalent & "0"
// The base number used by the function above varies
// depending on the fret span selected by the user:
Select Case lstFretSpan.ListIndex
BaseN = 5
BaseN = 6
// ... and the way the shapes are extracted can be quickly summarized in this way:
Dim x As Long
Dim ReturnValue As String
Dim FormatResult As String
Dim TABFormat As String, ChordNumber As Integer
Dim ctr As Long
ctr = -1
For x = 1 To Range
ReturnValue = NumberSystemEquivalent(x, BaseN)
FormatResult = Format(ReturnValue, String(NumberofStrings, "0"))
If InStr(FormatResult, "1") <> 0 Then // << This statement ensures that no duplicate shapes
// occur and that the shapes are in the
// lowest position
TABFormat = Replace(FormatResult, "0", "x")
ctr = ctr + 1
ReDim Preserve mChordNumber_Shape(ctr)
ChordNumber = DecimalEquivalent(BinaryFormula(TABFormat))
mChordNumber_Shape(ctr) = ChordNumber & " = " & TABFormat
txtCount.Text = ctr + 1
Points of Interest
For the guitar tuning arrays found in the other supporting procedures not shown above: C4 would correspond to Middle C or MIDI Note Number 60.
The code contained in the zip file is already quite self-documenting in itself and a very detailed explanation of the code would make this introduction very lengthy. I've used descriptive variable declarations and labels to make it easier to visualize how the code works. This may become more apparent once you've gone through the code and if you're quite familiar with the basic VB syntax.
Feel free to make use of or alter the code in case you might have similar applications.