diff Syncopation models/basic_functions.py @ 19:9030967a05f8

Refactored parameter_setter, basic_functions. Halfway fixing parameter argument in LHL model.
author csong <csong@eecs.qmul.ac.uk>
date Fri, 03 Apr 2015 22:57:27 +0100
parents 4fb9c00e4ef0
children b959c2acb927
line wrap: on
line diff
--- a/Syncopation models/basic_functions.py	Fri Apr 03 18:38:10 2015 +0100
+++ b/Syncopation models/basic_functions.py	Fri Apr 03 22:57:27 2015 +0100
@@ -93,53 +93,53 @@
 
 # The get_H returns a sequence of metrical weight for a certain metrical level (horizontal),
 # given the sequence of metrical weights in a hierarchy (vertical) and a sequence of subdivisions.
-def get_H(weight_seq,subdivision_seq, level):
+def get_H(weightSequence,subdivisionSequence, level):
 	H = []
 	#print len(weight_seq), len(subdivision_seq), level
-	if (level <= len(subdivision_seq)-1) & (level <= len(weight_seq)-1):
+	if (level <= len(subdivisionSequence)-1) and (level <= len(weightSequence)-1):
 		if level == 0:
-			H = repeat([weight_seq[0]],subdivision_seq[0])
+			H = repeat([weightSequence[0]],subdivisionSequence[0])
 		else:
-			H_pre = get_H(weight_seq,subdivision_seq,level-1)
+			H_pre = get_H(weightSequence,subdivisionSequence,level-1)
 			for h in H_pre:
-				H = concatenate(H, concatenate([h], repeat([weight_seq[level]],subdivision_seq[level]-1)))
+				H = concatenate(H, concatenate([h], repeat([weightSequence[level]],subdivisionSequence[level]-1)))
 	else:
 		print 'Error: a subdivision factor or metrical weight is not defined for the request metrical level.'
 	return H
 
-# The get_subdivision_seq function returns the subdivision sequence of several common time-signatures defined by GTTM, 
-# or ask for the top three level of subdivision_seq manually set by the user.
-def get_subdivision_seq(timesig, L_max):
-	subdivision_seq = []
+# # The get_subdivision_seq function returns the subdivision sequence of several common time-signatures defined by GTTM, 
+# # or ask for the top three level of subdivision_seq manually set by the user.
+# def get_subdivision_seq(timesig, L_max):
+# 	subdivision_seq = []
 
-	if timesig == '2/4' or timesig == '4/4':
-		subdivision_seq = [1,2,2]
-	elif timesig == '3/4' or timesig == '3/8':
-		subdivision_seq = [1,3,2]
-	elif timesig == '6/8':
-		subdivision_seq = [1,2,3]
-	elif timesig == '9/8':
-		subdivision_seq = [1,3,3]
-	elif timesig == '12/8':
-		subdivision_seq = [1,4,3]
-	elif timesig == '5/4' or timesig == '5/8':
-		subdivision_seq = [1,5,2]
-	elif timesig == '7/4' or timesig == '7/8':
-		subdivision_seq = [1,7,2]
-	elif timesig == '11/4' or timesig == '11/8':
-		subdivision_seq = [1,11,2]
-	else:
-		print 'Time-signature',timesig,'is undefined. Please indicate subdivision sequence for this requested time-signature, e.g. [1,2,2] for 4/4 meter.'
-		for i in range(3):
-			s = int(input('Enter the subdivision factor at metrical level '+str(i)+':'))
-			subdivision_seq.append(s)
+# 	if timesig == '2/4' or timesig == '4/4':
+# 		subdivision_seq = [1,2,2]
+# 	elif timesig == '3/4' or timesig == '3/8':
+# 		subdivision_seq = [1,3,2]
+# 	elif timesig == '6/8':
+# 		subdivision_seq = [1,2,3]
+# 	elif timesig == '9/8':
+# 		subdivision_seq = [1,3,3]
+# 	elif timesig == '12/8':
+# 		subdivision_seq = [1,4,3]
+# 	elif timesig == '5/4' or timesig == '5/8':
+# 		subdivision_seq = [1,5,2]
+# 	elif timesig == '7/4' or timesig == '7/8':
+# 		subdivision_seq = [1,7,2]
+# 	elif timesig == '11/4' or timesig == '11/8':
+# 		subdivision_seq = [1,11,2]
+# 	else:
+# 		print 'Time-signature',timesig,'is undefined. Please indicate subdivision sequence for this requested time-signature, e.g. [1,2,2] for 4/4 meter.'
+# 		for i in range(3):
+# 			s = int(input('Enter the subdivision factor at metrical level '+str(i)+':'))
+# 			subdivision_seq.append(s)
 
-	if L_max > 2:
-		subdivision_seq = subdivision_seq + [2]*(L_max-2)
-	else:
-		subdivision_seq = subdivision_seq[0:L_max+1]
+# 	if L_max > 2:
+# 		subdivision_seq = subdivision_seq + [2]*(L_max-2)
+# 	else:
+# 		subdivision_seq = subdivision_seq[0:L_max+1]
 	
-	return subdivision_seq
+# 	return subdivision_seq
 
 
 def get_rhythm_category(velocitySequence, subdivisionSequence):