Godtone
Joined 17 December 2020
→My Python 3 code: temp coordinates and interval mappings (using cents for this for now as i didnt want to make the code too complex/didnt wanna generalise prematurely and using other measurements can be done manually still using "temp_gen_iv" and "steps") |
|||
| Line 853: | Line 853: | ||
def maxringer(edo): | def maxringer(edo): | ||
return max(base_ringer(edo)[0],base_ringer(edo,1)[0],base_ringer(edo,-1)[0]) | return max(base_ringer(edo)[0],base_ringer(edo,1)[0],base_ringer(edo,-1)[0]) | ||
# this function is experimental and has a higher chance of bugs/unexpected behaviour | |||
def genRinger(oddlim,edo,warts,tendency=0): | |||
if oddlim%2==1: | |||
oddlim+=1 | |||
h=[k for k in range(oddlim//2,oddlim+1)] | |||
i = 0 | |||
basev=val(lim(oddlim*4),ed(edo),warts,tendency) | |||
wadd=[] | |||
while i+1 < len(h): | |||
x=iv(h[i+1],h[i]) | |||
m = map_iv(basev,x) | |||
if m==1: | |||
i+=1 # no filler needed | |||
continue | |||
elif m>1: | |||
y=iv(h[i]*2+1,h[i]*2) | |||
if in_subgroup(y,lim(oddlim)): | |||
if map_iv(basev,y) < m: | |||
h = h[:i+1] + [h[i]*2+1] + h[i+1:] | |||
i+=2 | |||
continue | |||
else: | |||
print(striv(x)+' is mapped to 2 steps but '+striv(y)+' is mapped to '+str(map_iv(basev,y))+' steps!') | |||
i+=1 | |||
continue | |||
else: | |||
f=fact_int(h[i]*2+1) | |||
wp=prime_idx(len(f)-1) | |||
if map_iv(basev,y)==1: | |||
h = h[:i+1] + [h[i]*2+1] + h[i+1:] | |||
i+=2 | |||
continue | |||
else: | |||
m2=map_iv( val(lim(oddlim*4),ed(edo),warts+wadd+[wp],tendency), y ) | |||
if m2 < m: | |||
h = h[:i+1] + [h[i]*2+1] + h[i+1:] | |||
wadd.append(wp) | |||
i+=2 | |||
continue | |||
else: | |||
print(striv(y)+'\'s mapping could not trivially be fixed!') | |||
i+=1 | |||
continue | |||
else: | |||
print(striv(x)+' is mapped to '+str(m)+' steps! (bad val)') | |||
i+=1 | |||
continue | |||
return ':'.join([ str(k)+('' if k<=oddlim else '/2') for k in h ]) | |||
def toneji(strneji,minimalmode=False): | def toneji(strneji,minimalmode=False): | ||