同步仓库描述,准备合并至主版本

This commit is contained in:
EillesWan 2023-02-01 21:48:12 +08:00
parent 5cce59135a
commit 8a21b6c3e7
5 changed files with 32 additions and 51 deletions

View File

@ -19,7 +19,7 @@
## 介绍🚀
· 是一个免费开源的针对 **我的世界基岩版** 的midi音乐转换库
· 是一个免费开源的针对 **我的世界** 的midi音乐转换库
欢迎加群[861684859](https://jq.qq.com/?_wv=1027&k=hpeRxrYr)

View File

@ -22,15 +22,17 @@
## Introduction🚀
Musicreater(·) is a free open source software which is used for making and also creating music in *Minecraft: Bedrock Edition*.
Musicreater pkgver(Package Version · 库版) is a free open source library used for convert midi file into formats that could be read in *Minecraft: Bedrock Edition*.
Musicreater is a free open-source library used for converting midi file into formats that could be read in *Minecraft*.
Welcome to join our QQ group: [861684859](https://jq.qq.com/?_wv=1027&k=hpeRxrYr)
**This branch is the Package Version of Musicreater, that means that the lib can be imported for other softwares**
## Documentation📄
### **If you want to use the demo to convert MIDI musics directly, SEEEEEEEEE [Tutorials HERE](./docs/Use%20of%20Funtions.md)**
(Not in English yet)
[生成文件的使用](./docs/%E7%94%9F%E6%88%90%E6%96%87%E4%BB%B6%E7%9A%84%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.md)
[仓库API文档](./docs/%E5%BA%93%E7%9A%84%E7%94%9F%E6%88%90%E4%B8%8E%E5%8A%9F%E8%83%BD%E6%96%87%E6%A1%A3.md)
### Authors✒

View File

@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
"""一个简单的我的世界音频转换库
· 库版 (Musicreater Package Version)
是一款免费开源的针对我的世界基岩版的midi音乐转换库
Musicreater pkgver (Package Version · 库版)
A free open source library used for convert midi file into formats that is suitable for **Minecraft: Bedrock Edition**.
· 库版 (Musicreater)
是一款免费开源的针对我的世界的midi音乐转换库
Musicreater(·)
A free open source library used for convert midi file into formats that is suitable for **Minecraft**.
Copyright 2023 all the developers of Musicreater
版权所有 © 2023 · 开发者
Copyright © 2023 all the developers of Musicreater
开源相关声明请见 ../License.md
Terms & Conditions: ../License.md
@ -18,12 +19,8 @@ Terms & Conditions: ../License.md
from .main import *
__version__ = "0.2.2.4"
__version__ = "0.2.3"
__all__ = []
__author__ = (("金羿", "Eilles Wan"), ("诸葛亮与八卦阵", "bgArray"), ("鸣凤鸽子", "MingFengPigeon"))
__author__ = (("金羿", "Eilles Wan"), ("诸葛亮与八卦阵", "bgArray"))
print("此Midi转换功能由音·创开发者开发版权归参与开发的人员共同所有。")
print("Copyright © 2022 all the developers of Musicreater")
print("小贴不妨试试Mid-BDX转换网页在线的多功能Midi转换器")
print("https://dislink.github.io/midi2bdx/")

View File

@ -1,5 +1,4 @@
from rich.console import Console
from .exceptions import *
from typing import Any, Literal, Optional, TextIO
MainConsole = Console()

View File

@ -8,10 +8,10 @@
"""
· 库版 (Musicreater Package Version)
是一款免费开源的针对我的世界基岩版的midi音乐转换库
Musicreater pkgver (Package Version · 库版)
A free open source library used for convert midi file into formats that is suitable for **Minecraft: Bedrock Edition**.
· (Musicreater)
是一款免费开源的针对我的世界的midi音乐转换库
Musicreater (·)
A free open source library used for convert midi file into formats that is suitable for **Minecraft**.
版权所有 © 2023 · 开发者
Copyright © 2023 all the developers of Musicreater
@ -158,12 +158,6 @@ class midiConvert:
]
)
if self.debugMode:
from .magicBeing import prt, ipt
self.prt = prt
self.ipt = ipt
def convert(self, midiFile: str, outputPath: str, oldExeFormat: bool = True):
"""转换前需要先运行此函数来获取基本信息"""
@ -415,10 +409,10 @@ class midiConvert:
"""
# :param volume: 音量,注意:这里的音量范围为(0,1],如果超出将被处理为正确值,其原理为在距离玩家 (1 / volume -1) 的地方播放音频
tracks = []
if speed <= 0:
if speed == 0:
if self.debugMode:
raise ZeroSpeedError("播放速度仅可为正实数")
speed = 0.00001
speed = 1
MaxVolume = 1 if MaxVolume > 1 else (0.001 if MaxVolume <= 0 else MaxVolume)
commands = 0
@ -485,10 +479,10 @@ class midiConvert:
:return: tuple(命令列表, 命令个数, 计分板最大值)
"""
if speed <= 0:
if speed == 0:
if self.debugMode:
raise ZeroSpeedError("播放速度仅可为正实数")
speed = 0.00001
speed = 1
MaxVolume = 1 if MaxVolume > 1 else (0.001 if MaxVolume <= 0 else MaxVolume)
# 一个midi中仅有16个通道 我们通过通道来识别而不是音轨
@ -530,8 +524,6 @@ class midiConvert:
if msg.is_meta:
if msg.type == "set_tempo":
tempo = msg.tempo
if self.debugMode:
self.prt(f"TEMPO更改{tempo}(毫秒每拍)")
else:
if self.debugMode:
@ -566,9 +558,6 @@ class midiConvert:
3 音符结束消息
("NoteS", 结束的音符ID, 距离演奏开始的毫秒)"""
if self.debugMode:
self.prt(channels)
tracks = []
cmdAmount = 0
maxScore = 0
@ -643,14 +632,11 @@ class midiConvert:
"""
# TODO: 这里的时间转换不知道有没有问题
if speed <= 0:
if speed == 0:
if self.debugMode:
raise ZeroSpeedError("播放速度仅可为正实数")
speed = 0.00001
if MaxVolume > 1:
MaxVolume = 1.0
if MaxVolume <= 0:
MaxVolume = 0.001
speed = 1
MaxVolume = 1 if MaxVolume > 1 else (0.001 if MaxVolume <= 0 else MaxVolume)
# 一个midi中仅有16个通道 我们通过通道来识别而不是音轨
channels = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]
@ -831,10 +817,11 @@ class midiConvert:
"""
# :param volume: 音量,注意:这里的音量范围为(0,1],如果超出将被处理为正确值,其原理为在距离玩家 (1 / volume -1) 的地方播放音频
tracks = {}
if speed <= 0:
if speed == 0:
if self.debugMode:
raise ZeroSpeedError("播放速度仅可为正实数")
speed = 0.00001
speed = 1
MaxVolume = 1 if MaxVolume > 1 else (0.001 if MaxVolume <= 0 else MaxVolume)
@ -903,10 +890,10 @@ class midiConvert:
"""
# :param volume: 音量,注意:这里的音量范围为(0,1],如果超出将被处理为正确值,其原理为在距离玩家 (1 / volume -1) 的地方播放音频
tracks = {}
if speed <= 0:
if speed == 0:
if self.debugMode:
raise ZeroSpeedError("播放速度仅可为正实数")
speed = 0.00001
speed = 1
MaxVolume = 1 if MaxVolume > 1 else (0.001 if MaxVolume <= 0 else MaxVolume)
@ -948,8 +935,6 @@ class midiConvert:
if msg.is_meta:
if msg.type == "set_tempo":
tempo = msg.tempo
if self.debugMode:
self.prt(f"TEMPO更改{tempo}(毫秒每拍)")
else:
if self.debugMode:
@ -1033,8 +1018,6 @@ class midiConvert:
]
all_ticks = list(tracks.keys())
if self.debugMode:
self.prt(tracks)
for i in range(len(all_ticks)):
for j in range(len(tracks[all_ticks[i]])):