P is for Practical | |
PerlMonks |
Re: Re: Chord rootby benn (Vicar) |
on Aug 10, 2003 at 01:01 UTC ( [id://282526]=note: print w/replies, xml ) | Need Help?? |
YuckFoo - Thanks for the critique - lots of good points.
To take them in order....
OK - guilty as charged. My 're-ordering' of the array could be confusing to anyone wanting to understand this algorithm...it was sheerly a side effect of experimentation ("I wonder what happens if I stick an extra '0' in there..."), but I'm sorry and I won't do it again :) (Oh, and the missing '0' too was simply the result of experimentation.) Originally, I did implement the algorithm exactly as stated, checking for existence in all columns. And indeed, it worked beautifully for major chords - but not for minor ones, for exactly the reason you describe. So, being a hacker by nature, I played around with it until it worked for both. You say it "seems" to work. I'm not pretending that I understand why sticking the 'redundancy' back in and switching from a column-based count to a simple frequency count works, but it does - certainly for all the examples I've played around with. The original algorithm, given "a c e" produces a root of 'D', which is...well, I hesitate to say "plain wrong", because I suppose it could be considered a D9 with no root or 3rd, but I prefer to spell that 'A minor'. This version produces 'A', which is, in my eyes, better. The 'Tristan' example gives *both* the C#9 spelling *and* the G#m6 spelling - also 'correct'. I'd love to see a proof of why this works (or not, as the case may be) - I *only just* understood why the original worked, and this version is simply the result of a few hours idly hacking around. I may have jumped to a number of erroneous conclusions - but I'm happy with the result - while the original algorithm doesn't handle minor chords, this one does. Again, don't ask me *why* (my best guess is something to do with relative minors), but it certainly works for every 3/4 note chord I've tried, (other than a 4-note diminished, which understandably confuses the hell out of it :) ). Cheers,
In Section
Cool Uses for Perl
|
|