Mercurial > hg > syncopation-dataset
comparison Syncopation models/syncopation.py @ 35:3a878de00d19
made some small changes to files
author | csong <csong@eecs.qmul.ac.uk> |
---|---|
date | Mon, 13 Apr 2015 17:43:18 +0100 |
parents | 5de1cb45c145 |
children | cc38b3047ed9 |
comparison
equal
deleted
inserted
replaced
34:82496b4e2f96 | 35:3a878de00d19 |
---|---|
2 Author: Chunyang Song | 2 Author: Chunyang Song |
3 Institution: Centre for Digital Music, Queen Mary University of London | 3 Institution: Centre for Digital Music, Queen Mary University of London |
4 | 4 |
5 ''' | 5 ''' |
6 | 6 |
7 def sync_perbar_permodel (model, bar, parameters): | 7 def sync_perbar_permodel (model, bar, parameters=None): |
8 return model.get_syncopation(bar, parameters) | 8 return model.get_syncopation(bar, parameters) |
9 | 9 |
10 def syncopation_barlist_permodel(model, source, parameters): | 10 def syncopation_barlist_permodel(model, source, parameters=None): |
11 total = 0 | 11 total = 0 |
12 numberOfNotes = 0 | 12 numberOfNotes = 0 |
13 | 13 |
14 | 14 |
15 | 15 |
16 for bar in barlist: | 16 for bar in barlist: |
17 if sync_perbar_permodel(model, bar, parameters) != None: | 17 if sync_perbar_permodel(model, bar, parameters) != None: |
18 total += sync_perbar_permodel(model, bar, parameters) | 18 total += sync_perbar_permodel(model, bar, parameters) |
19 numberOfNotes += sum(bar.get_binary_sequence()) | 19 numberOfNotes += sum(bar.get_binary_sequence()) |
100 # if sync_perbar != None: | 100 # if sync_perbar != None: |
101 # syncopation = syncopation + sync_perbar | 101 # syncopation = syncopation + sync_perbar |
102 | 102 |
103 # return syncopation | 103 # return syncopation |
104 | 104 |
105 | |
106 ### TESTING | |
107 # clave = [1,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0] | |
108 # bf = [0,0,0,1,0,0,0,0,0,0,1,0] | |
109 # rhythm = [0,1,0,1,0,1,0,1] | |
110 # classic1 = [1,0,1,1]*3 + [1,0,0,0] | |
111 # classic2 = [1,0,0,1]*3 + [1,0,0,0] | |
112 # shiko = [1,0,1,1,0,1,1,0] | |
113 # rumba = [1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0] | |
114 # soukous = [1,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0] | |
115 # gahu = [1,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0] | |
116 # bossanova = [1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0] | |
117 | |
118 # classic12 = [1,0,0,1,1,1,1,0,0,1,1,1] | |
119 # soli = [1,0,1,0,1,0,1,0,1,1,0,1] | |
120 | |
121 # print sync_perbar(seq = clave, model = 'WNBD', timesig = '4/4') |