Mercurial > hg > syncopation-dataset
changeset 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 | 82496b4e2f96 |
children | fefbe0d853c6 |
files | Syncopation models/music_objects.py Syncopation models/rhythm_parser.py Syncopation models/syncopation.py |
diffstat | 3 files changed, 14 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/Syncopation models/music_objects.py Sun Apr 12 23:52:08 2015 +0100 +++ b/Syncopation models/music_objects.py Mon Apr 13 17:43:18 2015 +0100 @@ -206,7 +206,7 @@ if inputString in parameter_setter.read_time_signature(): self.tsString = inputString else: - print "Error: undefined time-signature ", inputString + print "Error: undefined time-signature: ", inputString raise NullTimeSignatureError def get_subdivision_sequence(self):
--- a/Syncopation models/rhythm_parser.py Sun Apr 12 23:52:08 2015 +0100 +++ b/Syncopation models/rhythm_parser.py Mon Apr 13 17:43:18 2015 +0100 @@ -1,5 +1,5 @@ ''' -Author: Chunyang Song +Authors: Chunyang Song, Christopher Harte Institution: Centre for Digital Music, Queen Mary University of London ''' @@ -19,15 +19,14 @@ line = line.replace(" ", '').replace("\t", '') return line -def extractInfo(line): - try: - if '{' not in line and '}' not in line: - raise RhythmSyntaxError(line) - else: - return line[line.find('{')+1 : line.find('}')] - except RhythmSyntaxError: - print 'Rhythmic information needs to be enclosed by "{" and "}"' - +# def extractInfo(line): +# try: +# if '{' not in line and '}' not in line: +# raise RhythmSyntaxError(line) +# else: +# return line[line.find('{')+1 : line.find('}')] +# except RhythmSyntaxError: +# print 'Rhythmic information needs to be enclosed by "{" and "}"' def read_rhythm(fileName): @@ -69,7 +68,7 @@ return barList def is_comment(line): - if discard_spaces(line)[0]=="#": + if discard_spaces(line)[0]==comment_sign: return True else: return False
--- a/Syncopation models/syncopation.py Sun Apr 12 23:52:08 2015 +0100 +++ b/Syncopation models/syncopation.py Mon Apr 13 17:43:18 2015 +0100 @@ -4,14 +4,14 @@ ''' -def sync_perbar_permodel (model, bar, parameters): +def sync_perbar_permodel (model, bar, parameters=None): return model.get_syncopation(bar, parameters) - def syncopation_barlist_permodel(model, source, parameters): + def syncopation_barlist_permodel(model, source, parameters=None): total = 0 numberOfNotes = 0 - + for bar in barlist: if sync_perbar_permodel(model, bar, parameters) != None: @@ -102,20 +102,3 @@ # return syncopation - -### TESTING -# clave = [1,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0] -# bf = [0,0,0,1,0,0,0,0,0,0,1,0] -# rhythm = [0,1,0,1,0,1,0,1] -# classic1 = [1,0,1,1]*3 + [1,0,0,0] -# classic2 = [1,0,0,1]*3 + [1,0,0,0] -# shiko = [1,0,1,1,0,1,1,0] -# rumba = [1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0] -# soukous = [1,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0] -# gahu = [1,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0] -# bossanova = [1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0] - -# classic12 = [1,0,0,1,1,1,1,0,0,1,1,1] -# soli = [1,0,1,0,1,0,1,0,1,1,0,1] - -# print sync_perbar(seq = clave, model = 'WNBD', timesig = '4/4')