Godtone (talk | contribs)
→My Python 3 code: make (more) stuff autoconvert to the correct type and made behaviour of iv_map_err less confusing when x is not a tuple (which represents a rational). also made conversion of interval to integer accept subharmonics
Godtone (talk | contribs)
→Novation Launchpad Pro MK3 isomorphic keyboard code: add support for auto-highlighting any colmap (colour map) using genindices(notes,of,gen)
Line 1,229: Line 1,229:
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 }
# read as "i want [notes] notes of [of] (EDO/other background scale) and the generator is [gen] scalesteps of [of]"
def genindices(notes,of,gen=7):
notesubset = [0]
while len(notesubset) < notes:
notesubset.append( (notesubset[-1] + gen) % of )
return sorted(notesubset)[1:] + [of] # exclude 1/1, include period
# TODO: add more colmaps
# TODO: add more colmaps
import platform # to check whether we're running Windows, in which case we want to use loopMIDI
import platform # to check whether we're running Windows, in which case we want to use loopMIDI
mo = mido.open_output() if platform.system()!='Windows' else mido.open_output([ port for port in mido.get_output_names() if 'loop' in port ][0])
mo = mido.open_output() if platform.system()!='Windows' else mido.open_output([ port for port in mido.get_output_names() if 'loop' in port ][0])
# mo = mido.open_output() # use the same output for entire session
# mo = mido.open_output() # use the same output for entire session
def iso(x=5, y=1, colmap_in=[34], **args):
def iso(x=5, y=1, colmap_in=[34], highlight=[], **args):
global mo
global mo
colmap = colmap_in # make default value immutable
colmap = colmap_in # make default value immutable
Line 1,248: Line 1,254:
else:
else:
print('no colmap in colmaps for',colmap,'notes; using default colmap')
print('no colmap in colmaps for',colmap,'notes; using default colmap')
if highlight:
colmap = [( colmap*math.lcm(len(colmap),len(highlight)) )[i%len(colmap)] if i in [0]+highlight else 3 for i in range(highlight[-1])]
# get arguments with default values
# get arguments with default values
bottomleftnote = args.get('bottomleftnote') or args.get('blnote') or args.get('bl') or args.get('b') or max(x+y,len(colmap))
bottomleftnote = args.get('bottomleftnote') or args.get('blnote') or args.get('bl') or args.get('b') or max(x+y,len(colmap))