Mercurial > hg > syncopation-dataset
comparison Syncopation models/rhythm_parser.py @ 20:b959c2acb927
Refactored all models except for KTH, all past testing except for SG.
author | csong <csong@eecs.qmul.ac.uk> |
---|---|
date | Tue, 07 Apr 2015 19:05:07 +0100 |
parents | a3ed7d2b57d8 |
children | 7a1730bbf15a |
comparison
equal
deleted
inserted
replaced
19:9030967a05f8 | 20:b959c2acb927 |
---|---|
4 ''' | 4 ''' |
5 | 5 |
6 # Parse the rhythm file and return a list of Bar objects | 6 # Parse the rhythm file and return a list of Bar objects |
7 Piece = [] | 7 Piece = [] |
8 | 8 |
9 from parameter_setter import timesigBase | 9 from parameter_setter import timeSignatureBase |
10 | 10 |
11 | 11 |
12 comment_sign = '#' | 12 comment_sign = '#' |
13 def discardComments(line): | 13 def discardComments(line): |
14 if comment_sign in line: | 14 if comment_sign in line: |
96 | 96 |
97 # To check whether the given time-signature is existed; if not then requires user to add in the new time-signature | 97 # To check whether the given time-signature is existed; if not then requires user to add in the new time-signature |
98 #def checkTimesig(input): | 98 #def checkTimesig(input): |
99 | 99 |
100 | 100 |
101 # TESTING | 101 # # TESTING |
102 line = 't{4/4} q{1,0,0,1,0,0,1,0,0,0,1,0,0.8,0,0,0} t{2/4} # This is a comment' | 102 # line = 't{4/4} q{1,0,0,1,0,0,1,0,0,0,1,0,0.8,0,0,0} t{2/4} # This is a comment' |
103 # print discardSpaces(discardComments(line)) | 103 # # print discardSpaces(discardComments(line)) |
104 print line[line.find('{')+1:line.find('}')] | 104 # print line[line.find('{')+1:line.find('}')] |
105 #print readRhythm("rhythmbase/testrhythm.txt") | 105 # #print readRhythm("rhythmbase/testrhythm.txt") |
106 | 106 |