mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2025-06-05 03:45:23 +00:00
切换为UV进行包管理
This commit is contained in:
parent
048b631bd6
commit
3739138059
1
.gitignore
vendored
1
.gitignore
vendored
@ -51,6 +51,7 @@ share/python-wheels/
|
|||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.egg
|
||||||
MANIFEST
|
MANIFEST
|
||||||
|
.pdm-build/
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# Usually these files are written by a python script from a template
|
||||||
|
1
.python-version
Normal file
1
.python-version
Normal file
@ -0,0 +1 @@
|
|||||||
|
3.10
|
13
MANIFEST.in
13
MANIFEST.in
@ -1,13 +0,0 @@
|
|||||||
recursive-include *.md
|
|
||||||
exclude fcwslib/*
|
|
||||||
exclude bgArrayLib/*
|
|
||||||
exclude Packer/*
|
|
||||||
exclude ./*.mid
|
|
||||||
exclude ./*.MSQ
|
|
||||||
exclude ./MSCT_Packer.py
|
|
||||||
exclude resources/poem.md
|
|
||||||
exclude resources/*
|
|
||||||
include LICENSE.md
|
|
||||||
include requirements.txt
|
|
||||||
include README_EN.md
|
|
||||||
include README.md
|
|
@ -22,7 +22,7 @@ The Licensor of Musicreater("this project") is Eilles Wan, bgArray.
|
|||||||
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
|
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
|
||||||
|
|
||||||
|
|
||||||
__version__ = "2.3.0"
|
__version__ = "2.3.0.1"
|
||||||
__vername__ = "FSQ完全流式音符读写适配"
|
__vername__ = "FSQ完全流式音符读写适配"
|
||||||
__author__ = (
|
__author__ = (
|
||||||
("金羿", "Eilles"),
|
("金羿", "Eilles"),
|
||||||
|
@ -745,7 +745,7 @@ class MusicSequence:
|
|||||||
|
|
||||||
return bytes_buffer
|
return bytes_buffer
|
||||||
|
|
||||||
def set_min_volume(self, volume_value: int):
|
def set_min_volume(self, volume_value: float):
|
||||||
"""重新设置全曲最小音量"""
|
"""重新设置全曲最小音量"""
|
||||||
if volume_value > 1 or volume_value <= 0:
|
if volume_value > 1 or volume_value <= 0:
|
||||||
raise IllegalMinimumVolumeError(
|
raise IllegalMinimumVolumeError(
|
||||||
@ -753,7 +753,7 @@ class MusicSequence:
|
|||||||
)
|
)
|
||||||
self.minimum_volume = volume_value
|
self.minimum_volume = volume_value
|
||||||
|
|
||||||
def set_deviation(self, deviation_value: int):
|
def set_deviation(self, deviation_value: float):
|
||||||
"""重新设置全曲音调偏移"""
|
"""重新设置全曲音调偏移"""
|
||||||
self.music_deviation = deviation_value
|
self.music_deviation = deviation_value
|
||||||
|
|
||||||
@ -1025,13 +1025,14 @@ class MidiConvert(MusicSequence):
|
|||||||
return cls.from_mido(
|
return cls.from_mido(
|
||||||
mido_file=midi_obj,
|
mido_file=midi_obj,
|
||||||
midi_music_name=midi_name,
|
midi_music_name=midi_name,
|
||||||
|
mismatch_error_ignorance=ignore_mismatch_error,
|
||||||
speed_multiplier=playment_speed,
|
speed_multiplier=playment_speed,
|
||||||
|
default_tempo=default_tempo_value,
|
||||||
pitched_note_referance_table=pitched_note_rtable,
|
pitched_note_referance_table=pitched_note_rtable,
|
||||||
percussion_note_referance_table=percussion_note_rtable,
|
percussion_note_referance_table=percussion_note_rtable,
|
||||||
minimum_vol=minimum_volume,
|
minimum_vol=minimum_volume,
|
||||||
volume_processing_function=vol_processing_function,
|
volume_processing_function=vol_processing_function,
|
||||||
default_tempo=default_tempo_value,
|
deviation=0, # 加么?感觉不加也没问题……?
|
||||||
mismatch_error_ignorance=ignore_mismatch_error,
|
|
||||||
note_referance_table_replacement=note_rtable_replacement,
|
note_referance_table_replacement=note_rtable_replacement,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1644,14 +1645,19 @@ class MidiConvert(MusicSequence):
|
|||||||
return command_dict, notes_list[-1].start_tick, max_multi
|
return command_dict, notes_list[-1].start_tick, max_multi
|
||||||
|
|
||||||
def copy_important(self):
|
def copy_important(self):
|
||||||
dst = MidiConvert.from_mido_obj(
|
dst = MidiConvert(
|
||||||
midi_obj=mido.MidiFile(),
|
name_of_music=self.music_name,
|
||||||
midi_name=self.music_name,
|
channels_of_notes={},
|
||||||
enable_old_exe_format=self.enable_old_exe_format,
|
music_note_count=0,
|
||||||
pitched_note_rtable={},
|
note_used_per_instrument={},
|
||||||
percussion_note_rtable={},
|
minimum_volume_of_music=self.minimum_volume,
|
||||||
vol_processing_function=lambda a: a,
|
deviation_value=self.music_deviation,
|
||||||
|
# enable_old_exe_format=self.enable_old_exe_format,
|
||||||
|
# pitched_note_rtable={},
|
||||||
|
# percussion_note_rtable={},
|
||||||
|
# vol_processing_function=lambda a: a,
|
||||||
)
|
)
|
||||||
|
dst.enable_old_exe_format = self.enable_old_exe_format
|
||||||
dst.music_command_list = [i.copy() for i in self.music_command_list]
|
dst.music_command_list = [i.copy() for i in self.music_command_list]
|
||||||
dst.progress_bar_command = [i.copy() for i in self.progress_bar_command]
|
dst.progress_bar_command = [i.copy() for i in self.progress_bar_command]
|
||||||
return dst
|
return dst
|
||||||
|
@ -331,12 +331,14 @@ def midi_msgs_to_minenote(
|
|||||||
# )
|
# )
|
||||||
|
|
||||||
|
|
||||||
def is_in_diapason(note_pitch: int, instrument: str) -> bool:
|
def is_in_diapason(note_pitch: float, instrument: str) -> bool:
|
||||||
note_range = MM_INSTRUMENT_RANGE_TABLE.get(instrument, ((-1, 128), 0))[0]
|
note_range = MM_INSTRUMENT_RANGE_TABLE.get(instrument, ((-1, 128), 0))[0]
|
||||||
return note_pitch >= note_range[0] and note_pitch <= note_range[1]
|
return note_pitch >= note_range[0] and note_pitch <= note_range[1]
|
||||||
|
|
||||||
|
|
||||||
def is_note_in_diapason(note_: MineNote) -> bool:
|
def is_note_in_diapason(
|
||||||
|
note_: MineNote,
|
||||||
|
) -> bool:
|
||||||
note_range = MM_INSTRUMENT_RANGE_TABLE.get(note_.sound_name, ((-1, 128), 0))[0]
|
note_range = MM_INSTRUMENT_RANGE_TABLE.get(note_.sound_name, ((-1, 128), 0))[0]
|
||||||
return note_.note_pitch >= note_range[0] and note_.note_pitch <= note_range[1]
|
return note_.note_pitch >= note_range[0] and note_.note_pitch <= note_range[1]
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ from typing import Optional, Tuple
|
|||||||
|
|
||||||
import Musicreater.experiment
|
import Musicreater.experiment
|
||||||
from Musicreater.plugin.archive import compress_zipfile
|
from Musicreater.plugin.archive import compress_zipfile
|
||||||
|
from Musicreater.utils import guess_deviation, is_in_diapason
|
||||||
|
|
||||||
|
|
||||||
def to_zip_pack_in_score(
|
def to_zip_pack_in_score(
|
||||||
@ -120,27 +121,52 @@ def to_zip_pack_in_score(
|
|||||||
return maxlen, maxscore
|
return maxlen, maxscore
|
||||||
|
|
||||||
|
|
||||||
print(
|
msc_cvt = Musicreater.experiment.FutureMidiConvertJavaE.from_midi_file(
|
||||||
to_zip_pack_in_score(
|
input("midi路径:"),
|
||||||
Musicreater.experiment.FutureMidiConvertJavaE.from_midi_file(
|
play_speed=float(input("播放速度:")),
|
||||||
input("midi路径:"),
|
old_exe_format=True,
|
||||||
play_speed=float(input("播放速度:")),
|
note_table_replacement={
|
||||||
old_exe_format=True,
|
"note.iron_xylophone": "note.xylophone",
|
||||||
note_table_replacement={
|
"note.cow_bell": "note.xylophone",
|
||||||
"note.iron_xylophone": "note.xylophone",
|
"note.didgeridoo": "note.guitar",
|
||||||
"note.cow_bell": "note.xylophone",
|
"note.bit": "note.harp",
|
||||||
"note.didgeridoo": "note.guitar",
|
"note.banjo": "note.flute",
|
||||||
"note.bit": "note.harp",
|
"note.pling": "note.harp",
|
||||||
"note.banjo": "note.flute",
|
},
|
||||||
"note.pling": "note.harp",
|
# pitched_note_table=Musicreater.MM_NBS_PITCHED_INSTRUMENT_TABLE,
|
||||||
},
|
)
|
||||||
# pitched_note_table=Musicreater.MM_NBS_PITCHED_INSTRUMENT_TABLE,
|
|
||||||
),
|
msc_cvt.set_deviation(
|
||||||
input("输出路径:"),
|
guess_deviation(
|
||||||
Musicreater.experiment.ProgressBarStyle(),
|
msc_cvt.total_note_count,
|
||||||
# Musicreater.plugin.ConvertConfig(input("输出路径:"),),
|
len(msc_cvt.note_count_per_instrument),
|
||||||
scoreboard_name=input("计分板名称:"),
|
msc_cvt.note_count_per_instrument,
|
||||||
sound_source=input("发音源:"),
|
music_channels=msc_cvt.channels,
|
||||||
auto_reset=True,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
in_diapason_count = 0
|
||||||
|
for this_note in [k for j in msc_cvt.channels.values() for k in j]:
|
||||||
|
if is_in_diapason(
|
||||||
|
this_note.note_pitch + msc_cvt.music_deviation, this_note.sound_name
|
||||||
|
):
|
||||||
|
in_diapason_count += 1
|
||||||
|
|
||||||
|
|
||||||
|
zip_res = to_zip_pack_in_score(
|
||||||
|
msc_cvt,
|
||||||
|
input("输出路径:"),
|
||||||
|
Musicreater.experiment.ProgressBarStyle(),
|
||||||
|
# Musicreater.plugin.ConvertConfig(input("输出路径:"),),
|
||||||
|
scoreboard_name=input("计分板名称:"),
|
||||||
|
sound_source=input("发音源:"),
|
||||||
|
auto_reset=True,
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
"符合音符播放音高的音符数量:{}/{}({:.2f}%)".format(
|
||||||
|
in_diapason_count,
|
||||||
|
msc_cvt.total_note_count,
|
||||||
|
in_diapason_count * 100 / msc_cvt.total_note_count,
|
||||||
|
),
|
||||||
|
"\n指令数量:{};音乐总延迟:{}".format(*zip_res),
|
||||||
|
)
|
||||||
|
@ -1,2 +1,93 @@
|
|||||||
|
[project]
|
||||||
|
name = "Musicreater"
|
||||||
|
dynamic = ["version"]
|
||||||
|
requires-python = ">= 3.8, < 4.0"
|
||||||
|
dependencies = [
|
||||||
|
"mido >= 1.3",
|
||||||
|
"xxhash >= 3",
|
||||||
|
]
|
||||||
|
|
||||||
|
authors = [
|
||||||
|
{ name = "金羿Eilles" },
|
||||||
|
{ name = "玉衡Alioth" },
|
||||||
|
{ name = "鱼旧梦ElapsingDreams" },
|
||||||
|
{ name = "睿乐组织 TriMO", email = "TriM-Organization@hotmail.com" },
|
||||||
|
]
|
||||||
|
maintainers = [
|
||||||
|
{ name = "金羿Eilles", email = "EillesWan@outlook.com" },
|
||||||
|
]
|
||||||
|
|
||||||
|
description = "A free open source library used for dealing with **Minecraft** digital musics."
|
||||||
|
readme = "README_EN.md"
|
||||||
|
license = { file = "LICENSE.md" }
|
||||||
|
|
||||||
|
keywords = ["midi", "minecraft", "minecraft: bedrock edition"]
|
||||||
|
classifiers = [
|
||||||
|
"Intended Audience :: Developers",
|
||||||
|
"Natural Language :: Chinese (Simplified)",
|
||||||
|
"Operating System :: OS Independent",
|
||||||
|
"Topic :: Software Development :: Libraries",
|
||||||
|
"Programming Language :: Python",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Topic :: Multimedia",
|
||||||
|
"Topic :: Multimedia :: Sound/Audio :: MIDI",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
# Homepage = "https://example.com"
|
||||||
|
# Documentation = "https://readthedocs.org"
|
||||||
|
Repository = "https://gitee.com/TriM-Organization/Musicreater"
|
||||||
|
Issues = "https://gitee.com/TriM-Organization/Musicreater/issues"
|
||||||
|
Mirror-Repository = "https://github.com/TriM-Organization/Musicreater"
|
||||||
|
Mirror-Issues = "https://github.com/TriM-Organization/Musicreater/issues"
|
||||||
|
|
||||||
|
|
||||||
|
[project.optional-dependencies]
|
||||||
|
full = [
|
||||||
|
"TrimMCStruct <= 0.0.5.9",
|
||||||
|
"brotli >= 1.0.0",
|
||||||
|
]
|
||||||
|
dev = [
|
||||||
|
"TrimMCStruct <= 0.0.5.9",
|
||||||
|
"brotli >= 1.0.0",
|
||||||
|
"rich",
|
||||||
|
"pyinstaller",
|
||||||
|
"twine",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools", "wheel",]
|
requires = ["pdm-backend"]
|
||||||
|
build-backend = "pdm.backend"
|
||||||
|
|
||||||
|
# https://backend.pdm-project.org/build_config/#build-configurations
|
||||||
|
[tool.pdm.build]
|
||||||
|
# includes = [
|
||||||
|
# # "README_EN.md",
|
||||||
|
# # "README.md",
|
||||||
|
# # "LICENSE.md",
|
||||||
|
# # "Musicreater/",
|
||||||
|
# # "docs/",
|
||||||
|
# ]
|
||||||
|
source-includes = [
|
||||||
|
"README_EN.md",
|
||||||
|
"README.md",
|
||||||
|
"LICENSE.md",
|
||||||
|
]
|
||||||
|
excludes = [
|
||||||
|
"fcwslib/",
|
||||||
|
"bgArrayLib/",
|
||||||
|
"Packer/",
|
||||||
|
"resources/",
|
||||||
|
"./*.mid",
|
||||||
|
"./*.msq",
|
||||||
|
"./*.fsq",
|
||||||
|
"./MSCT_Packer.py",
|
||||||
|
"resources/poem.md",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
[tool.pdm.version]
|
||||||
|
source = "file"
|
||||||
|
path = "Musicreater/__init__.py"
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
mido>=1.3
|
|
||||||
xxhash>=3
|
|
@ -1,7 +1,7 @@
|
|||||||
python -m build
|
uv build
|
||||||
python -m twine check dist/*
|
python -m twine check dist/*
|
||||||
pause
|
pause
|
||||||
python -m twine upload dist/* --verbose
|
uv publish
|
||||||
pause
|
pause
|
||||||
python clean_update.py
|
python clean_update.py
|
||||||
pause
|
pause
|
Loading…
x
Reference in New Issue
Block a user