/****************************************************************** * * CHORD PROGRESSION GENERATOR * v2.0 * Jonathan Hey * * Created Dec 26th, 2007 * Modified Dec 26th, 2007 * * Requires Progression and KeyTranslator * * Description: * Generates chord progressions (sequences) according to * the chord leading chart in p.27 of "Idiot's Guide to Music * Composition," Miller. Each chord naturally leads to others. * Starting from a chosen key with a preferred progression length * the code will generate a progression ensuring each chord leads * to one of tis preferred chords. * * Related classes: * Progression: creates an instance of progression * KeyTranslator: translates the chord numbers to their names * ********************************************************************/ // initialize global variables int numberOfProgressions = 0; // set defaults String newProgressionKey = "C"; int newProgressionLength = 4; // create a max number of progressions int maxProgressions = 200; Progression[] progressions = new Progression[maxProgressions]; // only used to center the text - not to set the screensize (change manually) float screenWidth = 500; float screenHeight = 500; void setup() { size(500, 500); fill(60); background(240); writeBasics(); frameRate(20); } void draw() { background(240); writeBasics(); writeProgressions(); } // make a new progression instance whenever the mouse is pressed void generateProgression(){ progressions[numberOfProgressions] = new Progression(newProgressionLength, newProgressionKey); } void writeProgressions(){ PFont title = loadFont("PMingLiU-ExtB-32.vlw"); PFont subtitle = loadFont("PMingLiU-ExtB-26.vlw"); PFont regular = loadFont("PMingLiU-ExtB-18.vlw"); PFont small = loadFont("PMingLiU-ExtB-14.vlw"); PFont teeny = loadFont("PMingLiU-ExtB-12.vlw"); textFont(regular, 18); textAlign(CENTER); String printString = "-"; int y = 215; int verticalSpacing = 30; if(numberOfProgressions>0){ for (int i = numberOfProgressions-1; i>=0; i--){ fill(50); // make the first few big and the rest small if(i==numberOfProgressions-1){ fill(20); textFont(title, 32); verticalSpacing = 40; } else if(i==numberOfProgressions-2){ fill(35); textFont(subtitle, 26); verticalSpacing = 35; } else if(i==numberOfProgressions-3){ fill(50); textFont(regular, 18); verticalSpacing = 25; } else if(i==numberOfProgressions-4){ fill(50); textFont(small, 14); verticalSpacing = 20; } else if(i