Mercurial > hg > syncopation-dataset
comparison Syncopation models/PRS.py @ 38:cc38b3047ed9
updated syncopation.y to allow output of sync for a bar list
also fixed some problems in models and other modules
author | christopherh <christopher.harte@eecs.qmul.ac.uk> |
---|---|
date | Mon, 13 Apr 2015 23:06:49 +0100 |
parents | df1e7c378ee0 |
children |
comparison
equal
deleted
inserted
replaced
37:fefbe0d853c6 | 38:cc38b3047ed9 |
---|---|
23 | 23 |
24 return cost | 24 return cost |
25 | 25 |
26 # This function calculates the syncopation value (cost) for the sequence with the postbar_seq for a certain level. | 26 # This function calculates the syncopation value (cost) for the sequence with the postbar_seq for a certain level. |
27 def syncopation_perlevel(subSequences): | 27 def syncopation_perlevel(subSequences): |
28 print 'subSequences', subSequences | 28 #print 'subSequences', subSequences |
29 total = 0 | 29 total = 0 |
30 for l in range(len(subSequences)-1): | 30 for l in range(len(subSequences)-1): |
31 print 'cost', get_cost(subSequences[l], subSequences[l+1]) | 31 #print 'cost', get_cost(subSequences[l], subSequences[l+1]) |
32 total = total + get_cost(subSequences[l], subSequences[l+1]) | 32 total = total + get_cost(subSequences[l], subSequences[l+1]) |
33 print 'total this level', total | 33 #print 'total this level', total |
34 normalised = float(total)/(len(subSequences)-1) | 34 normalised = float(total)/(len(subSequences)-1) |
35 | 35 |
36 return normalised | 36 return normalised |
37 | 37 |
38 def get_syncopation(bar, parameters = None): | 38 def get_syncopation(bar, parameters = None): |