Discussion:
Need help with my chord analysis program
(too old to reply)
techbear
2005-07-22 16:51:40 UTC
Permalink
I wrote a program in C++ to run through all possible alternate tunings
for my guitar. It looks at the "best" chord patterns for each tuning,
and tries to find a "winner", an alternate tuning that results in
simple and easy chords for me to play.

I need peer review, to tell me what I'm doing wrong and suggest better
ways of doing it.

You can find my code project (Virtual C++ 6.0) in a 10k ZIP file at
http://www.exegame.com/chords.zip

Thank you!

*** longer explanation ***

A couple weekends ago, I started thinking about alternate guitar
tunings. I play guitar poorly, mostly just strum along, but I know all
my "cowboy chords", so I'm not useless. :)

If an alternate guitar tuning would provide chords that are easier and
simpler for me to play, I'd like to explore it.

Then I got to thinking, this is a straightforward problem, so what if I
wrote a program to brute-force it? I could wrote a program that would
examine ALL possible alternate tunings, looking for the one with the
"easiest" chords. It might take a while, but we've all got more
computing horsepower on our desks than even before, so I decided to go
for it.

It took some tweaking, but the code I've made available for download
DOES what I intended (apparently). For each possible alternate tuning
(within reason), for each chord, for each possible chord fingering, it
tallys up suitablility and finds one guitar tuning that it feels has
the easiest chords. It then outputs all the chords for that tuning,
then exits.

The heart of the program is the JudgeFitness() function, which is in
charge of looking at a single chord fingering, and determining its
score, a measure of how easy this chord seems to be to play.

the current JudgeFitness() test is simplistic and non-optimal. A
better way to construct the function might be to somehow model my
fingers, examining exactly how I would place each finger on each
string. I haven't got a clue how to do that, yet. :)

My stringImportance[] and chordTypeArray[] data are also filled with
numbers I pulled out of thin air, and probably should be adjusted.

The .importance member of the ChordType class is especially arbitrary.
It's a weight so that major and minor chords (hopefully) come out more
easy to play than augmented and diminished chords. I assume I'll
mostly play major and minor chords. However, I don't really know the
true universal chord distribution across all popular songs, or even all
songs I play. I have some ideas about how to find out, though...

Anyway, any feedback would be much appreciated!! Thank you.
Steve Latham
2005-07-25 10:06:15 UTC
Permalink
Post by techbear
I wrote a program in C++ to run through all possible alternate tunings
for my guitar. It looks at the "best" chord patterns for each tuning,
and tries to find a "winner", an alternate tuning that results in
simple and easy chords for me to play.
Talk about going around the horn to get to the cape. I find guitar chords in
standard tuning insanely easy to play.
Post by techbear
I need peer review, to tell me what I'm doing wrong and suggest better
ways of doing it.
You can find my code project (Virtual C++ 6.0) in a 10k ZIP file at
http://www.exegame.com/chords.zip
Sorry, hesitant to download code. AN improvement would be a working Flash or
Java demo you could direct people to to try out.

[snip]
Post by techbear
If an alternate guitar tuning would provide chords that are easier and
simpler for me to play, I'd like to explore it.
People have been doing this since the days of the lute and guess what they
figured out? They figured out that standard tuning was the most useful (OK,
OK, you can include drop D or lute like tunings too). An open G tuning is
great for playing Major chords. Makes diminished chords a little less
comfortable. I think Stnadard tuning represents a nice "average" of ease of
playing and practical use (based on modern stylistic uses). Obviously some
tunings may be suited to other uses - open tunings for slide, slack key
tunings, etc.
Post by techbear
Then I got to thinking, this is a straightforward problem, so what if I
wrote a program to brute-force it? I could wrote a program that would
examine ALL possible alternate tunings, looking for the one with the
"easiest" chords. It might take a while, but we've all got more
computing horsepower on our desks than even before, so I decided to go
for it.
But you know what you forgot? (besides hand size and scale length which
could make a difference form player to player) What about moving chord X to
chord Y? You may find chord X easy, and chord Y easy, but getting smoothly
from on to the next might be something your program could consider. I know
people who can strum an Em7 and a D69add4/F# (that's F# A D G B E - one
finger on the 6th string 2nd fret rest open) all day long, but still take a
couple of seconds to move between them becuase they lack the facility to
move their fingers - all they've done is memorize two shapes, but not
learned how to connect them.

