comparison Syncopation models/synpy/PRS.py @ 50:e71028851131

updating latex and bug fixes to main py files
author christopherh <christopher.harte@eecs.qmul.ac.uk>
date Mon, 27 Apr 2015 09:51:15 +0100
parents 6e9154fc58df
children
comparison
equal deleted inserted replaced
49:af3f32cebf8c 50:e71028851131
36 return normalised 36 return normalised
37 37
38 def get_syncopation(bar, parameters = None): 38 def get_syncopation(bar, parameters = None):
39 syncopation = None 39 syncopation = None
40 40
41 binarySequence = bar.get_binary_sequence() 41 binarySequence = velocity_sequence_to_min_timespan(bar.get_binary_sequence())
42 subdivisionSequence = bar.get_subdivision_sequence() 42 subdivisionSequence = bar.get_subdivision_sequence()
43 43
44 # PRS does not handle polyrhythms 44 # PRS does not handle polyrhythms
45 if get_rhythm_category(binarySequence, subdivisionSequence) == 'poly': 45 if get_rhythm_category(binarySequence, subdivisionSequence) == 'poly':
46 print 'Warning: PRS model detects polyrhythms so returning None.' 46 print 'Warning: PRS model detects polyrhythms so returning None.'
47 elif bar.is_empty():
48 print 'Warning: PRS model detects empty bar so returning None.'
47 else: 49 else:
48 syncopation = 0 50 syncopation = 0
49 51
50 # retrieve the binary sequence in the next bar 52 # retrieve the binary sequence in the next bar
51 if bar.get_next_bar() != None: 53 if bar.get_next_bar() != None: