Music: Practice & Theory Stack Exchange is a question and answer site for musicians, students, and enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need guitar chords in a database for a project I'm working on ( preferably MySQL, CSV or some other easily portable format ). I can imagine many formats by which one could store this information, so I don't particularly care how it's setup.

This information must exist in databases all over the internet, but is there anything freely and publicly available?

share|improve this question
Any reason you can't just compute them? – JimR May 5 '12 at 11:25
when you say "database of chords", do you mean "chord progressions"? Or do you mean just a list of how to construct all the minor, major, 7th, sus2, etc types of chords? – Stephen Hazel May 21 '12 at 21:13
up vote 5 down vote accepted

As mentioned by JimR in the comments, it's not too hard to calculate chord data. You can either populate your own database or calculate them on the fly.

In my ungolfed program here I derive the scales from tetrachords, and treat the A and E shapes uniformly (the E shape occurs when the A shape falls off the bottom [I just re-read the code, I had remembered it backwards.]).

The only fancy operations you need are summing an array and adding a constant to each element of an array.

Well, those were the operations that postscript didn't have built-in. Conceptually, it can get tricky if you're not certain of exactly how chords are built, and then applied to the guitar. So how's about I work through an example case of how my code generates a chord.

D#m was my edge case because it's the highest up the neck that the requirements ... um ... required.

So the input was an ascii string. 'A' = 65, 'B' = 66, 'C' = 67. So 'D' is 68. My program creates a mapping between these values (integer) and procedures which add a constant to an array. The array has been constructed to describe an A Major chord as if played on 8 strings all tuned to low E. [ 0 5 12 17 21 24 29 0 ]. [My code comments call this the "abstract fretstop" form.] So if it's an A chord we need, we leave it alone for now. But for a D, we need to add 5 to everything (we're treating just barre chords, here, so just slide the A up the neck). The constants are derived from seven notes of the aolian scale (the one that starts with 'A' but has no sharps or flats: perfect for decoding).

This produces a new template [ 5 10 17 22 26 29 34 5 ]. Doesn't look like much just yet, but we'll fix that after dealing with the sharp and the fact that it's a Minor chord, not Major.

To make it sharp, just add one to everything, producing [ 6 11 18 23 27 30 35 6 ].

Then to make it Minor, we just tweak the third, which is still in position 4 (counting from 0) of the chord template (not really a template anymore, it's our working copy). This produces [ 6 11 18 23 26 30 35 6 ].

Finally, we "re-tune" the abstract guitar by adding this array [0 -5 -10 -15 -19 -24 -29] to the chord array, producing [ 6 6 8 8 7 6 6 6 ]. And the first 6 elements of this resulting array are the desired fretstops of a D♯ Minor chord.

587(1)07:23 PM:~ 0> gs -q -- D\#m
e 6---
B 7---
G 8---
D 8---
A 6---
E 6---

For E, F, and G, I added -12 to the template to shift everything down an octave and trimmed any initial elements that were below zero (signifying that that note had fallen off the nut and out of the range of the guitar). That's why the template had to have more elements than strings, and this is how the E shape arose from the A shape.

To generate the chord template, We start with a one-octave scale [ 2 2 1 2 2 2 1 ] (aka. 2 disjunct tetrachords 2 2 1 separated by a whole tone 2). Extend it to 2.5-octaves [ 2 2 1 2 2 2 1 2 2 1 2 2 2 1 2 2 1 2 ]. Then we convert these relative intervals to absolute intervals by taking a running sum [ 0 2 4 5 7 9 10 12 14 16 17 19 21 22 24 26 28 29 ]. Now the intervals are all relative to the root rather than to their neighbors.

Then we select elements from the scale according to the figured bass of the desired chord. Let's take an E chord [ 1 5 8 10 12 15 ]. Subtract 1 to change from cardinal numbers to ordinal numbers (indices) [ 0 4 7 9 11 14 ].

Selecting these indices from the scale yields [ 0 7 12 16 19 24 ], the "abstract fretstop" form; also, an arpeggio on one string.

Convert this to actual fretstops by subtracting the intervals to which the strings are tuned [0 -5 -10 -15 -19 -24] to yield the desired chord [ 0 2 2 1 0 0 ].

In order to unify the A and E shapes, I made the template describe an A/E chord. But since notes are described in strict ascending order, it had to have E as the root. Thus A/E is the IV chord of E mixolydian. You could go further and unify the D/F# shape with these, but you'd have to use the phrygian mode.

Now, finally to get around to answer the question! Given the ability to plot chords in any key, what remains is the much simpler task of enumerating the figured-bass representations of your basic forms. The CAGED shapes, 7th chords, 9th chords. [Plus, additional heuristics/editing to eliminate "impossible" shapes. I rather glossed over this snag. Eg., 'Cm' described below would give you a '-1' on the high E string. Perhaps, throw it out (ie. display the chord with that string muted); or substitute a higher chord tone.]

C [ x 1 3 5 8 10 ] and G [ 1 3 5 8 10 15 ] can be considered the same form (from the figured-bass point of view). As can E A and D [ x x 1 5 8 10 12 15 ]. And the minor shapes can use the same form selected from a minor scale. This treatment, unfortunately, glosses over the fact that Cm and Gm are more often played as Am- and Em- shaped barres. :)

This usenet thread has a partial translation of my postscript program to APL.

share|improve this answer

A quick google of "downloadable guitar chords" took me to the Chordpda site. It is an app for windows mobile devices but it has an XML database of chords so that would be simple to use.

Free and downloadable - I'm giving no assurances as to how good it is, but there must be more - that was just a 5 second google search.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.