75f9938727
This is a pure monophonic converter but should still help quite a bit with importing existing projects from LMMS or OpenMPT.
31 lines
873 B
Python
31 lines
873 B
Python
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)
|
|
|