修改协议

This commit is contained in:
2024-07-18 16:21:10 +08:00
parent f6b884e38f
commit 932b9a34e0
32 changed files with 194 additions and 450 deletions

View File

@ -5,11 +5,16 @@
Musicreater(音·创)
A free open source library used for convert midi file into formats that is suitable for **Minecraft**.
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory
音·创(“本项目”)的协议颁发者为 金羿、诸葛亮与八卦阵
The Licensor of Musicreater("this project") is Eilles Wan, bgArray.
本项目根据 第一版 汉钰律许可协议(“本协议”)授权。
任何人皆可从以下地址获得本协议副本https://gitee.com/EillesWan/YulvLicenses。
若非因法律要求或经过了特殊准许,此作品在根据本协议“原样”提供的基础上,不予提供任何形式的担保、任何明示、任何暗示或类似承诺。也就是说,用户将自行承担因此作品的质量或性能问题而产生的全部风险。
详细的准许和限制条款请见原协议文本。
"""
# 睿乐组织 开发交流群 861684859

View File

@ -5,8 +5,8 @@
"""
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory
@ -1041,7 +1041,7 @@ MM_DISLINK_PERCUSSION_INSTRUMENT_TABLE: Dict[int, str] = {
# 金羿ELS 音符方块对照表
MN_EILLES_NOTE_TABLE: Dict[int, str] = {
MN_EILLES_NOTE_BLOCK_TABLE: Dict[int, str] = {
0: "C",
1: "C#",
2: "D",

View File

@ -5,8 +5,8 @@
"""
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -5,8 +5,8 @@
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -22,8 +22,8 @@
Musicreater (音·创)
A free open source library used for convert midi file into formats that is suitable for **Minecraft**.
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 ../License.md
Terms & Conditions: ../License.md

View File

@ -7,11 +7,16 @@
Musicreater (音·创)
A free open source library used for **Minecraft** musics.
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory
音·创(“本项目”)的协议颁发者为 金羿、诸葛亮与八卦阵
The Licensor of Musicreater("this project") is Eilles Wan, bgArray.
本项目根据 第一版 汉钰律许可协议(“本协议”)授权。
任何人皆可从以下地址获得本协议副本https://gitee.com/EillesWan/YulvLicenses。
若非因法律要求或经过了特殊准许,此作品在根据本协议“原样”提供的基础上,不予提供任何形式的担保、任何明示、任何暗示或类似承诺。也就是说,用户将自行承担因此作品的质量或性能问题而产生的全部风险。
详细的准许和限制条款请见原协议文本。
"""
# 音·创 开发交流群 861684859
@ -368,53 +373,6 @@ class MusicSequence:
if is_sort:
self.channels[channel_no].sort(key=lambda note: note.start_tick)
@staticmethod
def guess_deviation_wasted(
total_note_count: int,
total_instrument_count: int,
note_count_per_instrument: Optional[Dict[str, int]] = None,
qualified_note_count_per_instrument: Optional[Dict[str, int]] = None,
music_channels: Optional[MineNoteChannelType] = None,
) -> float:
"""已废弃"""
if (
note_count_per_instrument is None
or qualified_note_count_per_instrument is None
):
if music_channels is None:
raise ValueError("参数不足,算逑!")
note_count_per_instrument = {}
qualified_note_count_per_instrument = {}
for this_note in [k for j in music_channels.values() for k in j]:
if this_note.sound_name in note_count_per_instrument.keys():
note_count_per_instrument[this_note.sound_name] += 1
qualified_note_count_per_instrument[
this_note.sound_name
] += is_note_in_diapason(this_note)
else:
note_count_per_instrument[this_note.sound_name] = 1
qualified_note_count_per_instrument[this_note.sound_name] = int(
is_note_in_diapason(this_note)
)
return (
sum(
[
(
(
MM_INSTRUMENT_RANGE_TABLE[inst][-1]
* note_count
/ total_note_count
- MM_INSTRUMENT_RANGE_TABLE[inst][-1]
)
* (note_count - qualified_note_count_per_instrument[inst])
)
for inst, note_count in note_count_per_instrument.items()
]
)
/ total_instrument_count
/ total_note_count
)
@staticmethod
def to_music_note_channels(
midi: mido.MidiFile,
@ -999,6 +957,34 @@ class MidiConvert(MusicSequence):
self.progress_bar_command = result
return result
def redefine_execute_format(self, is_old_exe_cmd_using: bool = False):
"""
根据是否使用旧版执行命令格式,重新定义执行命令的起始格式。
此方法用于处理 Minecraft 中的执行命令的格式差异。在 Minecraft 的命令系统中,
"execute" 命令的用法在不同版本间有所变化。此方法允许动态选择使用旧版还是新版
的命令格式,以便适应不同的 Minecraft 版本。
Parameters
----------
is_old_exe_cmd_using: bool
是否使用旧版执行命令格式。
Returns
-------
MidiConvert修改后的实例允许链式调用
"""
# 根据 is_old_exe_cmd_using 的值选择合适的执行命令头格式
self.execute_cmd_head = (
"execute {} ~ ~ ~ " # 旧版执行命令格式
if is_old_exe_cmd_using
else "execute as {} at @s positioned ~ ~ ~ run " # 新版执行命令格式
)
# 返回修改后的实例,支持链式调用
return self
def to_command_list_in_score(
self,
scoreboard_name: str = "mscplay",

View File

@ -2,8 +2,8 @@
"""
存放非音·创本体的附加功能件
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -2,8 +2,8 @@
"""
用以生成附加包的附加功能
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -5,8 +5,8 @@
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -4,8 +4,8 @@
"""
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -2,8 +2,8 @@
"""
用以生成BDX结构文件的附加功能
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -4,8 +4,8 @@
"""
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -4,8 +4,8 @@
"""
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -2,8 +2,8 @@
"""
用以生成单个mcstructure文件的附加功能
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -4,8 +4,8 @@
"""
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -4,8 +4,8 @@
"""
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -4,8 +4,8 @@
"""
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -2,8 +2,8 @@
"""
用以生成Schematic结构的附加功能
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -2,8 +2,8 @@
"""
用以启动WebSocket服务器播放的附加功能
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -5,8 +5,8 @@
"""
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory
@ -353,152 +353,6 @@ class MineNote:
return self.tuplize() == other.tuplize()
# @dataclass(init=False)
# class SingleNote:
# """存储单个音符的类"""
# instrument: int
# """乐器编号"""
# note: int
# """音符编号"""
# velocity: int
# """力度/响度"""
# start_time: int
# """开始之时 ms"""
# duration: int
# """音符持续时间 ms"""
# track_no: int
# """音符所处的音轨"""
# percussive: bool
# """是否为打击乐器"""
# extra_info: Any
# """你觉得放什么好?"""
# def __init__(
# self,
# instrument: int,
# pitch: int,
# velocity: int,
# startime: int,
# lastime: int,
# is_percussion: bool,
# track_number: int = 0,
# extra_information: Any = None,
# ):
# """用于存储单个音符的类
# :param instrument 乐器编号
# :param pitch 音符编号
# :param velocity 力度/响度
# :param startTime 开始之时(ms)
# 注:此处的时间是用从乐曲开始到当前的毫秒数
# :param lastTime 音符延续时间(ms)"""
# self.instrument: int = instrument
# """乐器编号"""
# self.note: int = pitch
# """音符编号"""
# self.velocity: int = velocity
# """力度/响度"""
# self.start_time: int = startime
# """开始之时 ms"""
# self.duration: int = lastime
# """音符持续时间 ms"""
# self.track_no: int = track_number
# """音符所处的音轨"""
# self.percussive: bool = is_percussion
# """是否为打击乐器"""
# self.extra_info = extra_information
# @property
# def inst(self) -> int:
# """乐器编号"""
# return self.instrument
# @inst.setter
# def inst(self, inst_: int):
# self.instrument = inst_
# @property
# def pitch(self) -> int:
# """音符编号"""
# return self.note
# # @property
# # def get_mc_pitch(self,table: Dict[int, Tuple[str, int]]) -> float:
# # self.mc_sound_ID, _X = inst_to_sould_with_deviation(self.inst,table,"note.bd" if self.percussive else "note.flute",)
# # return -1 if self.percussive else 2 ** ((self.note - 60 - _X) / 12)
# def set_info(self, sth: Any):
# """设置附加信息"""
# self.extra_info = sth
# def __str__(self, is_track: bool = False):
# return "{}Note(Instrument = {}, {}Velocity = {}, StartTime = {}, Duration = {}{})".format(
# "Percussive" if self.percussive else "",
# self.inst,
# "" if self.percussive else "Pitch = {}, ".format(self.pitch),
# self.start_time,
# self.duration,
# ", Track = {}".format(self.track_no) if is_track else "",
# )
# def __tuple__(self):
# return (
# (
# self.percussive,
# self.inst,
# self.velocity,
# self.start_time,
# self.duration,
# self.track_no,
# )
# if self.percussive
# else (
# self.percussive,
# self.inst,
# self.note,
# self.velocity,
# self.start_time,
# self.duration,
# self.track_no,
# )
# )
# def __dict__(self):
# return (
# {
# "Percussive": self.percussive,
# "Instrument": self.inst,
# "Velocity": self.velocity,
# "StartTime": self.start_time,
# "Duration": self.duration,
# "Track": self.track_no,
# }
# if self.percussive
# else {
# "Percussive": self.percussive,
# "Instrument": self.inst,
# "Pitch": self.note,
# "Velocity": self.velocity,
# "StartTime": self.start_time,
# "Duration": self.duration,
# "Track": self.track_no,
# }
# )
# def __eq__(self, other) -> bool:
# if not isinstance(other, self.__class__):
# return False
# return self.__str__() == other.__str__()
@dataclass(init=False)
class MineCommand:
"""存储单个指令的类"""
@ -784,16 +638,6 @@ DEFAULT_PROGRESSBAR_STYLE = ProgressBarStyle(
默认的进度条样式
"""
# NoteChannelType = Mapping[
# int,
# List[SingleNote,],
# ]
# """
# 频道信息类型
# Dict[int,Dict[int,List[SingleNote,],],]
# """
MineNoteChannelType = Mapping[
int,

View File

@ -5,8 +5,8 @@
"""
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory

View File

@ -4,8 +4,8 @@
"""
"""
版权所有 © 2024 音·创 开发者
Copyright © 2024 all the developers of Musicreater
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
Copyright © 2024 EillesWan & bgArray
开源相关声明请见 仓库根目录下的 License.md
Terms & Conditions: License.md in the root directory