Godtone (talk | contribs)
m →My Python 3 code: add EDO error function that rewards accuracy rather than inaccuracy (a novel way of ranking EDOs)
Godtone (talk | contribs)
→Novation Launchpad Pro MK3 isomorphic keyboard code: make rb17 match rb17v2 and add circle() function
Line 1,329: Line 1,329:
def cols(cs, n, offset=0.4):
def cols(cs, n, offset=0.4):
return [ cs[round( i/n*len(cs)+offset )%len(cs)] for i in range(n) ]
return [ cs[round( i/n*len(cs)+offset )%len(cs)] for i in range(n) ]
rb17v2 = cols(rb29,17)
rb17v2 = cols(rb29,17)[-1:] + cols(rb29,17)[:-1] # rotate to match rb17
rb19 = cols(rb29,19)
rb19 = cols(rb29,19)
rb28 = [c for c in rb29 if c!=95]
rb28 = [c for c in rb29 if c!=95]
Line 1,335: Line 1,335:
rb26 = [c for c in rb27 if c!=37]
rb26 = [c for c in rb27 if c!=37]
rb25 = [c for c in rb26 if c!=74]
rb25 = [c for c in rb26 if c!=74]
colmaps = { 12: rb12, 13: rb13, 16: cm16, 17: rb17v2, 18: rb18, 19: rb19, 25: rb25, 26: rb26, 27: rb27, 28: rb28, 29: rb29, 30: rb30, 31: rb31, 34: rb34, 36: rb36 }
colmaps = { 12: rb12, 13: rb13, 16: cm16, 17: rb17v2, 18: rb18, 19: rb19, 25: rb25, 26: rb26, 27: rb27, 28: rb28, 29: rb29, 30: rb30, 31: rb31, 34: rb34, 36: rb36 }
# for example, if you're using 34 EDO and you want a 1\2 = 17\34 period
# (so that notes separated by an integer multiple of the period are the same)
# you can use a 17-colour rainbow (either rb17 or rb17v2) and use
def circle(gen,rb):
result = [0]*len(rb)
for i in range(len(rb)):
result[i*gen%len(rb)] = rb[i]
return result
# read as "i want [notes] notes of [of] (EDO/other background scale) and the generator is [gen] scalesteps of [of]".
# read as "i want [notes] notes of [of] (EDO/other background scale) and the generator is [gen] scalesteps of [of]".
# if you want to use the (0-indexed) [tonic]th degree as the tonic specify it as the 4th argument [tonic] > 0.
# if you want to use the (0-indexed) [tonic]th degree as the tonic specify it as the 4th argument [tonic] > 0.
Line 1,389: Line 1,399:
or args.get('distinct_buttons') or args.get('distinct') or args.get('d') # (d for double)
or args.get('distinct_buttons') or args.get('distinct') or args.get('d') # (d for double)
or False ) # whether to interpret the half-buttons as being two buttons for the same note or a single button
or False ) # whether to interpret the half-buttons as being two buttons for the same note or a single button
# generate circle of nths based on gen
g = args.get('g') or args.get('gen') or args.get('similar')
colmap = circle(g,colmap)
# find launchpad output (what we send colour (col) data to)
# find launchpad output (what we send colour (col) data to)