Added utility for converting midi files to csv

This is a pure monophonic converter but should still help quite a bit with importing existing projects from LMMS or OpenMPT.
This commit is contained in:
Minki 2024-01-02 20:02:22 +00:00
parent 52c3ce5ac8
commit 75f9938727
3 changed files with 1149 additions and 0 deletions

30
utils/beep2offitracker.py Normal file
View File

@ -0,0 +1,30 @@
import sys
def generate_beep_file(beep_command):
lines = beep_command.split('-n')
output_lines = ["Frequency1,Effect1,Duration"]
for line in lines:
if '-f' in line:
parts = line.split()
frequency = int(parts[parts.index('-f') + 1])
duration = int(parts[parts.index('-l') + 1])
output_lines.append(f"{frequency},50,{duration}")
if '-D' in line:
delay = int(parts[parts.index('-D') + 1])
if delay > 0:
output_lines.append(f"0,0,{delay}")
output_content = '\n'.join(output_lines)
return output_content
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python script.py 'beep_command'")
else:
beep_command = sys.argv[1]
result = generate_beep_file(beep_command)
print(result)

2
utils/midi2csv.sh Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
python3 beep2offitracker.py "beep $(python2 python-midi-beeper-tobash.py $1)"

File diff suppressed because it is too large Load Diff