[snip]
Post by techbear
Anyway, any feedback would be much appreciated!! Thank you.
So that's just a couple of things I though about right away. No harm meant,
but I think your premise might be flawed in a couple of ways - like are you
taking into account chord constructions where open strings (and as drones)
are included?. For instance, I just tuned to D A D F# B E and simply took my
first finger and played both the first and second string on the second fret)
producing a nicely voiced Dmaj7. Then I slid my first finger around like a
novice bass player (oops, sorry all) to various frets (try 0, 2 , 5, 7, 12,
and 10 for finality) and got what I felt could be a fairly workable usage.
That's a whole heck of a lot easier than worrying about various chord shapes
and furthermore, one wouldn't even have to know what the name (hell, one
doesn't really need to even know how to play to do that) for that shape is
to make some nice sounding stuff. P.S., anyone making millions of this
tuning/lick/idea after reading this please at least put me in the "thanks
to" liner notes :-)

What about chords with skipped/muted strings? Are they all 6 string chords,
or are you incorporating 3, 4, 5, and 6 string chords? There seems to me to
be a lot a variables to make such a program viable, even for a limited
use???? (though I'm no programmer for sure).

I'd love to see it in a more GUI format.

Good Luck,
Steve
Bob Pease
2005-07-25 10:06:39 UTC
Permalink
Post by techbear
I wrote a program in C++ to run through all possible alternate tunings
for my guitar. It looks at the "best" chord patterns for each tuning,
and tries to find a "winner", an alternate tuning that results in
simple and easy chords for me to play.
I need peer review, to tell me what I'm doing wrong and suggest better
ways of doing it.
You can find my code project (Virtual C++ 6.0) in a 10k ZIP file at
http://www.exegame.com/chords.zip
Thank you!
*** longer explanation ***
A couple weekends ago, I started thinking about alternate guitar
tunings. I play guitar poorly, mostly just strum along, but I know all
my "cowboy chords", so I'm not useless. :)
If an alternate guitar tuning would provide chords that are easier and
simpler for me to play, I'd like to explore it.
Then I got to thinking, this is a straightforward problem, so what if I
wrote a program to brute-force it? I could wrote a program that would
examine ALL possible alternate tunings, looking for the one with the
"easiest" chords. It might take a while, but we've all got more
computing horsepower on our desks than even before, so I decided to go
for it.
It took some tweaking, but the code I've made available for download
DOES what I intended (apparently). For each possible alternate tuning
(within reason), for each chord, for each possible chord fingering, it
tallys up suitablility and finds one guitar tuning that it feels has
the easiest chords. It then outputs all the chords for that tuning,
then exits.
The heart of the program is the JudgeFitness() function, which is in
charge of looking at a single chord fingering, and determining its
score, a measure of how easy this chord seems to be to play.
the current JudgeFitness() test is simplistic and non-optimal. A
better way to construct the function might be to somehow model my
fingers, examining exactly how I would place each finger on each
string. I haven't got a clue how to do that, yet. :)
My stringImportance[] and chordTypeArray[] data are also filled with
numbers I pulled out of thin air, and probably should be adjusted.
The .importance member of the ChordType class is especially arbitrary.
It's a weight so that major and minor chords (hopefully) come out more
easy to play than augmented and diminished chords. I assume I'll
mostly play major and minor chords. However, I don't really know the
true universal chord distribution across all popular songs, or even all
songs I play. I have some ideas about how to find out, though...
Anyway, any feedback would be much appreciated!! Thank you.
At the top level, I might suggest that you learn the 4 or 5 note voicings of
the Maj Min 7th 9th and dim, rather that to try to barre everything outside
of first position.
Most of the 6-string strmmo stuff has IMO annoying voicings anyway.

Your project sounds like a lot of fun, but realistically, without a readily
EXE version, I doubt that you are going to get much testing of it.

My interest would be in the factors you have chosen to determine
playability of the chords generated.
Also, how to select a few tunings from what appear to be millions
which would be reasonable to bother learning.

One consideration, among many is the suitability of changing the Tension
distribution, as this affects the tone and playability on a standard
instrument.

My personal take on this subject is that the present guitar tuning has
evolved, in Darwinian style because it fits the music normally played in the
"Classical Guitar" Era and also fits
Euro/American pop/ CW, Jazz rather nicely.

Alternate tunings are used regularly , however.
Popular ones for me are

DADGBE (Classical Lowered D )

DADF#BE ( lute)

EBE G# B E ( open-E)

E A D G C F ( Straight fourths)


I don't recommend Banjo or fiddle tuning because of tension problems


I'm sure others will have other favorite alternate tuninngs they use.

Good luck, and have fun
Hans Aberg
2005-07-25 10:06:53 UTC
Permalink
Post by techbear
I wrote a program in C++ to run through all possible alternate tunings
for my guitar. It looks at the "best" chord patterns for each tuning,
and tries to find a "winner", an alternate tuning that results in
simple and easy chords for me to play.
Then I got to thinking, this is a straightforward problem, so what if I
wrote a program to brute-force it? I could wrote a program that would
examine ALL possible alternate tunings, looking for the one with the
"easiest" chords. It might take a while, but we've all got more
computing horsepower on our desks than even before, so I decided to go
for it.
This kind of programming might be easier in a Prolog style program,
perhaps CLP(R) (check the newsgroup comp.lang.prolog) or perhaps a
functional language like Haskell (see <http://haskell.org>)
Post by techbear
However, I don't really know the
true universal chord distribution across all popular songs, or even all
songs I play. I have some ideas about how to find out, though...
I think the use of special tunings are made mainly because one wants to
achieve special sound effects, rather than to simplify fingering. On
violins, violinists are said to not like such retuning stuff, as it
changes the correct tensions in the violin, a potential source for damage.
But perhaps that is not a problem on a guitar.
--
Hans Aberg
h***@gmail.com
2005-08-02 17:35:59 UTC
Permalink
blech... I agree. I would not choose C++ for this. Java maybe, but what
hans says is true. Logical or Functional programming languages were
made for problems like this (sort of). Other than that perhaps look
into a scripting language like ruby or python (perl is quite messy
imho). Just my opinion.

-----Horndude77
c***@yahoo.com
2005-08-08 16:44:59 UTC
Permalink
Post by h***@gmail.com
blech... I agree. I would not choose C++ for this. Java maybe, but what
hans says is true. Logical or Functional programming languages were
made for problems like this (sort of). Other than that perhaps look
into a scripting language like ruby or python (perl is quite messy
imho). Just my opinion.
It's really too small a program to worry about what it's written in.

Maybe some input on how it works would be better? What make a good tuning?
Is it different for lead/rhythm? classical/metal? scales/chords? How easy
is it to remember (I suspect that's partially why standard tuning is in
4th but one pair and that that is more important for scales than chords)
How do you model the reach of fingers? Etc.

3ch
c***@gmail.com
2005-07-25 10:07:08 UTC
Permalink
Could I compile this with GCC on a Mac?
c***@yahoo.com
2005-07-29 14:22:54 UTC
Permalink
Post by c***@gmail.com
Could I compile this with GCC on a Mac?
The program compiles under FreeBSD w/ the -lstdc++ flag and StdAfx.h
renamed stdafx.h [which appears to check vc version and do nothing about
it...] So it should compile on a mac.


The output is slightly different that the included F-A-Db-tuning.txt
file. The chord part of the output starts with an F chord but the file
starts with F#/Gb (possibly a fencepost type error?) Is it from the same
version?

What are lines 1,2 and 4 of the output tellin me?

0 ***************************
8 9 10 9 10 11 10 11 12

F A C#/Db F A C#/Db
0 4 4 4 4 4
Post by c***@gmail.com
The heart of the program is the JudgeFitness() function, which is in
charge of looking at a single chord fingering, and determining its
score, a measure of how easy this chord seems to be to play.
the current JudgeFitness() test is simplistic and non-optimal. A
better way to construct the function might be to somehow model my
fingers, examining exactly how I would place each finger on each
string. I haven't got a clue how to do that, yet. :)
A comment or two in this part of the code would be nice, If it could know
about bars and partial bars --You might make and that it's easier for
different fingers to be on different frets if the are on adjacent strings
above a bar. Possibly you could give bonus points if the lowerest few
strings are on the same fret and the higher string are all fretted higher,
and if a single string is really hurting the score, drop it, especially if
it is the highest or lowest. And you might even give bonus points for
matching a regular chord pattern that you find easy to make --this would
probably be good for a version/mode that lets you input a set of chords
for a particular song and looks for a tuning for it. Play something
normally impossible w/ just open C A E G and D forms...
Post by c***@gmail.com
The .importance member of the ChordType class is especially arbitrary.
It's a weight so that major and minor chords (hopefully) come out more
easy to play than augmented and diminished chords.
This could be easily weighted to find a tuning for a particular song
too...
Post by c***@gmail.com
I assume I'll
mostly play major and minor chords. However, I don't really know the
true universal chord distribution across all popular songs, or even all
songs I play. I have some ideas about how to find out, though...
Alternately, the major and minor are harder cus you play them all the time
so you'll learn 'em, and the occasional augmented and diminished are easy
so you can drop to them easier when you barely know them (theown out for
consideration w/ no claim it's a good idea)

3ch
c***@yahoo.com
2005-08-02 17:35:06 UTC
Permalink
Post by c***@gmail.com
Could I compile this with GCC on a Mac?
The program compiles under FreeBSD w/ the -lstdc++ flag and StdAfx.h
renamed stdafx.h [which appears to check vc version and do nothing about
it...] So it should compile on a mac.


The output is slightly different that the included F-A-Db-tuning.txt
file. The chord part of the output starts with an F chord but the file
starts with F#/Gb (possibly a fencepost type error?) Is it from the same
version?

What are lines 1,2 and 4 of the output tellin me?

0 ***************************
8 9 10 9 10 11 10 11 12

F A C#/Db F A C#/Db
0 4 4 4 4 4
Post by c***@gmail.com
The heart of the program is the JudgeFitness() function, which is in
charge of looking at a single chord fingering, and determining its
score, a measure of how easy this chord seems to be to play.
the current JudgeFitness() test is simplistic and non-optimal. A
better way to construct the function might be to somehow model my
fingers, examining exactly how I would place each finger on each
string. I haven't got a clue how to do that, yet. :)
A comment or two in this part of the code would be nice, If it could know
about bars and partial bars --You might make and that it's easier for
different fingers to be on different frets if the are on adjacent strings
above a bar. Possibly you could give bonus points if the lowerest few
strings are on the same fret and the higher string are all fretted higher,
and if a single string is really hurting the score, drop it, especially if
it is the highest or lowest. And you might even give bonus points for
matching a regular chord pattern that you find easy to make --this would
probably be good for a version/mode that lets you input a set of chords
for a particular song and looks for a tuning for it. Play something
normally impossible w/ just open C A E G and D forms...
Post by c***@gmail.com
The .importance member of the ChordType class is especially arbitrary.
It's a weight so that major and minor chords (hopefully) come out more
easy to play than augmented and diminished chords.
This could be easily weighted to find a tuning for a particular song
too...
Post by c***@gmail.com
I assume I'll
mostly play major and minor chords. However, I don't really know the
true universal chord distribution across all popular songs, or even all
songs I play. I have some ideas about how to find out, though...
Alternately, the major and minor are harder cus you play them all the time
so you'll learn 'em, and the occasional augmented and diminished are easy
so you can drop to them easier when you barely know them (theown out for
consideration w/ no claim it's a good idea)

3ch
copious
2005-08-08 16:45:41 UTC
Permalink
Post to WWW.SOURCEFORGE.COM .. With source..


Thx

Loading...