Compare commits

...

3 Commits

Author SHA1 Message Date
Louis Thurman 0a67785da1 Update chords
Chords were too frequent and cause overbearing chord smashes, simplified so that it plays better.
2023-03-07 00:33:11 +00:00
Louis Thurman 17065ed00d Update util script 2023-03-07 00:32:26 +00:00
Louis Thurman 7d0de39b84 Remove chord from pickup notes. 2023-03-07 00:28:10 +00:00
5 changed files with 87 additions and 36 deletions

1
.gitignore vendored
View File

@ -12,4 +12,5 @@ Library-.*
*.aux *.aux
*.log *.log
*.orig *.orig
*.mid
*~ *~

View File

@ -5,6 +5,6 @@ M: C
L: 1/4 L: 1/4
Q: 160 Q: 160
K: Gmaj K: Gmaj
"D" d | "D" d B c d | "G" B>A G d | "G" d B c d | "G" B3 :| d | "D" d B c d | "G" B>A G d | "G" d B c d | "G" B3 :|
"G" B | "D" A F G A | "G" B>A G B | "D" A F G A | "G" B3 B | B | "D" A F G A | "G" B>A G B | "D" A F G A | "G" B3 B |
"D" A F G A | "G" B>A G d | "D" d B c d | "G" B3 :| "D" A F G A | "G" B>A G d | "D" d B c d | "G" B3 :|

View File

@ -7,8 +7,7 @@ M:C
L:1/8 L:1/8
Q:130 Q:130
K:G K:G
"G" GABc A2>G2 | "D" F2D2 D4 | "D" d2A2 "G" d3 "D7" c | "G" B2G2 G4 | "G" GABc "C" A2> G2 | "D" F2D2 D4 | "D" d2A2 d3 c | "G" B2G2 G4 |
"Em" GABc "Am" A2>G2 | "D" F2 FG A2D2 | "C" EFG2 "D7" FGAB | "G" G4 G4 :| "Em" GABc "Am" A2>G2 | "D" F2 FG A2D2 | "C" EFG2 "D7" FGAB | "G" G4 G4 :|
"D" FGA2 FGA2 | "D" d2 "A7" A2 "D" d2 "A7" A2 |\ "D" FGA2 FGA2 | "D" d2 A2 d2 A2 | "C" FG A2 FG A2 | "D" d2 A2 d4 |
"D" FG "A" A2 "D" FG "A" A2 | "D" d2 "A7" A2 "D" d4 | "G" d2cB "Am" c2dc | "Bm" B2AG "C" A3D | "D" EFG2 "C" FGAB | "G" G4 G4 :|
"G" d2cB "D" c2dc | "G" B2AG "D" A3D | "C" EFG2 "D7" FGAB | "G" G4 G4 :|

81
auto_render.py Normal file
View File

@ -0,0 +1,81 @@
#!/usr/bin/python3 -u
import logging
import pathlib
import subprocess
import sys
import time
win_root = pathlib.Path(r"C:\Users\louis\GitKraken\dottes")
lin_root = pathlib.Path("~/dottes")
file_update_times = {}
def run_continuous():
logging.info("Run continous")
pwd = pathlib.Path()
while True:
for obj_path in pwd.rglob("*"):
obj_path_str = str(obj_path)
if not obj_path.is_file():
continue
if not obj_path_str.lower().endswith(".abc"):
continue
if obj_path_str not in file_update_times:
file_update_times[obj_path_str] = obj_path.lstat().st_mtime
else:
if obj_path.lstat().st_mtime > file_update_times[obj_path_str]:
file_update_times[obj_path_str] = obj_path.lstat().st_mtime
convert_single(lin_path=obj_path_str)
def convert_single(win_path: str = None, lin_path: str = None):
if win_path:
input_path = win_path
win_abc_file_path = pathlib.Path(win_path)
lin_abc_file_path = lin_root / win_abc_file_path.relative_to(win_root)
elif lin_path:
input_path = lin_path
lin_abc_file_path = pathlib.Path(lin_path)
else:
raise Exception("Argument win_path or lin_path must be given")
logging.info(f"Converting {input_path}")
out_file_name = lin_abc_file_path.name.rsplit(".", 1)[0] + ".mid"
output_path = lin_abc_file_path.parent / out_file_name
if output_path.exists():
output_path.unlink()
r = subprocess.run(
[
"abc2midi",
lin_abc_file_path.as_posix(),
"-o", output_path.as_posix()
]
)
if r.returncode != 0:
logging.error(f"Error whilst convering {lin_abc_file_path}")
else:
logging.info(f"Converted {input_path} > {output_path}")
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
if len(sys.argv) > 1:
if sys.platform == "win32":
convert_single(win_path=sys.argv[1])
elif sys.platform == "linux":
convert_single(lin_path=sys.argv[1])
else:
raise Exception(f"Unknown platform '{sys.platform}', don't know how to interpret path")
else:
run_continuous()

View File

@ -1,30 +0,0 @@
import os
import pathlib
import subprocess
import sys
win_root = pathlib.Path(r"C:\Users\louis\GitKraken\dottes")
lin_root = pathlib.Path("~/dottes")
try:
win_abc_file_path = pathlib.Path(sys.argv[1])
except IndexError:
win_abc_file_path = pathlib.Path(input())
if not str(win_abc_file_path).lower().endswith(".abc"):
input("Doesn't look like an abc file.")
exit(1)
lin_abc_file_path = lin_root / win_abc_file_path.relative_to(win_root)
out_file_name = lin_abc_file_path.name.rsplit(".", 1)[0] + ".mid"
lin_output_path = lin_abc_file_path.parent / out_file_name
win_output_path = win_abc_file_path.parent / out_file_name
if win_output_path.exists():
win_output_path.unlink()
command = f"abc2midi {lin_abc_file_path.as_posix()} -o {lin_output_path.as_posix()}"
print("Command:", command)
r = subprocess.run([r"wsl"], input=command.encode())
os.system(str(win_output_path))