Mercurial > hg > syncopation-dataset
comparison Syncopation models/music_objects.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 | 43fa04812800 |
children | b6daddeefda9 |
comparison
equal
deleted
inserted
replaced
19:9030967a05f8 | 20:b959c2acb927 |
---|---|
94 | 94 |
95 def get_subdivision_sequence(self): | 95 def get_subdivision_sequence(self): |
96 return self.timeSignature.get_subdivision_sequence() | 96 return self.timeSignature.get_subdivision_sequence() |
97 | 97 |
98 def get_beat_level(self): | 98 def get_beat_level(self): |
99 return ParameterSetter.get_beat_level(self.timeSignature) | 99 return self.timeSignature.get_beat_level() |
100 | 100 |
101 def get_time_signature(self): | 101 def get_time_signature(self): |
102 return self.timeSignature | 102 return self.timeSignature |
103 | 103 |
104 def get_t_span(self): | 104 def get_t_span(self): |
105 # return the length of a bar in time units | 105 # return the length of a bar in time units |
106 return None # NEED TO IMPLEMENT | 106 return None # NEED TO IMPLEMENT |
107 | 107 |
108 class TimeSignature(): | 108 class TimeSignature(): |
109 def __init__(self, inputString): | 109 def __init__(self, inputString): |
110 if inputString in parameter_setter.readTimesig(): | 110 if inputString in parameter_setter.read_time_signature(): |
111 self.tsString = inputString | 111 self.tsString = inputString |
112 else: | 112 else: |
113 print "Error: undefined time-signature ", inputString | 113 print "Error: undefined time-signature ", inputString |
114 raise NullTimeSignatureError | 114 raise NullTimeSignatureError |
115 | 115 |
116 def get_subdivision_sequence(self): | 116 def get_subdivision_sequence(self): |
117 return parameter_setter.timesigBase[self.tsString][0] | 117 return parameter_setter.timeSignatureBase[self.tsString][0] |
118 | 118 |
119 def get_beat_level(self): | 119 def get_beat_level(self): |
120 return parameter_setter.timesigBase[self.tsString][1] | 120 return parameter_setter.timeSignatureBase[self.tsString][1] |
121 | 121 |
122 def get_numerator(self): | 122 def get_numerator(self): |
123 return int(self.tsString.split('/')[0]) | 123 return int(self.tsString.split('/')[0]) |
124 | 124 |
125 def get_denominator(self): | 125 def get_denominator(self): |