csv_to_score.py : UPdated 20240522

This commit is contained in:
kevin 2024-05-22 17:53:49 -04:00
parent d7539559b7
commit f1f784866a

View File

@ -30,15 +30,15 @@ def invert_velocity( d1 ):
if d1 == 0: if d1 == 0:
return 0 return 0
d1 = max(1,int(d1/6)) d1 = max(1,int(d1/5))
for i,v in enumerate(tbl): for i,v in enumerate(tbl):
if d1 <= v: if d1 < v:
return i return max(0,i-1)
return len(tbl)-1 return len(tbl)-1
def parse_scriabin( ifn ): def parse_scriabin( ifn ):
@ -475,7 +475,7 @@ if __name__ == "__main__":
out_dir= "data/score_scriabin/20240428" out_dir= "data/score_scriabin/20240428"
in_preset_fn = "preset_select/m1_458_trans_5.txt" in_preset_fn = "preset_select/m1_458_trans_5.txt"
out_preset_fn = "preset_select/m1_458_trans_5_scriabin_2.txt" out_preset_fn = "preset_select/m1_458_trans_5_scriabin_4.txt"
score_fn = os.path.join(base_dir, score_fn) score_fn = os.path.join(base_dir, score_fn)
out_dir = os.path.join(base_dir, out_dir) out_dir = os.path.join(base_dir, out_dir)
@ -648,18 +648,19 @@ if __name__ == "__main__":
else: else:
scoreL = insert_scriabin( scoreL, noteL, f['src'], f['insert_loc'], f['after_fl'], f['delta_sec'] ) scoreL = insert_scriabin( scoreL, noteL, f['src'], f['insert_loc'], f['after_fl'], f['delta_sec'] )
assign_loc(scoreL)
olocMapD = assign_oloc(scoreL)
max_oloc = max( r['oloc'] for r in scoreL if r['oloc'] )
print(f"max oloc:{max_oloc}") if 1:
assign_loc(scoreL)
write_output( out_dir, out_fn, scoreL, 0, max_oloc, fieldnamesL )
remap_preset_locs( in_preset_fn, out_preset_fn, olocMapD ) olocMapD = assign_oloc(scoreL)
gen_reference( scoreL, out_dir, ref_fn ) max_oloc = max( r['oloc'] for r in scoreL if r['oloc'] )
print(f"max oloc:{max_oloc}")
write_output( out_dir, out_fn, scoreL, 0, max_oloc, fieldnamesL )
remap_preset_locs( in_preset_fn, out_preset_fn, olocMapD )
gen_reference( scoreL, out_dir, ref_fn )