Add script to omit volume 127 at the start of track for MML compatible mode and use it to match song701.

This commit is contained in:
laqieer 2022-05-02 17:19:21 +08:00
parent b34d847e0b
commit 9136b88c12
3 changed files with 22 additions and 1 deletions

View File

@ -0,0 +1,21 @@
import py_midicsv as pm
import sys
for song in sys.argv[1:]:
data = pm.midi_to_csv(f'sound/songs/midi/{song}.mid')
for i in range(len(data)):
line = data[i]
start_track = False
if 'Start_track' in line:
start_track = True
if 'Control_c' in line and line[-4:] == '127\n':
data[i] = ''
start_track = False
midi_object = pm.csv_to_midi(data)
with open(f'sound/songs/midi/{song}.mid', "wb") as output_file:
midi_writer = pm.FileWriter(output_file)
midi_writer.write(midi_object)

View File

@ -1364,7 +1364,7 @@ $(MID_SUBDIR)/song700.s: %.s: %.mid
$(MID2AGB) $< $@ -E -G036 -P020 -V100 -M
$(MID_SUBDIR)/song701.s: %.s: %.mid
$(MID2AGB) $< $@ -E -G036 -P020 -V127
$(MID2AGB) $< $@ -E -G036 -P020 -V127 -M
$(MID_SUBDIR)/song702.s: %.s: %.mid
$(MID2AGB) $< $@ -E -G036 -P020 -V104

Binary file not shown.