From 9136b88c1215ecdcc65479081ee11126db3199b4 Mon Sep 17 00:00:00 2001 From: laqieer Date: Mon, 2 May 2022 17:19:21 +0800 Subject: [PATCH] Add script to omit volume 127 at the start of track for MML compatible mode and use it to match song701. --- scripts/omit_volume_127.py | 21 +++++++++++++++++++++ songs.mk | 2 +- sound/songs/midi/song701.mid | Bin 68 -> 64 bytes 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 scripts/omit_volume_127.py diff --git a/scripts/omit_volume_127.py b/scripts/omit_volume_127.py new file mode 100644 index 00000000..98a764f5 --- /dev/null +++ b/scripts/omit_volume_127.py @@ -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) diff --git a/songs.mk b/songs.mk index ff1b110f..91e8285e 100644 --- a/songs.mk +++ b/songs.mk @@ -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 diff --git a/sound/songs/midi/song701.mid b/sound/songs/midi/song701.mid index ebcb589021d1002f2612a89edfc55abd8d68c3cd..844f0d9b6a3b33e57a8f3e082942981c8d83f72f 100644 GIT binary patch delta 21 ccmZ>9m|!5l&v1a7VS-J)M}rLm!+(7S06j_ttN;K2 delta 25 gcmZ>8nP4Cy%&>vIp5XvD!vvdpj|LkChX48u09Zi=>Hq)$