|
About Andrew Choi
MIDI Programs
MIDI File Player (External Device)
MIDI Destination Pop-Up Button
Other Programs Cocoa Sample Programs Syntax Coloring Using Flex Algorithms Jazz Chord Analysis as Optimization
|
A blog where I will write mostly about programming in Cocoa and CoreMIDI, and experiences from my ports of Emacs and XEmacs to the Mac OS.
I didnt want to write a lot of subscripts in HTML so I wrote up my algorithm in TeX. Ive tested it on some more chord changes and the results look good. Ill be fine-tuning the cost function to improve the algorithms local decisions.
I wont have time to write about my algorithm today because Im finishing a little late. But let me show you what it outputs for the changes for Blues For Alice! Fmaj7 F Major Em7b5 D HarmonicMinor A7 D HarmonicMinor Dm7 C Major G7 C Major Cm7 Bb Major F7 Bb Major Bbmaj7 Bb Major Bbm7 Ab Major Eb7 Ab Major Am7 G MelodicMinor D7 G MelodicMinor Abm7 Gb Major Db7 Gb Major Gm7 F Major C7 F Major Fmaj7 F Major Dm7 F Major Gm7 F Major C7 F MajorPerhaps it still need a bit of fine tuning (notice that it chooses the G melodic minor scale for the Am7 D7; is that better than the G major scale?). All of its other choices look good. Whats remarkable about this algorithm is that it doesnt possess any high-level knowledge except a single rule for II-V! The rest of it is mathematical. Its implemented by about 250 lines of C++ code, excluding the jazz theory library, which is currently about 700 lines of C++ code.
Today I found a Windows shareware program called Jazz Scale Suggester System (JSSS) which analyzes chord sequences and suggests scales that can be played over the chords. I also found the web page of an unpublished program called THoTH, which performs a similar function. It wasnt possible to deduce from the web pages of these programs how they work. Posts in a newsgroup by the authors of the two programs provide some information on how JSSS works: it is written in CLIPS and its implemented by about 200 rules. THoTHs author didnt explain how that program works.
For a given chord, we might like to detemine the scales that can be played over it. E.g., if we only consider major scales and harmonic and melodic minor scales in common key signatures, the C major scale, G major scale, and the E harmonic minor scale can be played over the Cmaj7 chord.
bool Contains(const Scale& s, const Chord& c)
{
NoteVector sn = s.notes();
NoteVector cn = c.notes();
for (NoteVector::size_type i = 0; i < cn.size(); i++)
if (std::find(sn.begin(), sn.end(), cn[i]) == sn.end())
return false;
return true;
}
The function Contains determines whether all the notes in a chord are contained in a scale. Using Contains, we can implement a function PossibleScales to prints all the scales in which a given chord is embedded. Thus, the code
int main()
{
PossibleScales(Chord(Note(C), "maj7"));
std::cout << std::endl;
PossibleScales(Chord(Note(F, Sharp), "maj7"));
std::cout << std::endl;
PossibleScales(Chord(Note(G, Flat), "maj7"));
std::cout << std::endl;
PossibleScales(Chord(Note(D), "m7"));
std::cout << std::endl;
PossibleScales(Chord(Note(B), "m7b5"));
std::cout << std::endl;
PossibleScales(Chord(Note(E, Flat), "maj7#5"));
prints the output
C Major G Major E HarmonicMinor
Ive added two constructors to the Chord class today. Chords can now be created from a root and a vector of intervals or from a vector of notes. In addition to the map for looking up interval vectors from chord names, I added a new map for looking up chord names from interval vectors. The STL map and vector class templates allow this to be implemented without writing a lot of code. #include <iostream> #include "JazzTheoryClasses.h"
|
Lists
Less-Known Facts About Emacs
Chinese Restaurants in Calgary
Calgary/Banff Tourist Attractions
Top-10 Reason I Stopped Working on Emacs
Misc
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright © 2003, 2004, 2005 Andrew Choi (Contact Information). | Created with FCBlog |