diff Syncopation models/music_objects.py @ 21:b6daddeefda9

working on KTH
author csong <csong@eecs.qmul.ac.uk>
date Tue, 07 Apr 2015 23:16:13 +0100
parents b959c2acb927
children 2dbc09ca8013
line wrap: on
line diff
--- a/Syncopation models/music_objects.py	Tue Apr 07 19:05:07 2015 +0100
+++ b/Syncopation models/music_objects.py	Tue Apr 07 23:16:13 2015 +0100
@@ -1,5 +1,5 @@
 
-from basic_functions import ceiling, string_to_sequence
+from basic_functions import ceiling, string_to_sequence, calculate_time_span_ticks
 
 import parameter_setter 
 import rhythm_parser 
@@ -68,13 +68,13 @@
 		self.prevBar = prevBar
 
 	def get_note_sequence(self):
-		#if self.noteSequence==None:
-		#	self.noteSequence = velocity_sequence_to_notes(self.velocitySequence)
+		if self.noteSequence==None:
+			self.noteSequence = velocity_sequence_to_notes(self.velocitySequence)
 		return self.noteSequence
 
 	def get_velocity_sequence(self):
 		if self.velocitySequence==None:
-			self.velocitySequence = note_sequence_to_velocities(self.velocitySequence)
+			self.velocitySequence = note_sequence_to_velocities(self.noteSequence)
 		return self.velocitySequence
 
 	def get_binary_sequence(self):
@@ -101,9 +101,9 @@
 	def get_time_signature(self):
 		return self.timeSignature
 
-	def get_t_span(self):
-		# return the length of a bar in time units
-		return None # NEED TO IMPLEMENT
+	# return the length of a bar in time units (ticks)
+	def get_time_span(self):
+		return calculate_time_span_ticks(self.timeSignature.get_numerator(),self.timeSignature.get_denominator(), self.ticksPerQuarter)
 
 class TimeSignature():
 	def __init__(self, inputString):