forked from mangelroman/audio2score
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert_midi.py
More file actions
26 lines (22 loc) · 749 Bytes
/
convert_midi.py
File metadata and controls
26 lines (22 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
import sys
sys.path.insert(1, 'C:\\Users\\WorkStation\\Documents\\GitHub\\a2s_project\\EasyABC')
import midi2abc as m
import glob
import mido
# Converts midi file to abc file
def midi_to_abc_and_write(input_file, output_file):
abc = m.midi_to_abc(input_file)
open(output_file, 'w').write(abc)
def midi_to_abc(midi_file_path):
abc = m.midi_to_abc(os.getcwd()+midi_file_path)
return(abc)
# Converts all .mid files to .abc:
if __name__ == '__main__':
"""
for path in os.listdir():
input_file = glob.glob(os.path.join(path,'*.mid'))[0]
output_file = input_file.replace('.mid','.abc')
print(output_file)
midi_to_abc_and_write(input_file,output_file)
"""