Update of /cvsroot/pure-data/externals/frankenstein In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15621
Modified Files: harmonizer.c test-harmonizer.pd voicing_analyzer.c Log Message: fixed bugs in evaluating indices
Index: harmonizer.c =================================================================== RCS file: /cvsroot/pure-data/externals/frankenstein/harmonizer.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** harmonizer.c 15 Jan 2006 22:54:41 -0000 1.6 --- harmonizer.c 16 Jan 2006 00:56:01 -0000 1.7 *************** *** 193,197 **** // i go up rnd = rand()/((double)RAND_MAX + 1); ! steps = rnd * 5; // how many steps (good notes) will I ignore? note = insertpoint + steps; if (note >= POSSIBLE_NOTES) --- 193,197 ---- // i go up rnd = rand()/((double)RAND_MAX + 1); ! steps = rnd * 10; // how many steps (good notes) will I ignore? note = insertpoint + steps; if (note >= POSSIBLE_NOTES) *************** *** 202,206 **** // i go down rnd = rand()/((double)RAND_MAX + 1); ! steps = rnd * 5; // how many steps (good notes) will I ignore? note = insertpoint - steps; if (note < 0) --- 202,206 ---- // i go down rnd = rand()/((double)RAND_MAX + 1); ! steps = rnd * 10; // how many steps (good notes) will I ignore? note = insertpoint - steps; if (note < 0) *************** *** 224,228 **** int fitness(t_harmonizer *x, int *candidate) { ! int i, j, tmp, res, last, avgHI, avgLOW; short int chord_notes[4]; short int chord_notes_ok[4]; --- 224,229 ---- int fitness(t_harmonizer *x, int *candidate) { ! int i, j, tmp, res, last, avgHI, avgLOW, min, max, distance; ! float wideness, ftmp; short int chord_notes[4]; short int chord_notes_ok[4]; *************** *** 338,342 **** if (DEBUG_VERBOSE) post("transitions[%i] = %i",i, transitions[i]); ! res-=abs(transitions[i]); // give an incentive for semitones etc.. if (transitions[i]==0) --- 339,343 ---- if (DEBUG_VERBOSE) post("transitions[%i] = %i",i, transitions[i]); ! res-=abs(transitions[i]) * x->small_intervals; // give an incentive for semitones etc.. if (transitions[i]==0) *************** *** 418,422 **** }
! if (DEBUG_VERBOSE) post("fitness is %i", res); --- 419,430 ---- }
! // now wideness ! min = notes[0]; ! max = notes[VOICES-1]; ! distance = max - min; ! wideness = (float) (((float)distance) / ((float)12)); ! ftmp = fabs(wideness - x->wideness); ! res -= ftmp * 5; ! if (DEBUG_VERBOSE) post("fitness is %i", res);
Index: test-harmonizer.pd =================================================================== RCS file: /cvsroot/pure-data/externals/frankenstein/test-harmonizer.pd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test-harmonizer.pd 18 Oct 2005 23:10:53 -0000 1.1 --- test-harmonizer.pd 16 Jan 2006 00:56:01 -0000 1.2 *************** *** 1,3 **** ! #N canvas 328 37 702 643 12; #X symbolatom 179 191 20 0 0 0 - - -; #N canvas 39 349 531 328 readme 0; --- 1,3 ---- ! #N canvas 328 37 714 655 12; #X symbolatom 179 191 20 0 0 0 - - -; #N canvas 39 349 531 328 readme 0; *************** *** 96,107 **** #X obj 99 558 *~ 0.2; #X obj 109 418 print; - #X obj 83 169 chords_graph test.graph; #X obj 74 111 f 1; #X msg 59 135 next $1; #X obj 63 70 vsl 15 30 0 1 0 0 empty empty empty 0 -8 0 8 -262144 -1 ! -1 2900 1; #X floatatom 32 112 5 0 0 0 - - -; #X connect 2 0 15 0; #X connect 2 0 49 0; #X connect 3 0 2 0; #X connect 4 0 2 0; --- 96,122 ---- #X obj 99 558 *~ 0.2; #X obj 109 418 print; #X obj 74 111 f 1; #X msg 59 135 next $1; #X obj 63 70 vsl 15 30 0 1 0 0 empty empty empty 0 -8 0 8 -262144 -1 ! -1 0 1; #X floatatom 32 112 5 0 0 0 - - -; + #X obj 83 169 chords_memory test.graph; + #X obj 471 355 voicing_analyzer; + #X floatatom 470 390 5 0 0 0 - - -; + #X floatatom 506 411 5 0 0 0 - - -; + #X floatatom 539 393 5 0 0 0 - - -; + #X floatatom 587 412 5 0 0 0 - - -; + #X msg 461 152 i_like_parallelism $1; + #X obj 463 132 hsl 128 15 -1 1 0 0 empty empty empty -2 -6 0 8 -262144 + -1 -1 6500 1; + #X obj 436 85 hsl 128 15 0 8 0 0 empty empty empty -2 -6 0 8 -262144 + -1 -1 11700 1; + #X msg 434 106 wideness $1; + #X obj 270 76 hsl 128 15 -1 1 0 0 empty empty empty -2 -6 0 8 -262144 + -1 -1 0 1; + #X msg 268 96 small_intervals $1; #X connect 2 0 15 0; #X connect 2 0 49 0; + #X connect 2 0 55 0; #X connect 3 0 2 0; #X connect 4 0 2 0; *************** *** 133,140 **** #X connect 16 0 18 0; #X connect 17 0 21 0; ! #X connect 18 0 50 0; ! #X connect 19 0 50 0; ! #X connect 20 0 50 0; ! #X connect 21 0 51 0; #X connect 21 1 16 0; #X connect 22 0 14 0; --- 148,155 ---- #X connect 16 0 18 0; #X connect 17 0 21 0; ! #X connect 18 0 54 0; ! #X connect 19 0 54 0; ! #X connect 20 0 54 0; ! #X connect 21 0 50 0; #X connect 21 1 16 0; #X connect 22 0 14 0; *************** *** 163,172 **** #X connect 48 0 47 0; #X connect 48 0 47 1; ! #X connect 50 0 0 0; ! #X connect 50 0 5 1; ! #X connect 50 0 16 1; ! #X connect 50 0 22 0; ! #X connect 51 0 52 0; ! #X connect 52 0 50 0; ! #X connect 53 0 51 1; ! #X connect 53 0 54 0; --- 178,197 ---- #X connect 48 0 47 0; #X connect 48 0 47 1; ! #X connect 50 0 51 0; ! #X connect 51 0 54 0; ! #X connect 52 0 50 1; ! #X connect 52 0 53 0; ! #X connect 54 0 0 0; ! #X connect 54 0 5 1; ! #X connect 54 0 16 1; ! #X connect 54 0 22 0; ! #X connect 55 0 56 0; ! #X connect 55 1 57 0; ! #X connect 55 2 58 0; ! #X connect 55 3 59 0; ! #X connect 60 0 2 0; ! #X connect 61 0 60 0; ! #X connect 62 0 63 0; ! #X connect 63 0 2 0; ! #X connect 64 0 65 0; ! #X connect 65 0 2 0;
Index: voicing_analyzer.c =================================================================== RCS file: /cvsroot/pure-data/externals/frankenstein/voicing_analyzer.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** voicing_analyzer.c 15 Jan 2006 22:54:41 -0000 1.1 --- voicing_analyzer.c 16 Jan 2006 00:56:01 -0000 1.2 *************** *** 128,132 **** *i_like_parallelism = (float) -1; *i_like_parallelism += sameDirection; ! *i_like_parallelism += (float) ( ((float)(VOICES*(VOICES-1))) / ((float)parallel8_5) );
// is voice spacing uniform ?(except for the bass) --- 128,134 ---- *i_like_parallelism = (float) -1; *i_like_parallelism += sameDirection; ! if (parallel8_5) ! *i_like_parallelism += (float) ( ((float)parallel8_5) / ((float)(VOICES*(VOICES-1))) ); !
// is voice spacing uniform ?(except for the bass) *************** *** 146,152 **** for (i=0; i<VOICES; i++) { ! if (DEBUG_VERBOSE) ! post("transitions[%i] = %i",i, transitions[i]); ! res-=abs(transitions[i]); // give an incentive for semitones etc.. if (transitions[i]==0) --- 148,154 ---- for (i=0; i<VOICES; i++) { ! // if (DEBUG_VERBOSE) ! // post("transitions[%i] = %i",i, transitions[i]); ! // res-=abs(transitions[i]); // give an incentive for semitones etc.. if (transitions[i]==0) *************** *** 180,184 ****
- }
--- 182,185 ---- *************** *** 203,208 **** // order is important! outlet_float(x->i_like_parallelism_out, i_like_parallelism); - outlet_float(x->small_intervals_out, small_intervals); outlet_float(x->wideness_out, wideness); outlet_float(x->center_note_out, center_note); --- 204,209 ---- // order is important! outlet_float(x->i_like_parallelism_out, i_like_parallelism); outlet_float(x->wideness_out, wideness); + outlet_float(x->small_intervals_out, small_intervals); outlet_float(x->center_note_out, center_note);