Mercurial > hg > syncopation-dataset
diff Syncopation models/syncopation.py @ 23:df1e7c378ee0
fixed KTH, and WNBD
author | csong <csong@eecs.qmul.ac.uk> |
---|---|
date | Sun, 12 Apr 2015 13:06:17 +0100 |
parents | b6daddeefda9 |
children | 5de1cb45c145 |
line wrap: on
line diff
--- a/Syncopation models/syncopation.py Thu Apr 09 23:49:16 2015 +0100 +++ b/Syncopation models/syncopation.py Sun Apr 12 13:06:17 2015 +0100 @@ -7,7 +7,18 @@ def sync_perbar_permodel (model, bar, parameters): return model.get_syncopation(bar, parameters) -# def syncopation_barlist_permodel(model, barlist, parameters): + def syncopation_barlist_permodel(model, barlist, parameters): + total = 0 + numberOfNotes = 0 + for bar in barlist: + if sync_perbar_permodel(model, bar, parameters) != None: + total += sync_perbar_permodel(model, bar, parameters) + numberOfNotes += sum(bar.get_binary_sequence()) + else: + print 'Bar %d cannot be measured, returning None.' % barlist.index(bar) + + if model is WNBD: + total = (float) total/ numberOfNotes # def sync_perbar_permodel(seq, model, timesig = None, subdivision_seq = None, weight_seq = None, L_max = 5, prebar_seq = None, postbar_seq = None, strong_beat_level = None): # syncopation = None