comparison Syncopation models/parameter_setter.py @ 33:f5abd2e8cafe

update models
author csong
date Sun, 12 Apr 2015 23:51:05 +0100
parents 273450d5980a
children
comparison
equal deleted inserted replaced
32:273450d5980a 33:f5abd2e8cafe
79 # 1. if Lmax is a non-negative integer 79 # 1. if Lmax is a non-negative integer
80 # 2. if Lmax is higher than the length of weightSequence and subdivisionSequence 80 # 2. if Lmax is higher than the length of weightSequence and subdivisionSequence
81 def is_Lmax_valid(): 81 def is_Lmax_valid():
82 isValid = False 82 isValid = False
83 if isinstance(Lmax,int) and Lmax > 0: 83 if isinstance(Lmax,int) and Lmax > 0:
84 if Lmax <= len(subdivisionSequence): 84 if Lmax <= len(subdivisionSequence)-1:
85 if Lmax <= len(weightSequence): 85 if Lmax <= len(weightSequence)-1:
86 isValid = True 86 isValid = True
87 else: 87 else:
88 print """Error: Lmax exceeds the length of subdivision-sequence. 88 print 'Error: Lmax exceeds the length of weight-sequence. Either reduce Lmax, or provide a new weight-sequence whose length is greater or equal to Lmax.'
89 Either reduce Lmax, or extend subdivision-sequence through updating time-signature (refer to update_time_signature function). """
90 else: 89 else:
91 print """Error: Lmax exceeds the length of weight-sequence. Either reduce Lmax, or provide a new weight-sequence 90 print 'Error: Lmax exceeds the length of subdivision-sequence. Either reduce Lmax, or extend subdivision-sequence through updating time-signature (refer to update_time_signature function).'
92 whose length is greater or equal to Lmax."""
93 else: 91 else:
94 print 'Error: Lmax needs to be a positive integer.' 92 print 'Error: Lmax needs to be a positive integer.'
95 return isValid 93 return isValid
96 94
97 # is_weight_sequence_valid() checks: 95 # is_weight_sequence_valid() checks: