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.
|
limitations under the License.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
from msctPkgver.main import *
|
from msctPkgver.main import *
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -80,15 +79,14 @@ while True:
|
|||||||
if isAutoReset != '':
|
if isAutoReset != '':
|
||||||
isAutoReset = bool(int(isAutoReset))
|
isAutoReset = bool(int(isAutoReset))
|
||||||
break
|
break
|
||||||
except:
|
except BaseException:
|
||||||
print('输入错误,请重新输入')
|
print('输入错误,请重新输入')
|
||||||
|
|
||||||
|
|
||||||
if os.path.isdir(midipath):
|
if os.path.isdir(midipath):
|
||||||
for i in os.listdir(midipath):
|
for i in os.listdir(midipath):
|
||||||
if i.endswith('.mid'):
|
if i.endswith('.mid'):
|
||||||
print(f'正在操作{i}')
|
print(f'正在操作{i}')
|
||||||
convertion.convert(midipath + '/' + i, outpath + '/' + i[:-4] )
|
convertion.convert(midipath + '/' + i, outpath + '/' + i[:-4])
|
||||||
if outFormat == 0:
|
if outFormat == 0:
|
||||||
convertion.tomcpack(
|
convertion.tomcpack(
|
||||||
1,
|
1,
|
||||||
|
@ -45,10 +45,9 @@ while True:
|
|||||||
heightmax = int(heightmax)
|
heightmax = int(heightmax)
|
||||||
break
|
break
|
||||||
|
|
||||||
except:
|
except BaseException:
|
||||||
print('输入错误,请重新输入')
|
print('输入错误,请重新输入')
|
||||||
|
|
||||||
|
|
||||||
if os.path.isdir(midipath):
|
if os.path.isdir(midipath):
|
||||||
for i in os.listdir(midipath):
|
for i in os.listdir(midipath):
|
||||||
if i.endswith('.mid'):
|
if i.endswith('.mid'):
|
||||||
|
@ -6,13 +6,13 @@ from msctPkgver.main import *
|
|||||||
convertion = midiConvert()
|
convertion = midiConvert()
|
||||||
convertion.convert(input('请输入midi文件路径:'), input('请输入输出路径:'))
|
convertion.convert(input('请输入midi文件路径:'), input('请输入输出路径:'))
|
||||||
for i in convertion.toBDXfile(
|
for i in convertion.toBDXfile(
|
||||||
1,
|
1,
|
||||||
input('请输入作者:'),
|
input('请输入作者:'),
|
||||||
bool(int(input('是否开启进度条(1|0):'))),
|
bool(int(input('是否开启进度条(1|0):'))),
|
||||||
int(input('请输入指令结构最大生成高度:')),
|
int(input('请输入指令结构最大生成高度:')),
|
||||||
input('请输入计分板名称:'),
|
input('请输入计分板名称:'),
|
||||||
float(input('请输入音量(0-1]:')),
|
float(input('请输入音量(0-1]:')),
|
||||||
float(input('请输入速度倍率:')),
|
float(input('请输入速度倍率:')),
|
||||||
bool(int(input('是否自动重置计分板(1|0):'))),
|
bool(int(input('是否自动重置计分板(1|0):'))),
|
||||||
):
|
):
|
||||||
print(i)
|
print(i)
|
||||||
|
@ -31,8 +31,10 @@ Note! Except for this source file, all the files in this repository and this pro
|
|||||||
|
|
||||||
|
|
||||||
def _toCmdList_m1(
|
def _toCmdList_m1(
|
||||||
self, scoreboardname: str = "mscplay", volume: float = 1.0, speed: float = 1.0
|
self,
|
||||||
) -> list:
|
scoreboardname: str = "mscplay",
|
||||||
|
volume: float = 1.0,
|
||||||
|
speed: float = 1.0) -> list:
|
||||||
"""
|
"""
|
||||||
使用Dislink Sforza的转换思路,将midi转换为我的世界命令列表
|
使用Dislink Sforza的转换思路,将midi转换为我的世界命令列表
|
||||||
:param scoreboardname: 我的世界的计分板名称
|
:param scoreboardname: 我的世界的计分板名称
|
||||||
@ -73,16 +75,14 @@ def _toCmdList_m1(
|
|||||||
maxscore = max(maxscore, nowscore)
|
maxscore = max(maxscore, nowscore)
|
||||||
soundID, _X = self.__Inst2soundIDwithX(instrumentID)
|
soundID, _X = self.__Inst2soundIDwithX(instrumentID)
|
||||||
singleTrack.append(
|
singleTrack.append(
|
||||||
"execute @a[scores={"
|
"execute @a[scores={" +
|
||||||
+ str(scoreboardname)
|
str(scoreboardname) +
|
||||||
+ "="
|
"=" +
|
||||||
+ str(nowscore)
|
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)}"
|
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
|
commands += 1
|
||||||
if len(singleTrack) != 0:
|
if len(singleTrack) != 0:
|
||||||
tracks.append(singleTrack)
|
tracks.append(singleTrack)
|
||||||
|
|
||||||
return tracks, commands, maxscore
|
return [tracks, commands, maxscore]
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ class midiConvert:
|
|||||||
钟琴bell、管钟chime、木琴xylophone的时候为4
|
钟琴bell、管钟chime、木琴xylophone的时候为4
|
||||||
而存在一些打击乐器basedrum、hat、snare,没有音域,则没有X,那么我们返回7即可
|
而存在一些打击乐器basedrum、hat、snare,没有音域,则没有X,那么我们返回7即可
|
||||||
:param instrumentID: midi的乐器ID
|
:param instrumentID: midi的乐器ID
|
||||||
:param default: 如果instrumentID不在范围内,返回的默认我的世界乐器名称
|
default: 如果instrumentID不在范围内,返回的默认我的世界乐器名称
|
||||||
:return: (str我的世界乐器名, int转换算法中的X)"""
|
:return: (str我的世界乐器名, int转换算法中的X)"""
|
||||||
try:
|
try:
|
||||||
a = {
|
a = {
|
||||||
@ -385,7 +385,7 @@ class midiConvert:
|
|||||||
执行延时
|
执行延时
|
||||||
:param customName: `str`
|
:param customName: `str`
|
||||||
悬浮字
|
悬浮字
|
||||||
:param lastOutput: `str`
|
lastOutput: `str`
|
||||||
上次输出字符串,注意此处需要留空
|
上次输出字符串,注意此处需要留空
|
||||||
:param executeOnFirstTick: `bool`
|
:param executeOnFirstTick: `bool`
|
||||||
执行第一个已选项(循环指令方块是否激活后立即执行,若为False,则从激活时起延迟后第一次执行)
|
执行第一个已选项(循环指令方块是否激活后立即执行,若为False,则从激活时起延迟后第一次执行)
|
||||||
@ -712,7 +712,7 @@ class midiConvert:
|
|||||||
scoreboardname: str = "mscplay",
|
scoreboardname: str = "mscplay",
|
||||||
volume: float = 1.0,
|
volume: float = 1.0,
|
||||||
speed: float = 1.0,
|
speed: float = 1.0,
|
||||||
) -> bool:
|
) -> bool or tuple:
|
||||||
"""
|
"""
|
||||||
使用method指定的转换算法,将midi转换为我的世界mcpack格式的包
|
使用method指定的转换算法,将midi转换为我的世界mcpack格式的包
|
||||||
:param method: 转换算法
|
:param method: 转换算法
|
||||||
|
Loading…
Reference in New Issue
Block a user