diff Syncopation models/basic_functions.py @ 32:273450d5980a

tested parameter setting.
author csong <csong@eecs.qmul.ac.uk>
date Sun, 12 Apr 2015 23:23:32 +0100
parents 7a1730bbf15a
children 6371e8f21f7d
line wrap: on
line diff
--- a/Syncopation models/basic_functions.py	Sun Apr 12 22:43:55 2015 +0100
+++ b/Syncopation models/basic_functions.py	Sun Apr 12 23:23:32 2015 +0100
@@ -82,8 +82,10 @@
 # upsample a velocity sequence to certain length, e.g. [1,1] to [1,0,0,0,1,0,0,0]
 def upsample_velocity_sequence(velocitySequence, length):
 	upsampledVelocitySequence = None
-	if length%len(velocitySequence) != 0:
-		print 'Error: the velocity sequence can only be upsampled to the interger times of its length.'
+	if length < len(velocitySequence):
+		print 'Error: the requested upsampling length needs to be longer than velocity sequence.'
+	elif length % len(velocitySequence) != 0:
+		print 'Error: velocity sequence can only be upsampled to a interger times of its own length.'
 	else:
 		upsampledVelocitySequence = [0]*length
 		scalingFactor = length/len(velocitySequence)