Permalink
Browse files

Updated generateProgression method, now takes care of scaleType and c…

…hordProgression.
  • Loading branch information...
1 parent 495db7e commit 058f919dfb30d077597ded736132077c2bc33ed9 Joseph Betz committed Apr 18, 2012
@@ -1,5 +1 @@
-<<<<<<< HEAD
-100 25 100 4 4 0 0 0 0 -1 0 0 0 -1 1 0 0 50 0 112 340 0 0 100 105 1 10 10 6 1 50 1 120 0 35 25 1 50 50 62 1 50 1 5 8 2 0 0 0 0 1 1 50 50 70 60 74 2 0 0 0 0 50 50 30 50 50 2 2 0 1 0 50 50 30 45 73 -1 2 0 0 1 50 50 30 50 50 -1 -1 1 0 0 50 50 70 50 61 -1 -1 0 0 0 50 50 30 50 50 -1 -1 0 0 1 50 50 30 50 63 -1 -1 0 0 0 50 50 30 50 50 4 -1 0 1 1 50 50 70 60 52 -1 -1 0 0 0 50 50 30 50 50 -1 -1 0 1 0 50 50 30 45 58 -1 -1 0 0 1 50 50 30 50 50 6 6 1 0 0 50 50 70 50 53 6 6 0 0 0 50 50 30 50 50 2 2 0 0 1 50 50 30 50 54 2 2 0 0 0 50 50 30 50 50 0 0 0 1 1 50 50 70 70 60 -1 0 0 0 0 50 50 30 50 50 0 0 0 1 0 50 50 30 39 70 -1 0 0 0 1 50 50 30 50 50 6 6 1 0 0 50 50 70 50 64 -1 6 0 0 0 50 50 30 50 50 2 2 0 0 1 50 50 30 50 53 2 2 0 0 0 50 50 30 50 50 0 0 0 1 1 50 50 70 70 55 0 0 0 0 0 50 50 30 50 50 -1 -1 0 1 0 50 50 30 39 72 -1 2 0 0 1 50 50 30 50 50 -1 -1 1 0 0 50 50 70 50 51 -1 -1 0 0 0 50 50 30 50 50 -1 -1 0 0 1 50 50 30 50 65 -1 -1 0 0 0 50 50 30 50 50 0 0 0 1 1 50 50 70 70 67 2 0 0 0 0 50 50 30 50 50 2 2 0 1 0 50 50 30 39 60 -1 2 0 0 1 50 50 30 50 50 -1 -1 1 0 0 50 50 70 50 72 -1 -1 0 0 0 50 50 30 50 50 -1 -1 0 0 1 50 50 30 50 74 -1 -1 0 0 0 50 50 30 50 50 4 4 0 1 1 50 50 70 70 52 -1 4 0 0 0 50 50 30 50 50 -1 -1 0 1 0 50 50 30 39 73 -1 -1 0 0 1 50 50 30 50 50 6 6 1 0 0 50 50 70 50 73 6 6 0 0 0 50 50 30 50 50 2 2 0 0 1 50 50 30 50 62 2 2 0 0 0 50 50 30 50 50 -1 -1 0 1 1 50 50 70 70 65 -1 -1 0 0 0 50 50 30 50 50 -1 -1 0 1 0 50 50 30 39 54 2 2 0 0 1 50 50 30 50 50 0 0 1 0 0 50 50 70 50 57 2 0 0 0 0 50 50 30 50 50 2 2 0 0 1 50 50 30 50 73 -1 2 0 0 0 50 50 30 50 50 6 6 0 1 1 50 50 70 70 61 -1 6 0 0 0 50 50 30 50 50 2 2 0 1 0 50 50 30 39 56 -1 2 0 0 1 50 50 30 50 50 0 0 1 0 0 50 50 70 50 63 0 0 0 0 0 50 50 30 50 50 0 0 0 0 1 50 50 30 50 72 -1 0 0 0 0 50 50 30 50 50
-=======
-20 80 80 2 7 0 0 1 0 1 0 1 0 1 1 0 0 25 50 10 137 293 0 0 100 105 2 0 0 0 1 0 1 76 50 10 12 1 25 25 62 1 25 1 5 8 2 0 0 0 0 1 1 12 50 70 60 66 1 0 0 0 0 12 50 30 50 50 2 2 0 0 1 12 50 30 50 55 4 2 0 1 1 12 50 30 45 50 2 2 1 0 0 12 50 70 50 64 3 2 0 0 1 12 50 30 50 50 -1 -1 0 0 1 12 50 30 50 74 -1 -1 0 0 0 12 50 30 50 50 3 3 0 0 1 12 50 70 50 68 4 3 1 0 0 12 50 30 50 50 -1 -1 0 1 1 12 50 30 45 57 -1 -1 0 0 1 12 50 30 50 50 2 2 1 0 0 12 50 70 50 56 4 2 0 0 1 12 50 30 50 50 4 4 0 0 1 12 50 30 50 69 6 4 0 0 0 12 50 30 50 50 0 0 0 1 1 12 50 70 70 66 3 0 0 0 0 12 50 30 50 50 2 2 0 0 1 12 50 30 50 64 6 2 0 1 1 12 50 30 39 50 2 2 1 0 0 12 50 70 50 55 3 3 0 0 1 12 50 30 50 50 -1 -1 0 0 1 12 50 30 50 74 -1 -1 0 0 0 12 50 30 50 50 3 3 0 0 1 12 50 70 50 72 4 3 1 0 0 12 50 30 50 50 -1 -1 0 1 1 12 50 30 39 66 -1 -1 0 0 1 12 50 30 50 50 0 0 1 0 0 12 50 70 50 70 4 0 0 0 1 12 50 30 50 50 2 2 0 0 1 12 50 30 50 62 6 2 0 0 0 12 50 30 50 50 2 2 0 1 1 12 50 70 70 65 1 2 0 0 0 12 50 30 50 50 2 2 0 0 1 12 50 30 50 58 4 2 0 1 1 12 50 30 39 50 2 2 1 0 0 12 50 70 50 51 3 3 0 0 1 12 50 30 50 50 -1 -1 0 0 1 12 50 30 50 62 -1 -1 0 0 0 12 50 30 50 50 3 -1 0 0 1 12 50 70 50 56 4 1 1 0 0 12 50 30 50 50 -1 -1 0 1 1 12 50 30 39 74 -1 -1 0 0 1 12 50 30 50 50 2 2 1 0 0 12 50 70 50 54 4 2 0 0 1 12 50 30 50 50 6 6 0 0 1 12 50 30 50 63 6 6 0 0 0 12 50 30 50 50 2 2 0 1 1 12 50 70 70 61 -1 2 0 0 0 12 50 30 50 50 -1 2 0 0 1 12 50 30 50 71 4 4 0 1 1 12 50 30 39 50 3 3 1 0 0 12 50 70 50 73 -1 3 0 0 1 12 50 30 50 50 -1 -1 0 0 1 12 50 30 50 69 3 3 0 0 0 12 50 30 50 50 2 2 0 0 1 12 50 70 50 58 4 2 1 0 0 12 50 30 50 50 2 2 0 1 1 12 50 30 39 63 1 2 0 0 1 12 50 30 50 50 0 0 1 0 0 12 50 70 50 73 0 0 0 0 1 12 50 30 50 50 0 0 0 0 1 12 50 30 50 60 -1 0 0 0 0 12 50 30 50 50
->>>>>>> 3026038d4b0d6d8d73e0bf8da92a9fc3815c0a29
+50 50 0 1 4 0 4 1 0 3 3 1 4 3 1 0 0 0 100 40 125 320 0 0 100 105 0 0 0 2 0 0 0 32 100 60 0 1 0 0 25 1 0 1 5 8 2 0 0 0 0 1 1 50 50 70 60 58 -1 0 0 0 0 50 50 30 50 50 0 0 0 0 0 50 50 30 50 71 0 0 0 0 1 50 50 30 50 50 2 2 1 0 0 50 50 70 50 74 4 2 0 0 0 50 50 30 50 50 0 0 0 0 1 50 50 30 50 61 1 0 0 0 0 50 50 30 50 50 5 -1 0 0 1 50 50 70 50 74 5 2 0 0 0 50 50 30 50 50 5 -1 0 0 0 50 50 30 50 62 5 5 0 0 1 50 50 30 50 50 1 -1 1 0 0 50 50 70 50 53 1 1 0 0 0 50 50 30 50 50 2 2 0 0 1 50 50 30 50 53 2 2 0 0 0 50 50 30 50 50 0 0 0 1 1 50 50 70 70 63 0 0 0 0 0 50 50 30 50 50 0 0 0 0 0 50 50 30 50 55 0 0 0 0 1 50 50 30 50 50 0 0 1 0 0 50 50 70 50 51 0 0 0 0 0 50 50 30 50 50 0 0 0 0 1 50 50 30 50 66 0 0 0 0 0 50 50 30 50 50 5 5 0 0 1 50 50 70 50 58 5 5 0 0 0 50 50 30 50 50 5 5 0 0 0 50 50 30 50 68 5 5 0 0 1 50 50 30 50 50 1 1 1 0 0 50 50 70 50 66 1 1 0 0 0 50 50 30 50 50 2 2 0 0 1 50 50 30 50 55 2 2 0 0 0 50 50 30 50 50 0 0 0 1 1 50 50 70 70 58 0 0 0 0 0 50 50 30 50 50 0 0 0 0 0 50 50 30 50 60 0 0 0 0 1 50 50 30 50 50 2 2 1 0 0 50 50 70 50 66 4 2 0 0 0 50 50 30 50 50 2 2 0 0 1 50 50 30 50 72 1 2 0 0 0 50 50 30 50 50 5 5 0 0 1 50 50 70 50 55 5 5 0 0 0 50 50 30 50 50 5 5 0 0 0 50 50 30 50 69 5 5 0 0 1 50 50 30 50 50 1 1 1 0 0 50 50 70 50 56 1 4 0 0 0 50 50 30 50 50 2 2 0 0 1 50 50 30 50 51 2 2 0 0 0 50 50 30 50 50 1 1 0 1 1 50 50 60 60 60 5 1 0 0 0 50 50 60 60 60 5 5 0 1 1 50 50 60 60 60 5 5 0 0 0 50 50 60 60 60 5 5 1 0 1 50 50 60 60 60 -1 5 0 1 0 50 50 60 60 60 -1 -1 0 0 1 50 50 60 60 60 -1 -1 0 0 0 50 50 60 60 60 -1 -1 0 0 1 50 50 60 60 60 -1 -1 0 1 0 50 50 60 60 60 0 0 0 1 0 50 50 60 60 60 0 0 0 0 1 50 50 60 60 60 0 0 1 0 0 50 50 60 60 60 0 0 0 1 0 50 50 60 60 60 0 0 0 0 1 50 50 60 60 60 -1 0 0 0 0 50 50 60 60 60
@@ -4,7 +4,7 @@
public static void main(String args[]) throws Exception{
try{
- MelodyGenerator m = new MelodyGenerator(50, 50, 50);
+ MelodyGenerator m = new MelodyGenerator(50, 50, 0);
m.generateMelody();
testGenerator(m);
}
@@ -223,15 +223,12 @@ public void acceptMessage(Date time, OSCMessage message){
else if (c < 0) c = 0;
// Test generator
-<<<<<<< HEAD
- generator = new MelodyGenerator(100, 25, 100);
+ generator = new MelodyGenerator(50, 50, 50);
// Generating new melody based on the current modifications
// generator = new MelodyGenerator(h, e, c);
-=======
//generator = new MelodyGenerator(0, 75, 50);
// Generating new melody based on thparamse current modifications
generator = new MelodyGenerator(h, e, c);
->>>>>>> 3026038d4b0d6d8d73e0bf8da92a9fc3815c0a29
generator.generateMelody();
generator.print();
tpo.writeMelodyGenerator(generator);
@@ -313,8 +313,12 @@ public void generateKey() {
/**
* Generates the progression
*
- * Some popular 4 chord progressions: I - IV - V - V I - I - IV - V I - IV -
- * I - V I - IV - V - IV
+ * Some popular 4 chord progressions:
+ *
+ * I - IV - V - V
+ * I - I - IV - V
+ * I - IV - I - V
+ * I - IV - V - IV
*
* NOTE: I = 0, IV = 3, and such, it'll make transposing much easier.
*/
@@ -325,21 +329,52 @@ public void generateProgression() {
* New progression generation
*/
- for (int i = 0; i < 4; i++)
- chordProgression[i] = 0;
+ for (int i = 0; i < 4; i++) // Chooses mode
+ if (i % 2 == 0)
+ scaleType[i] = 1;
+ else
+ scaleType[i] = (6 - confusion/30) - happiness/15;
+
+ double chordPicker = Math.random(); // Chooses chord progression
- scaleType[0] = 6 - happiness/15;
- scaleType[1] = (8 - confusion/30) - happiness/15;
- scaleType[2] = 6 - happiness/15;
- scaleType[3] = (8 - confusion/30) - happiness/15;
+ if (chordPicker > .8) {
+ chordProgression[0] = 0;
+ chordProgression[1] = 3;
+ chordProgression[2] = 4;
+ chordProgression[3] = 4;
+ }
+ else if (chordPicker > .6) {
+ chordProgression[0] = 0;
+ chordProgression[1] = 0;
+ chordProgression[2] = 3;
+ chordProgression[3] = 4;
+ }
+ else if (chordPicker > .4) {
+ chordProgression[0] = 0;
+ chordProgression[1] = 3;
+ chordProgression[2] = 0;
+ chordProgression[3] = 4;
+ }
+ else if (chordPicker > .2) {
+ chordProgression[0] = 0;
+ chordProgression[1] = 3;
+ chordProgression[2] = 4;
+ chordProgression[3] = 3;
+ }
+ else {
+ chordProgression[0] = 0;
+ chordProgression[1] = 3;
+ chordProgression[2] = 4;
+ chordProgression[3] = 0;
+ }
/*
* Old progression generation
*/
/*
if (!fileRead || currentMelody == 1) {
if (happiness > 66) { // Things are pretty happy!
- chordProgression[0] = 0; // Always start with the root
+ [0] = 0; // Always start with the root
// Generate a semi-random progressions of I, IV, and V
for (int i = 1; i < 3; i++) {
double chordPicker = Math.random() * 100;
@@ -1019,26 +1054,19 @@ public void transpose() {
for (int i = 0; i < 4; i++) {
if (scaleType[i] == 0)
- scaleValues[i] = new int[] { 0, 2, 4, 6, 7, 9, 11, 12 }; // Lydian
- // -
- // "brightest"
+ scaleValues[i] = new int[] { 0, 2, 4, 6, 7, 9, 11, 12 }; // Lydian - "brightest"
if (scaleType[i] == 1)
- scaleValues[i] = new int[] { 0, 2, 4, 5, 7, 9, 11, 12 }; // Ionian
- // (major)
+ scaleValues[i] = new int[] { 0, 2, 4, 5, 7, 9, 11, 12 }; // Ionian (major)
if (scaleType[i] == 2)
scaleValues[i] = new int[] { 0, 2, 4, 5, 7, 9, 10, 12 }; // Mixolydian
if (scaleType[i] == 3)
scaleValues[i] = new int[] { 0, 2, 3, 5, 7, 9, 10, 12 }; // Dorian
if (scaleType[i] == 4)
- scaleValues[i] = new int[] { 0, 2, 3, 5, 7, 8, 10, 12 }; // Aeolian
- // (natural
- // minor)
+ scaleValues[i] = new int[] { 0, 2, 3, 5, 7, 8, 10, 12 }; // Aeolian (natural minor)
if (scaleType[i] == 5)
scaleValues[i] = new int[] { 0, 1, 3, 5, 7, 8, 10, 12 }; // Phrygian
if (scaleType[i] == 6)
- scaleValues[i] = new int[] { 0, 1, 3, 5, 6, 8, 10, 12 }; // Locrian
- // -
- // "darkest"
+ scaleValues[i] = new int[] { 0, 1, 3, 5, 6, 8, 10, 12 }; // Locrian - "darkest"
}
int c = -1; // Current place in the progression that the note will be

0 comments on commit 058f919

Please sign in to comment.