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:
|BINARY ||CONVENTIONAL MUSIC FORMULA||CHORD/SCALE|
|4095 ||111111111111||1-b2-2-b3-3-4-b5-5-#5-6-b7-7||Chromatic scale|
|2320 ||100100010000||1-x-x-b3-x-x-x-5-x-x-x-x||minor chord |
Table of Upper Ranges
|Fretspan5 ||Fretspan4 ||Fretspan3 ||Fretspan2 ||Fretspan1 |
|Base6 ||Base5 ||Base4 ||Base3 ||Base2 |
|4 string ||1295 ||624 ||255 ||80 ||15 |
|5 string ||7775 ||3124 ||1023 ||242 ||31 |
|6 string ||46655 ||15624 ||4095 ||728 ||63 |
|7 string ||279935 ||78124 ||16383 ||2186 ||127 |
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.