[PD-cvs] externals/frankenstein common.c, 1.17, 1.18 common.h, 1.14, 1.15 rhythms_memory.c, 1.8, 1.9 test-rhythms_memory.pd, 1.3, 1.4
dmorelli
morellid at users.sourceforge.net
Wed Dec 28 12:47:21 CET 2005
Update of /cvsroot/pure-data/externals/frankenstein
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16069
Modified Files:
common.c common.h rhythms_memory.c test-rhythms_memory.pd
Log Message:
fixed rhythms recognition
Index: test-rhythms_memory.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/frankenstein/test-rhythms_memory.pd,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test-rhythms_memory.pd 27 Dec 2005 01:28:51 -0000 1.3
--- test-rhythms_memory.pd 28 Dec 2005 11:47:19 -0000 1.4
***************
*** 1,3 ****
! #N canvas 91 38 909 527 12;
#X obj 126 256 rhythms_memory;
#X msg 126 212 measure;
--- 1,3 ----
! #N canvas 91 38 913 531 12;
#X obj 126 256 rhythms_memory;
#X msg 126 212 measure;
***************
*** 6,10 ****
#X obj 85 86 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
! #X obj 123 25 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
;
#X obj 124 71 int 0;
--- 6,10 ----
#X obj 85 86 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
! #X obj 123 25 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1
;
#X obj 124 71 int 0;
***************
*** 48,52 ****
#X obj 270 187 dac~;
#X floatatom 180 155 5 0 0 0 - - -;
- #X msg 384 39 rhythm 1 1;
#X obj 126 294 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
--- 48,51 ----
***************
*** 62,67 ****
of floats (TODO);
#X text 373 361 here you get info on the last detected rhythm;
! #X connect 0 0 26 0;
! #X connect 0 1 31 0;
#X connect 0 2 12 0;
#X connect 1 0 0 0;
--- 61,68 ----
of floats (TODO);
#X text 373 361 here you get info on the last detected rhythm;
! #X msg 384 39 rhythm_out 6 0;
! #X connect 0 0 25 0;
! #X connect 0 0 21 0;
! #X connect 0 1 30 0;
#X connect 0 2 12 0;
#X connect 1 0 0 0;
***************
*** 90,93 ****
#X connect 22 0 21 0;
#X connect 22 0 11 0;
! #X connect 25 0 0 0;
! #X connect 27 0 0 1;
--- 91,94 ----
#X connect 22 0 21 0;
#X connect 22 0 11 0;
! #X connect 26 0 0 1;
! #X connect 34 0 0 0;
Index: rhythms_memory.c
===================================================================
RCS file: /cvsroot/pure-data/externals/frankenstein/rhythms_memory.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** rhythms_memory.c 27 Dec 2005 01:28:51 -0000 1.8
--- rhythms_memory.c 28 Dec 2005 11:47:19 -0000 1.9
***************
*** 3,16 ****
by Davide Morelli www.davidemorelli.it 2005
- a working version of rhythms_memory
-
uses graphs to store rhythms
TODO:
! * test and debug core functionalities
! * memory save/load to file
! * output rhythms in the form of list of floats
! * add velo
! * input rhythms from a list (second inlet)
*/
--- 3,15 ----
by Davide Morelli www.davidemorelli.it 2005
uses graphs to store rhythms
TODO:
! * memory save/load to file (?)
! * output rhythms in the form of list of floats (easy)
! * add velo (?)
! * input rhythms from a list (second inlet) (easy)
! * let it create variations on known rhythms (?)
! * let it merge rhythms (?)
*/
Index: common.c
===================================================================
RCS file: /cvsroot/pure-data/externals/frankenstein/common.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** common.c 27 Dec 2005 01:28:51 -0000 1.17
--- common.c 28 Dec 2005 11:47:19 -0000 1.18
***************
*** 388,392 ****
unsigned short int best_subid, curr_subid;
float best_closeness, curr_closeness;
! int sub_ok, sub_no;
int count_strong;
t_rhythm_memory_element *possible_rhythms;
--- 388,392 ----
unsigned short int best_subid, curr_subid;
float best_closeness, curr_closeness;
! int sub_ok, sub_no, sub_count;
int count_strong;
t_rhythm_memory_element *possible_rhythms;
***************
*** 409,412 ****
--- 409,413 ----
strong_no=0;
strong_ratio=0;
+ /*
average_weight = 0;
while(curr_event)
***************
*** 420,424 ****
curr_event = curr_event->next;
}
!
// look all the representation's rhythm
// looking for strong beats corrispondance
--- 421,433 ----
curr_event = curr_event->next;
}
! // this is the average weight of this rhythm in this representation
! if (beats==0)
! {
! average_weight = 0;
! } else
! {
! average_weight = (float) (average_weight / ((float) beats));
! }
! */
// look all the representation's rhythm
// looking for strong beats corrispondance
***************
*** 447,458 ****
}
- // this is the average weight of this rhythm in this representation
- if (beats==0)
- {
- average_weight = 0;
- } else
- {
- average_weight = (float) (average_weight / ((float) beats));
- }
// ratio of corresponding strong beats..
// close to 0 = no corrispondance
--- 456,459 ----
***************
*** 477,481 ****
// create the table of this rhythm
create_array_beats(&tmp_rhythm_array, possible_rhythms->rhythm);
! sub_ok = sub_no = 0;
for (i=0; i<max_i; i++)
{
--- 478,482 ----
// create the table of this rhythm
create_array_beats(&tmp_rhythm_array, possible_rhythms->rhythm);
! sub_ok = sub_no = sub_count = 0;
for (i=0; i<max_i; i++)
{
***************
*** 490,493 ****
--- 491,495 ----
sub_no++;
}
+ sub_count++;
}
if (sub_no == 0)
***************
*** 496,500 ****
} else
{
! curr_closeness = (float) ( ((float) sub_ok) / ((float) sub_no) );
}
if (curr_closeness > best_closeness)
--- 498,502 ----
} else
{
! curr_closeness = (float) (( ((float) sub_ok) - ((float) sub_no) ) / ((float) sub_count));
}
if (curr_closeness > best_closeness)
Index: common.h
===================================================================
RCS file: /cvsroot/pure-data/externals/frankenstein/common.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** common.h 27 Dec 2005 01:28:51 -0000 1.14
--- common.h 28 Dec 2005 11:47:19 -0000 1.15
***************
*** 78,83 ****
// it will be arranged in a heap list.. ?
! #define num_possible_denominators 11
! static unsigned short int possible_denominators[] = {1,2,3,4,6,8,12,16,18,24,32};
// the minimum percentage for a beat to be considered part of the main rhythm
--- 78,85 ----
// it will be arranged in a heap list.. ?
! //#define num_possible_denominators 11
! //static unsigned short int possible_denominators[] = {1,2,3,4,6,8,12,16,18,24,32};
! #define num_possible_denominators 7
! static unsigned short int possible_denominators[] = {1,2,3,4,6,8,12};
// the minimum percentage for a beat to be considered part of the main rhythm
More information about the Pd-cvs
mailing list