From 29380d4151bb7b4b297f3358fa9f46d7829de068 Mon Sep 17 00:00:00 2001 From: EillesWan Date: Sun, 24 Sep 2023 12:44:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=94=9F=E6=88=90=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE.md | 2 +- Musicreater/__init__.py | 4 ++-- Musicreater/main.py | 36 +++++++++++++++++++----------- Musicreater/plugin/mcstructure.py | 18 +++++++-------- example.py | 2 +- resources/音乐测试片段版权声明.txt | 14 ++++++++++++ 6 files changed, 50 insertions(+), 26 deletions(-) create mode 100644 resources/音乐测试片段版权声明.txt diff --git a/LICENSE.md b/LICENSE.md index 1a5a125..98b28e0 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -203,7 +203,7 @@ END OF TERMS AND CONDITIONS - Copyright 2022 TriM-Organization 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & all the developers of Musicreater + Copyright 2023 TriM-Organization 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & all the developers of Musicreater Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/Musicreater/__init__.py b/Musicreater/__init__.py index eff8a71..973af20 100644 --- a/Musicreater/__init__.py +++ b/Musicreater/__init__.py @@ -17,8 +17,8 @@ Terms & Conditions: License.md in the root directory # 若需转载或借鉴 许可声明请查看仓库目录下的 License.md -__version__ = "1.5.0" -__vername__ = "修改附加包插件的调用方式,新增播放终止函数,文档内容增强" +__version__ = "1.5.1" +__vername__ = "优化生成结构,提高生成效率,完善版权说明" __author__ = ( ("金羿", "Eilles Wan"), ("诸葛亮与八卦阵", "bgArray"), diff --git a/Musicreater/main.py b/Musicreater/main.py index 1468407..add33dc 100644 --- a/Musicreater/main.py +++ b/Musicreater/main.py @@ -603,7 +603,7 @@ class MidiConvert: speed: float = 1.0, ) -> Tuple[List[List[SingleCommand]], int, int]: """ - 使用金羿的转换思路,将midi转换为我的世界命令列表 + 将midi转换为我的世界命令列表 Parameters ---------- @@ -655,6 +655,9 @@ class MidiConvert: score_now = round(msg[-1] / float(speed) / 50) maxScore = max(maxScore, score_now) mc_pitch = "" if SpecialBits else 2 ** ((msg[1] - 60 - _X) / 12) + mc_distance_volume = 128 / max_volume / msg[2] + ( + 1 if SpecialBits else -1 + ) nowTrack.append( SingleCommand( @@ -666,7 +669,10 @@ class MidiConvert: .replace(")", r"}") ) + "playsound {} @s ^ ^ ^{} {} {}".format( - soundID, 1 / max_volume - 1, msg[2] / 128, mc_pitch + soundID, + mc_distance_volume, + msg[2] / 128, + mc_pitch, ), annotation="在{}播放{}%的{}音".format( mctick2timestr(score_now), @@ -694,7 +700,7 @@ class MidiConvert: player_selector: str = "@a", ) -> Tuple[List[SingleCommand], int, int]: """ - 使用金羿的转换思路,将midi转换为我的世界命令列表,并输出每个音符之后的延迟 + 将midi转换为我的世界命令列表,并输出每个音符之后的延迟 Parameters ---------- @@ -744,25 +750,29 @@ class MidiConvert: ) delaytime_now = round(msg[-1] / float(speed) / 50) + mc_pitch = "" if SpecialBits else 2 ** ((msg[1] - 60 - _X) / 12) + mc_distance_volume = 128 / max_volume / msg[2] + ( + 1 if SpecialBits else -1 + ) try: tracks[delaytime_now].append( self.execute_cmd_head.format(player_selector) - + f"playsound {soundID} @s ^ ^ ^{128 / max_volume / msg[2] - 1} {msg[2] / 128} " - + ( - "" - if SpecialBits - else f"{2 ** ((msg[1] - 60 - _X) / 12)}" + + "playsound {} @s ^ ^ ^{} {} {}".format( + soundID, + mc_distance_volume, + msg[2] / 128, + mc_pitch, ) ) except KeyError: tracks[delaytime_now] = [ self.execute_cmd_head.format(player_selector) - + f"playsound {soundID} @s ^ ^ ^{128 / max_volume / msg[2] - 1} {msg[2] / 128} " - + ( - "" - if SpecialBits - else f"{2 ** ((msg[1] - 60 - _X) / 12)}" + + "playsound {} @s ^ ^ ^{} {} {}".format( + soundID, + mc_distance_volume, + msg[2] / 128, + mc_pitch, ) ] diff --git a/Musicreater/plugin/mcstructure.py b/Musicreater/plugin/mcstructure.py index b10fa3b..f8dc01e 100644 --- a/Musicreater/plugin/mcstructure.py +++ b/Musicreater/plugin/mcstructure.py @@ -351,23 +351,23 @@ def commands_to_redstone_delay_structure( command_actually_length = sum([int(bool(cmd.delay)) for cmd in commands]) - a = 1 - for cmd in commands: - # print("\r 正在进行处理:",end="") - if cmd.delay > 2: - a = 1 - else: - a += 1 + # a = 1 + # for cmd in commands: + # # print("\r 正在进行处理:",end="") + # if cmd.delay > 2: + # a = 1 + # else: + # a += 1 struct = Structure( size=( round(delay_length / 2 + command_actually_length) if extensioon_direction == x - else a, + else max_multicmd_length, 3, round(delay_length / 2 + command_actually_length) if extensioon_direction == z - else a, + else max_multicmd_length, ), fill=Block("minecraft", "air", compability_version=compability_version_), compability_version=compability_version_, diff --git a/example.py b/example.py index 35b7def..65924df 100644 --- a/example.py +++ b/example.py @@ -106,7 +106,7 @@ else: print(f"正在处理 {midi_path} :") -cvt_mid = Musicreater.MidiConvert.from_midi_file(midi_path, old_exe_format=True) +cvt_mid = Musicreater.MidiConvert.from_midi_file(midi_path, old_exe_format=False) cvt_cfg = ConvertConfig(out_path, *prompts[:3]) if playerFormat == 1: diff --git a/resources/音乐测试片段版权声明.txt b/resources/音乐测试片段版权声明.txt new file mode 100644 index 0000000..8b0d40a --- /dev/null +++ b/resources/音乐测试片段版权声明.txt @@ -0,0 +1,14 @@ +音乐谱面文件 + +测试片段.mid、测试片段.mscz + +皆系 音·创 库所用之连带软件 +禁止在 音·创 库以外传播 +不允许独立发行、独立副本 +不允许未经允许的二次创作 +不允许脱离于 音·创 独立存在 +不得随任何其他非 音·创 软件连带发布 +不得用于商业用途 +若 音·创 库被用于商业用途,应当将其剔除 + +版权所有 © 2023 诸葛亮与八卦阵 \ No newline at end of file