Spaces:
Running
on
Zero
Running
on
Zero
asigalov61
commited on
Commit
•
e091417
1
Parent(s):
9c5d216
Update midi_synthesizer.py
Browse files- midi_synthesizer.py +5 -2
midi_synthesizer.py
CHANGED
@@ -24,7 +24,7 @@ def synthesis(midi_opus, soundfont_path, sample_rate=44100):
|
|
24 |
if c == 9:
|
25 |
fl.program_select(c, sfid, 128, 0)
|
26 |
else:
|
27 |
-
fl.program_select(c, sfid, list_of_MIDI_patches[c]
|
28 |
for event in event_list:
|
29 |
name = event[0]
|
30 |
sample_len = int(((event[1] / ticks_per_beat) * tempo / (10 ** 6)) * sample_rate)
|
@@ -37,7 +37,10 @@ def synthesis(midi_opus, soundfont_path, sample_rate=44100):
|
|
37 |
tempo = event[2]
|
38 |
elif name == "patch_change":
|
39 |
c, p = event[2:4]
|
40 |
-
|
|
|
|
|
|
|
41 |
elif name == "control_change":
|
42 |
c, cc, v = event[2:5]
|
43 |
fl.cc(c, cc, v)
|
|
|
24 |
if c == 9:
|
25 |
fl.program_select(c, sfid, 128, 0)
|
26 |
else:
|
27 |
+
fl.program_select(c, sfid, 0, list_of_MIDI_patches[c])
|
28 |
for event in event_list:
|
29 |
name = event[0]
|
30 |
sample_len = int(((event[1] / ticks_per_beat) * tempo / (10 ** 6)) * sample_rate)
|
|
|
37 |
tempo = event[2]
|
38 |
elif name == "patch_change":
|
39 |
c, p = event[2:4]
|
40 |
+
if c == 9:
|
41 |
+
fl.program_select(c, sfid, 128, 0)
|
42 |
+
else:
|
43 |
+
fl.program_select(c, sfid, 0, p)
|
44 |
elif name == "control_change":
|
45 |
c, cc, v = event[2:5]
|
46 |
fl.cc(c, cc, v)
|