-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmid2wav.py
57 lines (27 loc) · 906 Bytes
/
mid2wav.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import os
import subprocess
cwd = os.getcwd()
files = [f for f in os.listdir(cwd) if os.path.isfile(f)]
print(files)
sf2 = "./MuseScore_General.sf2"
out_type = "wav"
for file in files:
if file.endswith('.mid'):
filename, file_extension = os.path.splitext(file)
print(f" filename {filename}")
#print(f" file_extension {file_extension}")
#os.rename(filename, filename[2:-2])
#os.rename(filename+'.mid', filename+'.wav')
#os.rename('a.txt', 'b.kml')
midi_file = file
out_file = filename + ".wav"
subprocess.call(['fluidsynth', '-T', out_type, '-F', out_file, '-ni', sf2, midi_file])
"""
inp = "bb_111bpm.mid"
out = "out.wav"
out_type = "wav"
out_file = out
sf2 = "./MuseScore_General.sf2"
midi_file = inp
subprocess.call(['fluidsynth', '-T', out_type, '-F', out_file, '-ni', sf2, midi_file])
"""