更新一处细节,避免声相偏移无法听见

This commit is contained in:
2025-07-08 06:00:32 +08:00
parent 9764019f08
commit 8df63df26c
31 changed files with 66 additions and 95 deletions

View File

@ -5,7 +5,7 @@
Musicreater(音·创)
A free open source library used for dealing with **Minecraft** digital musics.
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
音·创(“本项目”)的协议颁发者为 金羿、诸葛亮与八卦阵
@ -22,7 +22,7 @@ The Licensor of Musicreater("this project") is Eilles, bgArray.
# 若需转载或借鉴 许可声明请查看仓库目录下的 License.md
__version__ = "2.4.0"
__version__ = "2.4.0.1"
__vername__ = "全景声支持、音量调节修复"
__author__ = (
("金羿", "Eilles"),
@ -58,8 +58,8 @@ __all__ = [
"MM_NBS_PITCHED_INSTRUMENT_TABLE",
"MM_NBS_PERCUSSION_INSTRUMENT_TABLE",
# 操作性函数
"natural_curve",
"straight_line",
"velocity_2_distance_natural",
"velocity_2_distance_straight",
"panning_2_rotation_linear",
"panning_2_rotation_trigonometric",
"load_decode_musicsequence_metainfo",

View File

@ -5,7 +5,7 @@
"""
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -5,7 +5,7 @@
"""
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -5,7 +5,7 @@
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md
@ -49,7 +49,7 @@ class FutureMidiConvertKamiRES(MidiConvert):
default_tempo_value: int = mido.midifiles.midifiles.DEFAULT_TEMPO,
pitched_note_rtable: MidiInstrumentTableType = MM_TOUCH_PITCHED_INSTRUMENT_TABLE,
percussion_note_rtable: MidiInstrumentTableType = MM_TOUCH_PERCUSSION_INSTRUMENT_TABLE,
vol_processing_function: FittingFunctionType = natural_curve,
vol_processing_function: FittingFunctionType = velocity_2_distance_natural,
pan_processing_function: FittingFunctionType = panning_2_rotation_trigonometric,
note_rtable_replacement: Dict[str, str] = {},
) -> Tuple[MineNoteChannelType, int, Dict[str, int]]:

View File

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

View File

@ -7,7 +7,7 @@
Musicreater (音·创)
A free open source library used for dealing with **Minecraft** digital musics.
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
音·创(“本项目”)的协议颁发者为 金羿、诸葛亮与八卦阵
@ -169,7 +169,7 @@ class MusicSequence:
pitched_note_referance_table: MidiInstrumentTableType = MM_TOUCH_PITCHED_INSTRUMENT_TABLE,
percussion_note_referance_table: MidiInstrumentTableType = MM_TOUCH_PERCUSSION_INSTRUMENT_TABLE,
minimum_vol: float = 0.1,
volume_processing_function: FittingFunctionType = natural_curve,
volume_processing_function: FittingFunctionType = velocity_2_distance_natural,
panning_processing_function: FittingFunctionType = panning_2_rotation_linear,
deviation: float = 0,
note_referance_table_replacement: Dict[str, str] = {},
@ -819,7 +819,7 @@ class MusicSequence:
default_tempo_value: int = mido.midifiles.midifiles.DEFAULT_TEMPO,
pitched_note_rtable: MidiInstrumentTableType = MM_TOUCH_PITCHED_INSTRUMENT_TABLE,
percussion_note_rtable: MidiInstrumentTableType = MM_TOUCH_PERCUSSION_INSTRUMENT_TABLE,
vol_processing_function: FittingFunctionType = natural_curve,
vol_processing_function: FittingFunctionType = velocity_2_distance_natural,
pan_processing_function: FittingFunctionType = panning_2_rotation_trigonometric,
note_rtable_replacement: Dict[str, str] = {},
) -> Tuple[MineNoteChannelType, int, Dict[str, int]]:
@ -938,15 +938,15 @@ class MusicSequence:
that_note := midi_msgs_to_minenote(
inst_=(
msg.note
if msg.channel == 9
if (_is_percussion := (msg.channel == 9))
else channel_controler[msg.channel][MIDI_PROGRAM]
),
note_=(
channel_controler[msg.channel][MIDI_PROGRAM]
if msg.channel == 9
if _is_percussion
else msg.note
),
percussive_=(msg.channel == 9),
percussive_=_is_percussion,
volume_=channel_controler[msg.channel][MIDI_VOLUME],
velocity_=_velocity,
panning_=channel_controler[msg.channel][MIDI_PAN],
@ -955,7 +955,7 @@ class MusicSequence:
play_speed=speed,
midi_reference_table=(
percussion_note_rtable
if msg.channel == 9
if _is_percussion
else pitched_note_rtable
),
volume_processing_method_=vol_processing_function,
@ -1039,7 +1039,7 @@ class MidiConvert(MusicSequence):
percussion_note_rtable: MidiInstrumentTableType = MM_TOUCH_PERCUSSION_INSTRUMENT_TABLE,
enable_old_exe_format: bool = False,
minimum_volume: float = 0.1,
vol_processing_function: FittingFunctionType = natural_curve,
vol_processing_function: FittingFunctionType = velocity_2_distance_natural,
pan_processing_function: FittingFunctionType = panning_2_rotation_trigonometric,
pitch_deviation: float = 0,
note_rtable_replacement: Dict[str, str] = {},
@ -1122,7 +1122,7 @@ class MidiConvert(MusicSequence):
percussion_note_table: MidiInstrumentTableType = MM_TOUCH_PERCUSSION_INSTRUMENT_TABLE,
old_exe_format: bool = False,
min_volume: float = 0.1,
vol_processing_func: FittingFunctionType = natural_curve,
vol_processing_func: FittingFunctionType = velocity_2_distance_natural,
pan_processing_func: FittingFunctionType = panning_2_rotation_linear,
music_pitch_deviation: float = 0,
note_table_replacement: Dict[str, str] = {},

View File

@ -2,7 +2,7 @@
"""
存放非音·创本体的附加功能件
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -2,7 +2,7 @@
"""
用以生成附加包的附加功能
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -5,7 +5,7 @@
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -4,7 +4,7 @@
"""
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -2,7 +2,7 @@
"""
用以生成BDX结构文件的附加功能
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -4,7 +4,7 @@
"""
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -4,7 +4,7 @@
"""
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -2,7 +2,7 @@
"""
用以生成单个mcstructure文件的附加功能
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -4,7 +4,7 @@
"""
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -4,7 +4,7 @@
"""
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -4,7 +4,7 @@
"""
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -2,7 +2,7 @@
"""
用以生成Schematic结构的附加功能
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -2,7 +2,7 @@
"""
用以启动WebSocket服务器播放的附加功能
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -5,7 +5,7 @@
"""
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md
@ -49,10 +49,10 @@ class MineNote:
"""是否作为打击乐器启用"""
sound_distance: float
"""声源距离"""
"""声源距离 方块"""
sound_azimuth: Tuple[float, float]
"""声源方位"""
"""声源方位 角度"""
extra_info: Any
"""你觉得放什么好?"""
@ -107,16 +107,17 @@ class MineNote:
)
"""是否为打击乐器"""
self.sound_distance = (
(16 if distance > 16 else (distance if distance > 0 else 0))
if distance
else 0
)
"""声源距离"""
self.sound_azimuth = (azimuth[0] % 360, azimuth[1] % 360) if azimuth else (0, 0)
"""声源方位"""
# 如果指定为零,那么为零,但如果不指定或者指定为负数,则为 0.01 的距离
self.sound_distance = (
(16 if distance > 16 else (distance if distance >= 0 else 0.01))
if distance is not None
else 0.01
)
"""声源距离"""
self.extra_info = extra_information
@classmethod

View File

@ -5,7 +5,7 @@
"""
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -4,7 +4,7 @@
"""
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md
@ -41,7 +41,7 @@ from .constants import (
MM_INSTRUMENT_RANGE_TABLE,
)
from .exceptions import MusicSequenceDecodeError
from .subclass import MineNote, mctick2timestr
from .subclass import MineNote, mctick2timestr, SingleNoteBox
from .types import MidiInstrumentTableType, MineNoteChannelType, FittingFunctionType
@ -127,7 +127,7 @@ def midi_inst_to_mc_sound(
)
def natural_curve(
def velocity_2_distance_natural(
vol: float,
) -> float:
"""
@ -155,7 +155,7 @@ def natural_curve(
)
def straight_line(vol: float) -> float:
def velocity_2_distance_straight(vol: float) -> float:
"""
midi力度值拟合成的距离函数
@ -252,42 +252,6 @@ def minenote_to_command_paramaters(
)
# def single_note_to_command_parameters(
# note_: SingleNote,
# reference_table: MidiInstrumentTableType,
# deviation: float = 0,
# volume_processing_method: Callable[[float], float] = natural_curve,
# ) -> Tuple[
# str,
# Tuple[float, float, float],
# float,
# Union[float, Literal[None]],
# ]:
# """
# 将音符转为播放的指令之参数
# :param note_:int 音符对象
# :param reference_table:Dict[int, str] 转换对照表
# :param deviation:float 音调偏移量
# :param volume_proccessing_method:Callable[[float], float] 音量处理函数
# :return str[我的世界音符ID], Tuple[float,float,float]播放视角坐标, float[指令音量参数], float[指令音调参数]
# """
# mc_sound_ID, _X = inst_to_sould_with_deviation(
# note_.inst,
# reference_table,
# "note.bd" if note_.percussive else "note.flute",
# )
# mc_distance_volume = volume_processing_method(note_.velocity)
# return (
# mc_sound_ID,
# (0, mc_distance_volume, 0),
# note_.velocity / 127,
# None if note_.percussive else 2 ** ((note_.pitch - 60 - _X + deviation) / 12),
# )
def midi_msgs_to_minenote(
inst_: int, # 乐器编号
@ -449,6 +413,7 @@ def midi_msgs_to_minenote_using_kami_respack(
def is_in_diapason(note_pitch: float, instrument: str) -> bool:
"""音是否在乐器可演奏之范围之内"""
note_range = MM_INSTRUMENT_RANGE_TABLE.get(instrument, ((-1, 128), 0))[0]
return note_pitch >= note_range[0] and note_pitch <= note_range[1]
@ -456,6 +421,7 @@ def is_in_diapason(note_pitch: float, instrument: str) -> bool:
def is_note_in_diapason(
note_: MineNote,
) -> bool:
"""一个 MineNote 音符是否在其乐器可演奏之范围之内"""
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]
@ -483,7 +449,6 @@ def note_to_redstone_block(
# return SingleNoteBox() # TO-DO
@staticmethod
def soundID_to_blockID(
sound_id: str, random_select: bool = False, default_block: str = "air"
) -> str:

View File

@ -12,11 +12,16 @@
**_使用时请遵循协议规定_**
- 版权所有 © 2024 金羿 & 诸葛亮与八卦阵
- Copyright © 2025 Eilles & bgArray
- 版权所有 © 2025 金羿 & 诸葛亮与八卦阵
- Copyright © 2025 Eilles & bgArray
* 开源相关声明请见 仓库根目录下的 License.md
* Terms & Conditions: License.md in the root directory
* ·本项目的协议颁发者为 金羿诸葛亮与八卦阵
* The Licensor of Musicreater("this project") is Eilles, bgArray.
本项目根据 第一版 汉钰律许可协议本协议授权
任何人皆可从以下地址获得本协议副本https://gitee.com/EillesWan/YulvLicenses
若非因法律要求或经过了特殊准许此作品在根据本协议原样提供的基础上不予提供任何形式的担保任何明示任何暗示或类似承诺也就是说用户将自行承担因此作品的质量或性能问题而产生的全部风险
详细的准许和限制条款请见原协议文本
· 开发交流群 861684859\
Email TriM-Organization@hotmail.com\

View File

@ -9,7 +9,7 @@
Musicreater (音·创)
A free open source library used for convert midi file into formats that is suitable for **Minecraft**.
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 ./License.md

View File

@ -1,5 +1,5 @@
"""
版权所有 © 2024 金羿 & 诸葛亮与八卦阵
版权所有 © 2025 金羿 & 诸葛亮与八卦阵
Copyright © 2025 Eilles & bgArray
开源相关声明请见 仓库根目录下的 License.md

View File

@ -11,4 +11,4 @@
不得用于商业用途
若 音·创 库被用于商业用途,应当将其剔除
版权所有 © 2024 诸葛亮与八卦阵
版权所有 © 2025 诸葛亮与八卦阵