mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2024-11-11 01:27:35 +08:00
Merge branch 'pkgver' of https://gitee.com/EillesWan/Musicreater into pkgver
This commit is contained in:
commit
662c6506d8
@ -26,7 +26,6 @@ Musicreater Package Version : Demo for Midi Conversion
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
|
||||
from msctPkgver.main import *
|
||||
import os
|
||||
|
||||
@ -80,10 +79,9 @@ while True:
|
||||
if isAutoReset != '':
|
||||
isAutoReset = bool(int(isAutoReset))
|
||||
break
|
||||
except:
|
||||
except BaseException:
|
||||
print('输入错误,请重新输入')
|
||||
|
||||
|
||||
if os.path.isdir(midipath):
|
||||
for i in os.listdir(midipath):
|
||||
if i.endswith('.mid'):
|
||||
|
@ -45,10 +45,9 @@ while True:
|
||||
heightmax = int(heightmax)
|
||||
break
|
||||
|
||||
except:
|
||||
except BaseException:
|
||||
print('输入错误,请重新输入')
|
||||
|
||||
|
||||
if os.path.isdir(midipath):
|
||||
for i in os.listdir(midipath):
|
||||
if i.endswith('.mid'):
|
||||
|
@ -31,8 +31,10 @@ Note! Except for this source file, all the files in this repository and this pro
|
||||
|
||||
|
||||
def _toCmdList_m1(
|
||||
self, scoreboardname: str = "mscplay", volume: float = 1.0, speed: float = 1.0
|
||||
) -> list:
|
||||
self,
|
||||
scoreboardname: str = "mscplay",
|
||||
volume: float = 1.0,
|
||||
speed: float = 1.0) -> list:
|
||||
"""
|
||||
使用Dislink Sforza的转换思路,将midi转换为我的世界命令列表
|
||||
:param scoreboardname: 我的世界的计分板名称
|
||||
@ -73,16 +75,14 @@ def _toCmdList_m1(
|
||||
maxscore = max(maxscore, nowscore)
|
||||
soundID, _X = self.__Inst2soundIDwithX(instrumentID)
|
||||
singleTrack.append(
|
||||
"execute @a[scores={"
|
||||
+ str(scoreboardname)
|
||||
+ "="
|
||||
+ str(nowscore)
|
||||
+ "}"
|
||||
+ f"] ~ ~ ~ playsound {soundID} @s ~ ~{1 / volume - 1} ~ {msg.velocity * (0.7 if msg.channel == 0 else 0.9)} {2 ** ((msg.note - 60 - _X) / 12)}"
|
||||
)
|
||||
"execute @a[scores={" +
|
||||
str(scoreboardname) +
|
||||
"=" +
|
||||
str(nowscore) +
|
||||
"}" +
|
||||
f"] ~ ~ ~ playsound {soundID} @s ~ ~{1 / volume - 1} ~ {msg.velocity * (0.7 if msg.channel == 0 else 0.9)} {2 ** ((msg.note - 60 - _X) / 12)}")
|
||||
commands += 1
|
||||
if len(singleTrack) != 0:
|
||||
tracks.append(singleTrack)
|
||||
|
||||
return tracks, commands, maxscore
|
||||
|
||||
return [tracks, commands, maxscore]
|
||||
|
@ -90,7 +90,7 @@ class midiConvert:
|
||||
钟琴bell、管钟chime、木琴xylophone的时候为4
|
||||
而存在一些打击乐器basedrum、hat、snare,没有音域,则没有X,那么我们返回7即可
|
||||
:param instrumentID: midi的乐器ID
|
||||
:param default: 如果instrumentID不在范围内,返回的默认我的世界乐器名称
|
||||
default: 如果instrumentID不在范围内,返回的默认我的世界乐器名称
|
||||
:return: (str我的世界乐器名, int转换算法中的X)"""
|
||||
try:
|
||||
a = {
|
||||
@ -385,7 +385,7 @@ class midiConvert:
|
||||
执行延时
|
||||
:param customName: `str`
|
||||
悬浮字
|
||||
:param lastOutput: `str`
|
||||
lastOutput: `str`
|
||||
上次输出字符串,注意此处需要留空
|
||||
:param executeOnFirstTick: `bool`
|
||||
执行第一个已选项(循环指令方块是否激活后立即执行,若为False,则从激活时起延迟后第一次执行)
|
||||
@ -712,7 +712,7 @@ class midiConvert:
|
||||
scoreboardname: str = "mscplay",
|
||||
volume: float = 1.0,
|
||||
speed: float = 1.0,
|
||||
) -> bool:
|
||||
) -> bool or tuple:
|
||||
"""
|
||||
使用method指定的转换算法,将midi转换为我的世界mcpack格式的包
|
||||
:param method: 转换算法
|
||||
|
Loading…
Reference in New Issue
Block a user