Mercurial > hg > syncopation-dataset
comparison Syncopation models/syncopation.py @ 10:a3ed7d2b57d8
updating main py files to point at new
file names
author | christopherh <christopher.harte@eecs.qmul.ac.uk> |
---|---|
date | Fri, 03 Apr 2015 16:02:10 +0100 |
parents | c2843ef4de2c |
children | 4fb9c00e4ef0 |
comparison
equal
deleted
inserted
replaced
9:c2843ef4de2c | 10:a3ed7d2b57d8 |
---|---|
14 elif timesig == None and subdivision_seq == None: | 14 elif timesig == None and subdivision_seq == None: |
15 print 'Error: please indicate either time signature or subdivision sequence.' | 15 print 'Error: please indicate either time signature or subdivision sequence.' |
16 | 16 |
17 else: | 17 else: |
18 while subdivision_seq == None: | 18 while subdivision_seq == None: |
19 from BasicFuncs import get_subdivision_seq | 19 from basic_functions import get_subdivision_seq |
20 subdivision_seq = get_subdivision_seq(timesig, L_max) | 20 subdivision_seq = get_subdivision_seq(timesig, L_max) |
21 | 21 |
22 # The get_rhythm_category function is used to detect rhythm category: monorhythm or polyrhythm. | 22 # The get_rhythm_category function is used to detect rhythm category: monorhythm or polyrhythm. |
23 # For monorhythms, all prime factors of the length of minimum time-span representation of this sequence are | 23 # For monorhythms, all prime factors of the length of minimum time-span representation of this sequence are |
24 # elements of its subdivision_seq, otherwise it is polyrhythm; | 24 # elements of its subdivision_seq, otherwise it is polyrhythm; |
25 # e.g. prime_factors of polyrhythm 100100101010 in 4/4 is [2,3] but subdivision_seq = [1,2,2] for 4/4 | 25 # e.g. prime_factors of polyrhythm 100100101010 in 4/4 is [2,3] but subdivision_seq = [1,2,2] for 4/4 |
26 def get_rhythm_category(): | 26 def get_rhythm_category(): |
27 rhythm_category = 'mono' | 27 rhythm_category = 'mono' |
28 from BasicFuncs import get_min_timeSpan, find_prime_factors | 28 from basic_functions import get_min_timeSpan, find_prime_factors |
29 for f in find_prime_factors(len(get_min_timeSpan(seq))): | 29 for f in find_prime_factors(len(get_min_timeSpan(seq))): |
30 if not (f in subdivision_seq): | 30 if not (f in subdivision_seq): |
31 rhythm_category = 'poly' | 31 rhythm_category = 'poly' |
32 break | 32 break |
33 return rhythm_category | 33 return rhythm_category |