mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2025-01-31 15:31:55 +08:00
修复部分bug,增加部分bug
This commit is contained in:
parent
bcaeb129a5
commit
2fcfdca0a0
@ -81,31 +81,7 @@ print('建立变量,存入内存,载入字典常量函数')
|
|||||||
#
|
#
|
||||||
# 新增音轨: dataset[第几个项目]['musics'].append(datasetmodelpart)
|
# 新增音轨: dataset[第几个项目]['musics'].append(datasetmodelpart)
|
||||||
#
|
#
|
||||||
'''
|
|
||||||
dataset=[
|
|
||||||
{
|
|
||||||
'mainset':{
|
|
||||||
'PackName':'Ryoun',
|
|
||||||
'MusicTitle':'Noname',
|
|
||||||
'IsRepeat':False,
|
|
||||||
'PlayerSelect':''
|
|
||||||
},
|
|
||||||
'musics':[
|
|
||||||
{
|
|
||||||
'set':{
|
|
||||||
'EntityName':'music_support',
|
|
||||||
'ScoreboardName':'music_support',
|
|
||||||
'Instrument':'harp',
|
|
||||||
'FileName':'Music'
|
|
||||||
},
|
|
||||||
'notes':[
|
|
||||||
[0.0,1.0],
|
|
||||||
]
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
'''
|
|
||||||
|
|
||||||
dataset = [
|
dataset = [
|
||||||
{
|
{
|
||||||
@ -125,19 +101,57 @@ dataset = [
|
|||||||
'FileName': 'Music'
|
'FileName': 'Music'
|
||||||
},
|
},
|
||||||
'notes': [
|
'notes': [
|
||||||
[0.0, 1.0],
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
'''一个项目中的全部数据。格式参照:
|
||||||
|
[
|
||||||
|
{
|
||||||
|
'mainset':{
|
||||||
|
'PackName':'Ryoun',
|
||||||
|
'MusicTitle':'Noname',
|
||||||
|
'IsRepeat':False,
|
||||||
|
'PlayerSelect':''
|
||||||
|
},
|
||||||
|
'musics':[
|
||||||
|
{
|
||||||
|
'set':{
|
||||||
|
'EntityName':'music_support',
|
||||||
|
'ScoreboardName':'music_support',
|
||||||
|
'Instrument':'harp',
|
||||||
|
'FileName':'Music'
|
||||||
|
},
|
||||||
|
'notes':[
|
||||||
|
- Note对象
|
||||||
|
或
|
||||||
|
- [MC音调, 持续时间(s)]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
'''
|
||||||
|
|
||||||
is_new_file = True
|
is_new_file = True
|
||||||
|
'''这是否是一个新建的项目?'''
|
||||||
|
|
||||||
is_save = True
|
is_save = True
|
||||||
|
'''当前项目是否已保存?'''
|
||||||
|
|
||||||
ProjectName = ''
|
ProjectName = ''
|
||||||
|
'''项目名称,即打开的msct文件名'''
|
||||||
|
|
||||||
clearLog = False
|
clearLog = False
|
||||||
|
'''是否在程序结束时移除日志'''
|
||||||
|
|
||||||
NowMusic = 0
|
NowMusic = 0
|
||||||
|
'''当前音轨'''
|
||||||
|
|
||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
|
'''主窗口'''
|
||||||
|
|
||||||
|
|
||||||
def DMM(): # 反回字典用于编辑
|
def DMM(): # 反回字典用于编辑
|
||||||
@ -163,6 +177,7 @@ def __main__():
|
|||||||
音·创 开发交流群 861684859\n
|
音·创 开发交流群 861684859\n
|
||||||
Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com\n
|
Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com\n
|
||||||
版权所有 Team-Ryoun 金羿\n
|
版权所有 Team-Ryoun 金羿\n
|
||||||
|
代码根据Apache 2.0 协议开源\n
|
||||||
若需转载或借鉴 请附作者\n
|
若需转载或借鉴 请附作者\n
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -444,13 +459,13 @@ def __main__():
|
|||||||
# print(read)
|
# print(read)
|
||||||
dataset = read[0]
|
dataset = read[0]
|
||||||
pkl1 = read[1]
|
pkl1 = read[1]
|
||||||
log("读取新文件成功")
|
log(f"读取新文件成功:\n{str(dataset[0])}")
|
||||||
with open("1.pkl", 'wb') as w:
|
with open("1.pkl", 'wb') as w:
|
||||||
pickle.dump(pkl1, w)
|
pickle.dump(pkl1, w)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
with open(fn, 'rb') as C:
|
with open(fn, 'rb') as C:
|
||||||
dataset[0] = pickle.load(C)
|
dataset[0] = pickle.load(C)
|
||||||
log("读取新文件成功")
|
log(f"读取新文件成功:\n{str(dataset[0])}")
|
||||||
except pickle.UnpicklingError: # 程序规范修改:根据新的语法标准:except后面不能没有错误类型,测试后改为:
|
except pickle.UnpicklingError: # 程序规范修改:根据新的语法标准:except后面不能没有错误类型,测试后改为:
|
||||||
# pickle.UnpicklingError
|
# pickle.UnpicklingError
|
||||||
print(READABLETEXT[8].format(fn))
|
print(READABLETEXT[8].format(fn))
|
||||||
@ -1696,10 +1711,10 @@ def __main__():
|
|||||||
# 大标题
|
# 大标题
|
||||||
tk.Label(UpLeftFrame, text=READABLETEXT[91], font=('', 20)).pack()
|
tk.Label(UpLeftFrame, text=READABLETEXT[91], font=('', 20)).pack()
|
||||||
# 按钮式文本
|
# 按钮式文本
|
||||||
LabelPackName = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[46], font=('', 15))
|
LabelPackName = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[46].format(str(dataset[0]['mainset']['PackName'])), font=('', 15))
|
||||||
LabelMusicTitle = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[47], font=('', 15))
|
LabelMusicTitle = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[47].format(str(dataset[0]['mainset']['MusicTitle'])), font=('', 15))
|
||||||
LabelIsRepeat = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[48], font=('', 15))
|
LabelIsRepeat = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[48].format(str(dataset[0]['mainset']['IsRepeat'])), font=('', 15))
|
||||||
LabelPlayerSelect = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[49], font=('', 15))
|
LabelPlayerSelect = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[49].format(str(dataset[0]['mainset']['PlayerSelect'])), font=('', 15))
|
||||||
# 绑定按钮
|
# 绑定按钮
|
||||||
LabelPackName.bind('<Button-1>', changePackName)
|
LabelPackName.bind('<Button-1>', changePackName)
|
||||||
LabelMusicTitle.bind('<Button-1>', changeMusicTitle)
|
LabelMusicTitle.bind('<Button-1>', changeMusicTitle)
|
||||||
@ -1732,10 +1747,10 @@ def __main__():
|
|||||||
# 大标题
|
# 大标题
|
||||||
tk.Label(UpRightFrame, text=READABLETEXT[97], font=('', 20)).pack()
|
tk.Label(UpRightFrame, text=READABLETEXT[97], font=('', 20)).pack()
|
||||||
# 按钮式文本
|
# 按钮式文本
|
||||||
LabelEntityName = tk.Label(UpRightFrame, bg='white', text=READABLETEXT[42], font=('', 15))
|
LabelEntityName = tk.Label(UpRightFrame, bg='white', text=READABLETEXT[42].format(dataset[0]['musics'][NowMusic]['set']['EntityName']), font=('', 15))
|
||||||
LabelScoreboardName = tk.Label(UpRightFrame, bg='white', text=READABLETEXT[43], font=('', 15))
|
LabelScoreboardName = tk.Label(UpRightFrame, bg='white', text=READABLETEXT[43].format(dataset[0]['musics'][NowMusic]['set']['ScoreboardName']), font=('', 15))
|
||||||
LabelInstrument = tk.Label(UpRightFrame, bg='white', text=READABLETEXT[44], font=('', 15))
|
LabelInstrument = tk.Label(UpRightFrame, bg='white', text=READABLETEXT[44].format(dataset[0]['musics'][NowMusic]['set']['Instrument']), font=('', 15))
|
||||||
LabelFileName = tk.Label(UpRightFrame, bg='white', text=READABLETEXT[45], font=('', 15))
|
LabelFileName = tk.Label(UpRightFrame, bg='white', text=READABLETEXT[45].format(dataset[0]['musics'][NowMusic]['set']['FileName']), font=('', 15))
|
||||||
# 绑定按钮
|
# 绑定按钮
|
||||||
LabelEntityName.bind('<Button-1>', changeEntityName)
|
LabelEntityName.bind('<Button-1>', changeEntityName)
|
||||||
LabelScoreboardName.bind('<Button-1>', changeScoreboardName)
|
LabelScoreboardName.bind('<Button-1>', changeScoreboardName)
|
||||||
@ -1793,7 +1808,6 @@ def __main__():
|
|||||||
if len(sys.argv) != 1:
|
if len(sys.argv) != 1:
|
||||||
log('初始化打开音·创项目' + sys.argv[1])
|
log('初始化打开音·创项目' + sys.argv[1])
|
||||||
global is_save
|
global is_save
|
||||||
global dataset
|
|
||||||
is_save = True
|
is_save = True
|
||||||
error = True
|
error = True
|
||||||
try:
|
try:
|
||||||
@ -1813,7 +1827,6 @@ def __main__():
|
|||||||
global ProjectName
|
global ProjectName
|
||||||
is_new_file = False
|
is_new_file = False
|
||||||
ProjectName = sys.argv[1]
|
ProjectName = sys.argv[1]
|
||||||
global NowMusic
|
|
||||||
RefreshMain()
|
RefreshMain()
|
||||||
RefreshMusic(NowMusic)
|
RefreshMusic(NowMusic)
|
||||||
|
|
||||||
|
36
README.md
36
README.md
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
### 作者
|
### 作者
|
||||||
|
|
||||||
金羿 (Eilles):主要作者,开发了音·创主体机器前身“函数音乐生成器”、“世界音创”。
|
金羿 (Eilles):主要作者,开发了音·创主体,及其前身“函数音乐生成器”、“世界音创”。
|
||||||
|
|
||||||
bgArray “诸葛亮与八卦阵”:修复bug,改进代码美观度,增加新功能,更改数据格式等。
|
bgArray “诸葛亮与八卦阵”:修复bug,改进代码美观度,增加新功能,更改数据格式等。
|
||||||
|
|
||||||
@ -67,22 +67,20 @@ python3 Musicreater.py
|
|||||||
|
|
||||||
### 诸葛亮与八卦阵的说明(不必要)
|
### 诸葛亮与八卦阵的说明(不必要)
|
||||||
|
|
||||||
1. 首先!这里的提示是给想使用多音色资源包的人的,如果你想请下载 神羽资源包(神羽自己的链接):https://pan.baidu.com/s/11uoq5zwN7c3rX-98DqVpJg
|
1. 首先!这里的提示是给想使用多音色资源包的人的,如果你想用就请下载 [神羽资源包(神羽自己的链接)](https://pan.baidu.com/s/11uoq5zwN7c3rX-98DqVpJg)提取码:ek3t
|
||||||
提取码:ek3t
|
2. 下载到你自己电脑上某个位置,可以不放置于本项目下。音色资源包较大,可以选取只下载:
|
||||||
2. 下载到你自己电脑上某个位置,注意并不需要放置于本项目下。音色资源包较大,可以选取只下载:
|
`神羽资源包_乐器、音源的资源包\羽音缭绕-midiout_25.0` 这个文件夹,再嫌麻烦的话,也可以只下载其中的:
|
||||||
`神羽资源包_乐器、音源的资源包\羽音缭绕-midiout_25.0` 这个文件夹。
|
`神羽资源包_乐器\音源的资源包\羽音缭绕-midiout_25.0\mcpack(国际版推荐)格式_25.0` 或者:
|
||||||
3. 也可以只下载其中的:
|
`神羽资源包_乐器\音源的资源包\羽音缭绕-midiout_25.0\zip格式_25.0`
|
||||||
`神羽资源包_乐器\音源的资源包\羽音缭绕-midiout_25.0\mcpack(国际版推荐)格式_25.0` 或者:
|
4. 接下来就是关键了:在*音创*中绑定资源包
|
||||||
`神羽资源包_乐器\音源的资源包\羽音缭绕-midiout_25.0\zip格式_25.0`
|
首先,先打开 *音创*->帮助与疑问->\[神羽资源包位置选择\]:选择文件夹... 这时候,会跳出选择框
|
||||||
4. 接下来就是关键了:在音创中绑定资源包
|
关键来了,选择:***您下载的`羽音缭绕-midiout_25.0`文件夹,或者`mcpack(国际版推荐)格式_25.0`或`zip格式_25.0`的上级目录***
|
||||||
5. 首先,先打开音创->帮助与疑问->[神羽资源包位置选择]:选择文件夹... 这时候,
|
举个例子:我的文件路径是这样的:
|
||||||
会跳出选择框,关键来了,选择:***你的mcpack(国际版推荐)_25.0文件夹或zip格式_25.0文件夹,外面的!文件夹!注意是外面的文件夹!!***
|
`L:\shenyu\音源的资源包\羽音缭绕-midiout_25.0`这里面有:`神羽资源包_25.0_使用方法.xls`、
|
||||||
举个例子:我的文件路径是这样的:
|
`mcpack(国际版推荐)格式_25.0`、`zip格式_25.0`两个文件夹和一个.xls文件,而你在音创中
|
||||||
`L:\shenyu\音源的资源包\羽音缭绕-midiout_25.0`这里面有:`神羽资源包_25.0_使用方法.xls`、
|
也应该选择这个文件夹:**L:\shenyu\音源的资源包\羽音缭绕-midiout_25.0**
|
||||||
`mcpack(国际版推荐)格式_25.0`、`zip格式_25.0`两个文件夹和一个.xls文件,而你在音创中
|
6. 如果你想使用音色资源包来制作函数,那么解析时你应该用 *音创*->编辑->从midi导入音轨且用新方法解析,
|
||||||
也应该选择这个文件夹:**L:\shenyu\音源的资源包\羽音缭绕-midiout_25.0**
|
然后再使用 *音创*->函数(包)->下面的四个新函数
|
||||||
6. 如果你想使用音色资源包函数,那么解析时你应该用音创->编辑->从midi导入音轨且用新方法解析,然后在使用
|
|
||||||
音创->函数(包)->下面的四个新函数
|
|
||||||
|
|
||||||
### 致谢
|
### 致谢
|
||||||
|
|
||||||
@ -90,7 +88,7 @@ python3 Musicreater.py
|
|||||||
2. 感谢 昀梦\<QQ1515399885\> 找出指令生成错误bug并指正
|
2. 感谢 昀梦\<QQ1515399885\> 找出指令生成错误bug并指正
|
||||||
3. 感谢由 Charlie_Ping “查理平” 带来的bdx转换功能
|
3. 感谢由 Charlie_Ping “查理平” 带来的bdx转换功能
|
||||||
4. 感谢由 CMA_2401PT 带来的 BDXWorkShop 供本程序对于bdx操作的指导
|
4. 感谢由 CMA_2401PT 带来的 BDXWorkShop 供本程序对于bdx操作的指导
|
||||||
5. 感谢由 Miracle Plume “神羽” \<QQshenyu40403\>带来的基岩版音色资源包
|
5. 感谢由 Miracle Plume “神羽” \<QQshenyu40403\>带来的羽音缭绕基岩版音色资源包
|
||||||
6. 感谢广大群友为此程序提供的测试等支持
|
6. 感谢广大群友为此程序提供的测试等支持
|
||||||
7. 若您对我们有所贡献但您的名字没有显示在此列表中,请联系我!
|
7. 若您对我们有所贡献但您的名字没有显示在此列表中,请联系我!
|
||||||
|
|
||||||
@ -101,6 +99,6 @@ python3 Musicreater.py
|
|||||||
2. 电邮 EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
2. 电邮 EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||||
3. 微信 WYI_DoctorYI
|
3. 微信 WYI_DoctorYI
|
||||||
|
|
||||||
### 作者 诸葛亮与八卦阵 联系方式
|
### 作者\<*诸葛亮与八卦阵*\>(bgArray) 联系方式
|
||||||
|
|
||||||
1. QQ 4740437765
|
1. QQ 4740437765
|
46
README_en.md
46
README_en.md
@ -6,10 +6,10 @@ Musicreater(音·创) is an Eilles(*W-YI*)'s app that is used for creating music
|
|||||||
Welcome to join our QQ group: 861684859
|
Welcome to join our QQ group: 861684859
|
||||||
|
|
||||||
###Author
|
###Author
|
||||||
金羿Eilles: the main author, who developed the predecessor of the main machine of sound creation, "function music generator"
|
|
||||||
and "world sound creation".
|
|
||||||
|
|
||||||
bgArray "诸葛亮与八卦阵": fix bugs, improve code aesthetics, add new functions, change data format, etc.
|
Eilles (金羿):The main author, who developed the most and especially the principal parts of Musicreater, and its predecessors, which has been called as "*Minecraft Function Music Maker*", "*Note Fun Creater*", "*Note World Creater*"(now ,they are united as ***Musicreater***!)
|
||||||
|
|
||||||
|
bgArray "诸葛亮与八卦阵": Fix bugs, improve code aesthetics, add new functions, change data format, etc.
|
||||||
|
|
||||||
### Framework
|
### Framework
|
||||||
|
|
||||||
@ -66,35 +66,31 @@ python3 Musicreater.py
|
|||||||
3. The English Edition is comming soon.
|
3. The English Edition is comming soon.
|
||||||
|
|
||||||
|
|
||||||
###Explanation of bgArray 诸葛亮与八卦阵 (unnecessary)
|
### Explanation of bgArray 诸葛亮与八卦阵 (unnecessary)
|
||||||
1. First! The tips here are for those who want to use the multi tone resource package. If you want to download the
|
|
||||||
Shenyu resource package (Shenyu's own link): https://pan.baidu.com/s/11uoq5zwN7c3rX-98DqVpJg
|
1. First! The tips here are for those who want to use the multi tone resource package, [Shenyu resource package (Shenyu's own link)](https://pan.baidu.com/s/11uoq5zwN7c3rX-98DqVpJg) \(Extraction code: `ek3t`\)
|
||||||
Extraction code: ek3t
|
2. Download it to any location on your PC. Note that it does ***not*** need to be placed in the directory where *Musicreater* are. The audio resource package is large, so you can choose to download only:`神羽资源包_乐器、音源的资源包\羽音缭绕-midiout_25.0`.
|
||||||
2. Download to a location on your own computer. Note that it does not need to be placed under this project. The audio
|
Also, you can download only `神羽资源包_乐器\音源的资源包\羽音缭绕-midiout_25.0\mcpack(国际版推荐)格式_25.0` or
|
||||||
resource package is large. You can choose to download only:
|
`神羽资源包_乐器\音源的资源包\羽音缭绕-midiout_25.0\zip格式_25.0`.
|
||||||
`神羽资源包_乐器、音源的资源包\羽音缭绕-midiout_25.0` this folder.
|
4. The next step is the most IMPORTANT: to bind the resource package to *Musicreater*
|
||||||
3. You can also download only:
|
First, open *Musicreater*->Q&A->Select \[MiraclePlumeResourcePack\]... .At this time, in the selection box,
|
||||||
`神羽资源包_乐器\音源的资源包\羽音缭绕-midiout_25.0\mcpack(国际版推荐)格式_25.0` or:
|
the IMPORTANT step comes, select: ***The directory you downloaded: `羽音缭绕-midiout_25.0`, or also the parent directory `mcpack(国际版推荐)格式_25.0`or`zip格式_25.0`***
|
||||||
`神羽资源包_乐器\音源的资源包\羽音缭绕-midiout_25.0\zip格式_25.0`
|
For example, my file path is as follows:
|
||||||
4. The next step is the key: bind the resource package in the sound creation
|
`L:\shenyu\音源的资源包\羽音缭绕-midiout_25.0` and in the directory, there are two folders and one .xls file:
|
||||||
5. First, open Musicreater - > help and questions - > [Shenyu resource package location selection]: select Folder At this time,
|
`神羽资源包_25.0_使用方法.xls`, `mcpack(国际版推荐)格式_25.0` and `zip格式_25.0`, so in *Musicreater* you should also select this folder: **L:\shenyu\音源的资源包\羽音缭绕-midiout_25.0**
|
||||||
Will jump out of the selection box, the key comes, select: ***your mcpack (International Version recommended)_ 25.0 folder or ZIP format_ 25.0 folder, outside! folder! Note that it's the folder outside***
|
6. If you want to use the Miracle Plume Bedrock Edition Audio Resource Pack to make .mcfunction s, you should use Musicreater -> Edit - > Import audio tracks from MIDI and parse them with a new method, and then use it
|
||||||
For example, my file path is as follows:
|
|
||||||
`L:\shenyu\音源的资源包\羽音缭绕-midiout_25.0` here is: `神羽资源包_25.0_使用方法.xls`,
|
|
||||||
`mcpack(国际版推荐)格式_25.0`, `zip格式_25.0` two folders and one .xls file, and you're in sound creation
|
|
||||||
You should also select this folder:**L:\shenyu\音源的资源包\羽音缭绕-midiout_25.0**
|
|
||||||
6. If you want to use the voice resource package function, you should use Musicreater - > Edit - > Import audio tracks from MIDI and parse them with a new method, and then use it
|
|
||||||
Musicreater - > function (package) - > the following four new functions
|
Musicreater - > function (package) - > the following four new functions
|
||||||
|
|
||||||
### Thanks
|
### Thanks
|
||||||
|
|
||||||
1. Thank [Fuckcraft](https://github.com/fuckcraft) “鸣凤鸽子”and so on for the function of Creating the Websocket Server for Minecraft: Bedrock Edition.
|
1. Thank [Fuckcraft](https://github.com/fuckcraft) (“鸣凤鸽子” ,etc) for the function of Creating the Websocket Server for Minecraft: Bedrock Edition.
|
||||||
|
- *!! They have given me the rights to directly copy the lib into Musicreater*
|
||||||
2. Thank 昀梦\<QQ1515399885\> for finding and correcting the bugs in the commands that *Musicreater* Created.
|
2. Thank 昀梦\<QQ1515399885\> for finding and correcting the bugs in the commands that *Musicreater* Created.
|
||||||
3. Thank Charlie_Ping “查理平” for bdx convert funtion.
|
3. Thank Charlie_Ping “查理平” for bdx convert funtion.
|
||||||
4. Thank CMA_2401PT for BDXWorkShop as the .bdx structure's operation guide.
|
4. Thank CMA_2401PT for BDXWorkShop as the .bdx structure's operation guide.
|
||||||
5. Thanks for the bedrock audio resource pack brought by miracle plume "Shenyu" \<QQshenyu40403\>
|
5. Thank Miracle Plume “神羽” \<QQshenyu40403\> for the Miracle Plume Bedrock Edition Audio Resource Pack
|
||||||
6. Thanks for a lot of groupmates who support me and help me to test the program.
|
6. Thanks for a lot of groupmates who support me and help me to test the program.
|
||||||
7. If u have give me some help but u haven't been in the list, please contact me.
|
7. If you have give me some help but u haven't been in the list, please contact me.
|
||||||
|
|
||||||
|
|
||||||
### Contact *Eilles(W-YI)*(金羿)
|
### Contact *Eilles(W-YI)*(金羿)
|
||||||
@ -103,6 +99,6 @@ Musicreater - > function (package) - > the following four new functions
|
|||||||
2. E-mail EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
2. E-mail EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||||
3. WeChat WYI_DoctorYI
|
3. WeChat WYI_DoctorYI
|
||||||
|
|
||||||
### Author bgArray 诸葛亮与八卦阵 contact information
|
### Contact *bgArray*(诸葛亮与八卦阵)
|
||||||
|
|
||||||
1. QQ 4740437765
|
1. QQ 4740437765
|
162
bgArrayLib/reader.py
Normal file
162
bgArrayLib/reader.py
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from nmcsup.log import log
|
||||||
|
import pickle
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Note:
|
||||||
|
def __init__(self, channel, pitch, velocity, time, time_position, instrument):
|
||||||
|
self.channel = channel
|
||||||
|
self.pitch = pitch
|
||||||
|
self.velocity = velocity
|
||||||
|
self.delay = time
|
||||||
|
self.time_position = time_position
|
||||||
|
self.instrument = instrument
|
||||||
|
self.CD = "d"
|
||||||
|
|
||||||
|
def get_CD(self, start, end):
|
||||||
|
if end - start > 1.00:
|
||||||
|
self.CD = "c"
|
||||||
|
else:
|
||||||
|
self.CD = "d"
|
||||||
|
|
||||||
|
|
||||||
|
def midi_conversion(midfile: str):
|
||||||
|
import mido
|
||||||
|
# from msctspt.threadOpera import NewThread
|
||||||
|
from bgArrayLib.bpm import get
|
||||||
|
|
||||||
|
def Time(mt, tpb_a, bpm_a):
|
||||||
|
return round(mt / tpb_a / bpm_a * 60 * 20)
|
||||||
|
|
||||||
|
Notes = []
|
||||||
|
tracks = []
|
||||||
|
note_list = []
|
||||||
|
close = []
|
||||||
|
on = []
|
||||||
|
off = []
|
||||||
|
instruments = []
|
||||||
|
isPercussion = False
|
||||||
|
try:
|
||||||
|
mid = mido.MidiFile(midfile)
|
||||||
|
except FileNotFoundError:
|
||||||
|
log("找不到文件或无法读取文件" + midfile)
|
||||||
|
return False
|
||||||
|
tpb = mid.ticks_per_beat
|
||||||
|
bpm = get(midfile)
|
||||||
|
# 解析
|
||||||
|
# def loadMidi(track1):
|
||||||
|
for track in mid.tracks:
|
||||||
|
overallTime = 0.0
|
||||||
|
instrument = 0
|
||||||
|
for i in track:
|
||||||
|
overallTime += i.time
|
||||||
|
try:
|
||||||
|
if i.channel != 9:
|
||||||
|
# try:
|
||||||
|
# log("event_type(事件): " + str(i.type) + " channel(音轨): " + str(i.channel) +
|
||||||
|
# " note/pitch(音高): " +
|
||||||
|
# str(i[2]) +
|
||||||
|
# " velocity(力度): " + str(i.velocity) + " time(间隔时间): " + str(i.time) +
|
||||||
|
# " overallTime/globalTime/timePosition: " + str(overallTime) + " \n")
|
||||||
|
# except AttributeError:
|
||||||
|
# log("event_type(事件): " + str(i.type) + " thing(内容):" + str(i) + " \n")
|
||||||
|
if 'program_change' in str(i):
|
||||||
|
instrument = i.program
|
||||||
|
if instrument > 119: # 音色不够
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
instruments.append(i.program)
|
||||||
|
if 'note_on' in str(i) and i.velocity > 0:
|
||||||
|
print(i)
|
||||||
|
# print(i.note)
|
||||||
|
# print([Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), instrument)])
|
||||||
|
tracks.append(
|
||||||
|
[Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), instrument)])
|
||||||
|
note_list.append(
|
||||||
|
[i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), instrument])
|
||||||
|
on.append([i.note, Time(overallTime, tpb, bpm)])
|
||||||
|
# return [Note(i.channel, i, i.velocity, i.time, Time(overallTime, tpb, bpm))]
|
||||||
|
if 'note_off' in str(i) or 'note_on' in str(i) and i.velocity == 0:
|
||||||
|
# print(i)
|
||||||
|
# print([Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm))])
|
||||||
|
close.append(
|
||||||
|
[Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), instrument)])
|
||||||
|
off.append([i.note, Time(overallTime, tpb, bpm)])
|
||||||
|
# return [Note(i.channel, i, i.velocity, i.time, Time(overallTime, tpb, bpm))]
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
if 'note_on' in str(i) and i.channel == 9:
|
||||||
|
if 'note_on' in str(i) and i.velocity > 0:
|
||||||
|
print(i)
|
||||||
|
# print(i.note)
|
||||||
|
# print([Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), -1)])
|
||||||
|
tracks.append([Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), -1)])
|
||||||
|
note_list.append([i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), -1])
|
||||||
|
on.append([i.note, Time(overallTime, tpb, bpm)])
|
||||||
|
isPercussion = True
|
||||||
|
# return [Note(i.channel, i, i.velocity, i.time, Time(overallTime, tpb, bpm))]
|
||||||
|
Notes.append(tracks)
|
||||||
|
if instruments is []:
|
||||||
|
instruments.append(0)
|
||||||
|
instruments = list(set(instruments))
|
||||||
|
with open("1.pkl", 'wb') as b:
|
||||||
|
pickle.dump([instruments, isPercussion], b)
|
||||||
|
|
||||||
|
# for j, track in enumerate(mid.tracks):
|
||||||
|
# th = NewThread(loadMidi, (track,))
|
||||||
|
# th.start()
|
||||||
|
# Notes.append(th.getResult())
|
||||||
|
|
||||||
|
# print(Notes)
|
||||||
|
print(Notes.__len__())
|
||||||
|
# print(note_list)
|
||||||
|
print(instruments)
|
||||||
|
return Notes
|
||||||
|
# return [Notes, note_list]
|
||||||
|
|
||||||
|
|
||||||
|
def midiClassReader(midfile: str):
|
||||||
|
import mido
|
||||||
|
from bgArrayLib.bpm import get
|
||||||
|
|
||||||
|
def Time(mt, tpb_a, bpm_a):
|
||||||
|
return round(mt / tpb_a / bpm_a * 60 * 20)
|
||||||
|
Notes = []
|
||||||
|
tracks = []
|
||||||
|
try:
|
||||||
|
mid = mido.MidiFile(midfile)
|
||||||
|
except FileNotFoundError:
|
||||||
|
log("找不到文件或无法读取文件" + midfile)
|
||||||
|
return False
|
||||||
|
tpb = mid.ticks_per_beat
|
||||||
|
bpm = get(midfile)
|
||||||
|
for track in mid.tracks:
|
||||||
|
overallTime = 0.0
|
||||||
|
instrument = 0
|
||||||
|
for i in track:
|
||||||
|
overallTime += i.time
|
||||||
|
if 'note_on' in str(i) and i.velocity > 0:
|
||||||
|
print(i)
|
||||||
|
tracks.append(
|
||||||
|
[Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), instrument)])
|
||||||
|
Notes.append(tracks)
|
||||||
|
print(Notes.__len__())
|
||||||
|
return Notes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -51,7 +51,7 @@ READABLETEXT = {
|
|||||||
38: "Generate .RyStruct file",
|
38: "Generate .RyStruct file",
|
||||||
39: "FAILED❌",
|
39: "FAILED❌",
|
||||||
40: "Report message inpution",
|
40: "Report message inpution",
|
||||||
41: "Musicreater - Eilles - {}",
|
41: "Musicreater - {}",
|
||||||
42: "ExecutingEntityName: {}",
|
42: "ExecutingEntityName: {}",
|
||||||
43: "ScoreboardName: {}",
|
43: "ScoreboardName: {}",
|
||||||
44: "Instrument: {}",
|
44: "Instrument: {}",
|
||||||
@ -119,7 +119,7 @@ READABLETEXT = {
|
|||||||
105: "Error with finding or reading file😢:{}",
|
105: "Error with finding or reading file😢:{}",
|
||||||
106: "Project is unsaved, save before close?",
|
106: "Project is unsaved, save before close?",
|
||||||
107: "Saved in: {}",
|
107: "Saved in: {}",
|
||||||
108: "Musicreater Project",
|
108: ("Musicreater 0.0.X Project","Musicreater 0.1+ Project","Musicreater 0.1+ TESTver Project"),
|
||||||
109: "Any Type",
|
109: "Any Type",
|
||||||
110: "NoteFunCreater Project",
|
110: "NoteFunCreater Project",
|
||||||
111: "MMFM (V0.0.6) Project",
|
111: "MMFM (V0.0.6) Project",
|
||||||
@ -140,8 +140,8 @@ READABLETEXT = {
|
|||||||
126: "按下确认后,在游戏中使用connect指令连接localhost:8080,即可播放",
|
126: "按下确认后,在游戏中使用connect指令连接localhost:8080,即可播放",
|
||||||
127: "请输入区域选择的开始坐标:",
|
127: "请输入区域选择的开始坐标:",
|
||||||
128: "请输入区域选择的结束坐标:",
|
128: "请输入区域选择的结束坐标:",
|
||||||
129: "所选区块导出时是否需要保留空气方块?",
|
129: "Whether air block remain when export?",
|
||||||
130: "音·创结构文件",
|
130: "Musicreater Structure",
|
||||||
131: "Done😃\n{}",
|
131: "Done😃\n{}",
|
||||||
132: "Failed❌\n{}\n{}",
|
132: "Failed❌\n{}\n{}",
|
||||||
133: "Have not developed yet...",
|
133: "Have not developed yet...",
|
||||||
@ -168,7 +168,7 @@ READABLETEXT = {
|
|||||||
153: "生成新函数包至...",
|
153: "生成新函数包至...",
|
||||||
154: "生成新函数附加包文件至...",
|
154: "生成新函数附加包文件至...",
|
||||||
155: "生成新函数附加包文件,并将神羽资源包以散包形式放置至...",
|
155: "生成新函数附加包文件,并将神羽资源包以散包形式放置至...",
|
||||||
156: "[神羽资源包位置选择]:选择文件夹...",
|
156: "Select [MiraclePlumeResourcePack]...",
|
||||||
157: "没有路径文件(.rpposi文件),请仔细阅读Readme或先试用:帮助与疑问->[神羽资源包位置选择]:选择文件夹... 方法添加路径文件吧!",
|
157: "没有路径文件(.rpposi文件),请仔细阅读Readme或先试用:帮助与疑问->[神羽资源包位置选择]:选择文件夹... 方法添加路径文件吧!",
|
||||||
158: "有路径文件(.rpposi文件),但路径指示错误,请仔细阅读Readme或先用:帮助与疑问->[神羽资源包位置选择]:选择文件夹... 更改路径!",
|
158: "有路径文件(.rpposi文件),但路径指示错误,请仔细阅读Readme或先用:帮助与疑问->[神羽资源包位置选择]:选择文件夹... 更改路径!",
|
||||||
159: "更改路径文件(.rpposi文件)成功!!",
|
159: "更改路径文件(.rpposi文件)成功!!",
|
||||||
|
@ -52,7 +52,7 @@ READABLETEXT = {
|
|||||||
38: "生成.RyStruct文件",
|
38: "生成.RyStruct文件",
|
||||||
39: "失败❌",
|
39: "失败❌",
|
||||||
40: "邮件反馈信息输入",
|
40: "邮件反馈信息输入",
|
||||||
41: "音·创 - 金羿 - {}",
|
41: "音·创 - {}",
|
||||||
42: "执行实体名:{}",
|
42: "执行实体名:{}",
|
||||||
43: "使用计分板:{}",
|
43: "使用计分板:{}",
|
||||||
44: "所用的乐器:{}",
|
44: "所用的乐器:{}",
|
||||||
@ -119,7 +119,7 @@ READABLETEXT = {
|
|||||||
105: "找不到或无法读取文件😢:{}",
|
105: "找不到或无法读取文件😢:{}",
|
||||||
106: "您当前的项目已修改但未存储,是否先保存当前项目?",
|
106: "您当前的项目已修改但未存储,是否先保存当前项目?",
|
||||||
107: "项目已经存储至:{}",
|
107: "项目已经存储至:{}",
|
||||||
108: "音·创工程文件",
|
108: ("音·创0.0.X工程文件","音·创0.1+工程文件","音·创0.1+TEST工程文件"),
|
||||||
109: "任意类型",
|
109: "任意类型",
|
||||||
110: "函数音创工程文件",
|
110: "函数音创工程文件",
|
||||||
111: "MMFM0.0.6版本工程文件",
|
111: "MMFM0.0.6版本工程文件",
|
||||||
|
9
log/2022-01-30 22_33_28.logger
Normal file
9
log/2022-01-30 22_33_28.logger
Normal file
File diff suppressed because one or more lines are too long
9
log/2022-01-30 22_33_28.msct.log
Normal file
9
log/2022-01-30 22_33_28.msct.log
Normal file
File diff suppressed because one or more lines are too long
8
log/2022-01-30 22_38_53.logger
Normal file
8
log/2022-01-30 22_38_53.logger
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
2022-01-30 22:38:53,532 - nmcsup.log - INFO - 更新执行位置,当前文件位置 F:\W-YI\Programming\音创\#Tkinter\Musicreater.py
|
||||||
|
2022-01-30 22:38:53,637 - nmcsup.log - INFO - 启动root.mainloop(窗口)
|
||||||
|
2022-01-30 22:38:55,753 - nmcsup.log - INFO - 刷新音轨0
|
||||||
|
2022-01-30 22:38:57,953 - nmcsup.log - INFO - 刷新音轨0
|
||||||
|
2022-01-30 22:38:58,097 - nmcsup.log - INFO - 刷新音轨0
|
||||||
|
2022-01-30 22:38:58,233 - nmcsup.log - INFO - 刷新音轨0
|
||||||
|
2022-01-30 22:38:58,353 - nmcsup.log - INFO - 刷新音轨0
|
||||||
|
2022-01-30 22:39:05,257 - nmcsup.log - INFO - 程序正常退出
|
8
log/2022-01-30 22_38_53.msct.log
Normal file
8
log/2022-01-30 22_38_53.msct.log
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
22:38:53 更新执行位置,当前文件位置 F:\W-YI\Programming\音创\#Tkinter\Musicreater.py
|
||||||
|
22:38:53 启动root.mainloop(窗口)
|
||||||
|
22:38:55 刷新音轨0
|
||||||
|
22:38:57 刷新音轨0
|
||||||
|
22:38:58 刷新音轨0
|
||||||
|
22:38:58 刷新音轨0
|
||||||
|
22:38:58 刷新音轨0
|
||||||
|
22:39:05 程序正常退出
|
4
log/2022-01-30 22_41_23.logger
Normal file
4
log/2022-01-30 22_41_23.logger
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
2022-01-30 22:41:23,825 - nmcsup.log - INFO - 更新执行位置,当前文件位置 F:\W-YI\Programming\音创\#Tkinter\Musicreater.py
|
||||||
|
2022-01-30 22:41:23,946 - nmcsup.log - INFO - 启动root.mainloop(窗口)
|
||||||
|
2022-01-30 22:41:37,897 - nmcsup.log - INFO - 退出
|
||||||
|
2022-01-30 22:41:37,898 - nmcsup.log - INFO - 程序正常退出
|
4
log/2022-01-30 22_41_23.msct.log
Normal file
4
log/2022-01-30 22_41_23.msct.log
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
22:41:23 更新执行位置,当前文件位置 F:\W-YI\Programming\音创\#Tkinter\Musicreater.py
|
||||||
|
22:41:23 启动root.mainloop(窗口)
|
||||||
|
22:41:37 退出
|
||||||
|
22:41:37 程序正常退出
|
4
log/2022-01-30 22_53_35.logger
Normal file
4
log/2022-01-30 22_53_35.logger
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
2022-01-30 22:53:35,014 - nmcsup.log - INFO - 更新执行位置,当前文件位置 F:\W-YI\Programming\音创\#Tkinter\Musicreater.py
|
||||||
|
2022-01-30 22:53:35,124 - nmcsup.log - INFO - 启动root.mainloop(窗口)
|
||||||
|
2022-01-30 22:53:56,662 - nmcsup.log - INFO - 刷新音轨0
|
||||||
|
2022-01-30 22:54:59,637 - nmcsup.log - INFO - 程序正常退出
|
4
log/2022-01-30 22_53_35.msct.log
Normal file
4
log/2022-01-30 22_53_35.msct.log
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
22:53:35 更新执行位置,当前文件位置 F:\W-YI\Programming\音创\#Tkinter\Musicreater.py
|
||||||
|
22:53:35 启动root.mainloop(窗口)
|
||||||
|
22:53:56 刷新音轨0
|
||||||
|
22:54:59 程序正常退出
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -92,6 +92,16 @@ def funSplit(bigFile, maxCmdLen: int = 10000):
|
|||||||
return parts
|
return parts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 注意!播放器应该为个人独立播放器,此处bug需要修改
|
||||||
def makeFuncFiles(musicset, path='./'):
|
def makeFuncFiles(musicset, path='./'):
|
||||||
"""在指定目录下生成函数文件"""
|
"""在指定目录下生成函数文件"""
|
||||||
from nmcsup.trans import Note2Cmd
|
from nmcsup.trans import Note2Cmd
|
||||||
@ -138,6 +148,15 @@ def makeFuncFiles(musicset, path='./'):
|
|||||||
log("完成============================")
|
log("完成============================")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def makeNewFuncFiles(musicset, path='./'):
|
def makeNewFuncFiles(musicset, path='./'):
|
||||||
"""在指定目录下生成函数文件"""
|
"""在指定目录下生成函数文件"""
|
||||||
from nmcsup.trans import classList_conversion
|
from nmcsup.trans import classList_conversion
|
||||||
|
18
msctspt/settings.py
Normal file
18
msctspt/settings.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
'language' : 'zh-CN',
|
||||||
|
'theme' : {
|
||||||
|
'' : '',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
class msctSetting:
|
||||||
|
def __init__(self,**settings) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __call__(self, **kwds):
|
||||||
|
pass
|
@ -5,7 +5,11 @@
|
|||||||
# 统计:致命(三级)错误:0个;警告(二级)错误:4个--未解决1个;语法(一级)错误:302个
|
# 统计:致命(三级)错误:0个;警告(二级)错误:4个--未解决1个;语法(一级)错误:302个
|
||||||
|
|
||||||
|
|
||||||
|
# 可序列化对象,即可迭代对象
|
||||||
|
from typing import Iterable
|
||||||
|
|
||||||
import amulet
|
import amulet
|
||||||
|
|
||||||
from amulet.api.block import Block
|
from amulet.api.block import Block
|
||||||
from amulet.utils.world_utils import block_coords_to_chunk_coords as bc2cc
|
from amulet.utils.world_utils import block_coords_to_chunk_coords as bc2cc
|
||||||
from amulet_nbt import TAG_String as ts
|
from amulet_nbt import TAG_String as ts
|
||||||
@ -21,6 +25,104 @@ def hans2pinyin(hans, style=3):
|
|||||||
final += i
|
final += i
|
||||||
return final
|
return final
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def classList_conversion_SinglePlayer(List: list, ScoreboardName: str, playerSelection: str = '',
|
||||||
|
isProsess: bool = False) -> list:
|
||||||
|
from bgArrayLib.compute import round_up
|
||||||
|
commands = []
|
||||||
|
length = len(List)
|
||||||
|
j = 1
|
||||||
|
print(List)
|
||||||
|
for k in range(len(List)):
|
||||||
|
i = List[k][0]
|
||||||
|
print(i)
|
||||||
|
print(type(i))
|
||||||
|
try:
|
||||||
|
if i.instrument > 119:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
commands.append(f"execute @a{playerSelection} ~ ~ ~ execute @s[scores={{{ScoreboardName}={str(round_up(i.time_position)).replace('.0', '')}}}] ~ ~{127 - i.velocity} ~ playsound {i.instrument}{i.CD}.{i.pitch} @a ~ ~ ~ 1000 1.0 1000\n")
|
||||||
|
if isProsess:
|
||||||
|
commands.append(f"execute @a{playerSelection} ~ ~ ~ execute @s[scores={{{ScoreboardName}={str(round_up(i.time_position)).replace('.0', '')}}}] ~ ~ ~ title @s actionbar §e▶ 播放中: §a{j}/{length} || {int(j / length * 1000) / 10}\n")
|
||||||
|
j += 1
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
# a += List[i][1]
|
||||||
|
commands.append("\n\n# 凌云我的世界开发团队 x 凌云软件开发团队 : W-YI(金羿)\n")
|
||||||
|
print(commands)
|
||||||
|
return commands
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def classList_conversion(List: list, ScoreboardName: str, isProsess: bool = False) -> list:
|
||||||
|
from bgArrayLib.compute import round_up
|
||||||
|
commands = []
|
||||||
|
length = len(List)
|
||||||
|
j = 1
|
||||||
|
print(List)
|
||||||
|
for k in range(len(List)):
|
||||||
|
i = List[k][0]
|
||||||
|
print(i)
|
||||||
|
print(type(i))
|
||||||
|
try:
|
||||||
|
if i.instrument > 119:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
commands.append("execute @e[scores={" +
|
||||||
|
ScoreboardName + "=" + str(round_up(i.time_position)).replace(".0", "") + "}] ~ ~" +
|
||||||
|
str(127 - i.velocity) +
|
||||||
|
" ~ playsound " +
|
||||||
|
str(i.instrument) +
|
||||||
|
str(i.CD) + "." +
|
||||||
|
str(i.pitch)
|
||||||
|
+ " @a ~ ~ ~ 1000 1.0 1000\n")
|
||||||
|
if isProsess:
|
||||||
|
commands.append("execute @a"" ~ ~ ~ execute @s[scores={" + ScoreboardName + "=" +
|
||||||
|
str(round_up(i.time_position)).replace(".0", "") +
|
||||||
|
"}] ~ ~ ~ title @s actionbar §e▶ 播放中: §a" +
|
||||||
|
str(j) + "/" + str(length) + " || " + str(int(j / length * 1000) / 10) + "\n")
|
||||||
|
j += 1
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
# a += List[i][1]
|
||||||
|
commands.append("\n\n# 凌云我的世界开发团队 x 凌云软件开发团队 : W-YI(金羿)\n")
|
||||||
|
print(commands)
|
||||||
|
return commands
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def formCmdBlock(direction: list, command: str, particularValue: int, impluse: int, condition: bool = False,
|
def formCmdBlock(direction: list, command: str, particularValue: int, impluse: int, condition: bool = False,
|
||||||
needRedstone: bool = True, tickDelay: int = 0, customName: str = '', lastOutput: str = '',
|
needRedstone: bool = True, tickDelay: int = 0, customName: str = '', lastOutput: str = '',
|
||||||
@ -124,21 +226,46 @@ def note2bdx(filePath: str, dire: list, Notes: list, ScoreboardName: str, Instru
|
|||||||
return BdxConverter(filePath, 'Build by RyounMusicreater', blocks)
|
return BdxConverter(filePath, 'Build by RyounMusicreater', blocks)
|
||||||
|
|
||||||
|
|
||||||
def music2BDX(filePath: str, dire: list, Notes: list, ScoreboardName: str, Instrument: str,
|
|
||||||
PlayerSelect: str = '', isProsess: bool = False, height: int = 200):
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def music2BDX(filePath: str, dire: list, music: dict, isProsess: bool = False, height: int = 200):
|
||||||
"""使用方法同Note2Cmd
|
"""使用方法同Note2Cmd
|
||||||
:param 参数说明:
|
:param 参数说明:
|
||||||
filePath: 生成.bdx文件的位置
|
filePath: 生成.bdx文件的位置
|
||||||
dire: 指令方块在地图中生成的起始位置(相对位置)
|
dire: 指令方块在地图中生成的起始位置(相对位置)
|
||||||
Notes: 以 list[ list[ float我的世界playsound指令音调 , float延续时常(单位s) ] ] 格式存储的音符列表
|
music: 详见 Musicreater.py - dataset[0]
|
||||||
例如Musicreater.py的(dataset[0]['musics'][NowMusic]['notes'])
|
|
||||||
ScoreboardName: 用于执行的计分板名称
|
|
||||||
Instrument: 播放的乐器
|
|
||||||
PlayerSelect: 执行的玩家选择器
|
|
||||||
isProsess: 是否显示进度条(会很卡)
|
isProsess: 是否显示进度条(会很卡)
|
||||||
height: 生成结构的最高高度
|
height: 生成结构的最高高度
|
||||||
:return 返回一个BdxConverter类(实际上没研究过),同时在指定位置生成.bdx文件"""
|
:return 返回一个BdxConverter类(实际上没研究过),同时在指定位置生成.bdx文件"""
|
||||||
pass
|
from msctspt.bdxOpera_CP import BdxConverter
|
||||||
|
cmdLists = []
|
||||||
|
for track in music['musics']:
|
||||||
|
classList_conversion_SinglePlayer(track['notes'],track['set']['ScoreboardName'],music['mainset']['PlayerSelect'],isProsess)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def note2webs(Notes: list, Instrument: str, speed: float = 5.0, PlayerSelect: str = '', isProsess: bool = False):
|
def note2webs(Notes: list, Instrument: str, speed: float = 5.0, PlayerSelect: str = '', isProsess: bool = False):
|
||||||
@ -178,8 +305,12 @@ def note2webs(Notes: list, Instrument: str, speed: float = 5.0, PlayerSelect: st
|
|||||||
fcwslib.run_server(run_server)
|
fcwslib.run_server(run_server)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def note2RSworld(world: str, startpos: list, notes: list, instrument: str, speed: float = 2.5,
|
def note2RSworld(world: str, startpos: list, notes: list, instrument: str, speed: float = 2.5,
|
||||||
posadder: iterable = (1, 0, 0), baseblock: str = 'stone'): # -> bool
|
posadder: Iterable = (1, 0, 0), baseblock: str = 'stone'): # -> bool
|
||||||
"""传入音符,生成以音符盒存储的红石音乐
|
"""传入音符,生成以音符盒存储的红石音乐
|
||||||
:param 参数说明:
|
:param 参数说明:
|
||||||
world: 地图文件的路径
|
world: 地图文件的路径
|
||||||
@ -285,6 +416,11 @@ def note2RSworld(world: str, startpos: list, notes: list, instrument: str, speed
|
|||||||
level.close()
|
level.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ryStruct:
|
class ryStruct:
|
||||||
|
|
||||||
def __init__(self, world: str) -> None:
|
def __init__(self, world: str) -> None:
|
||||||
@ -349,6 +485,9 @@ class ryStruct:
|
|||||||
return self.RyStruct
|
return self.RyStruct
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
RyStruct = {
|
RyStruct = {
|
||||||
(0,0,0) = {
|
(0,0,0) = {
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -44,7 +44,7 @@ StrStartTime = str(datetime.datetime.now()).replace(':', '_')[:-7]
|
|||||||
"""字符串型的程序开始时间"""
|
"""字符串型的程序开始时间"""
|
||||||
|
|
||||||
|
|
||||||
def log(info: str = '', isPrinted: bool = False, isLoggerLibRecord: bool = True, isWrite: bool = False):
|
def log(info: str = '', isWrite: bool = True, isPrinted: bool = False, isLoggerLibRecord: bool = True):
|
||||||
"""
|
"""
|
||||||
info: 信息
|
info: 信息
|
||||||
isPrinted: 是否print(仅限金羿log,python官方的logging照常输出)
|
isPrinted: 是否print(仅限金羿log,python官方的logging照常输出)
|
||||||
@ -52,6 +52,9 @@ def log(info: str = '', isPrinted: bool = False, isLoggerLibRecord: bool = True,
|
|||||||
isWrite: 是否write(仅限金羿log,python官方的logging照常输出)
|
isWrite: 是否write(仅限金羿log,python官方的logging照常输出)
|
||||||
"""
|
"""
|
||||||
"""将信息连同当前时间载入日志"""
|
"""将信息连同当前时间载入日志"""
|
||||||
|
# 致后来的开发者:请让金羿的log存在吧,不然他自己都看不懂你们写了什么了
|
||||||
|
# 我指的是程序内部
|
||||||
|
# ——金羿
|
||||||
if not os.path.exists('./log/'):
|
if not os.path.exists('./log/'):
|
||||||
os.makedirs('./log/')
|
os.makedirs('./log/')
|
||||||
if isWrite:
|
if isWrite:
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
from nmcsup.log import log
|
from nmcsup.log import log
|
||||||
from nmcsup.const import notes
|
from nmcsup.const import notes
|
||||||
import pickle
|
|
||||||
|
|
||||||
|
|
||||||
# 从格式文本文件读入一个音轨并存入一个列表
|
# 从格式文本文件读入一个音轨并存入一个列表
|
||||||
@ -68,145 +68,7 @@ def ReadMidi(midfile: str): # -> list
|
|||||||
return Notes
|
return Notes
|
||||||
|
|
||||||
|
|
||||||
class Note:
|
|
||||||
def __init__(self, channel, pitch, velocity, time, time_position, instrument):
|
|
||||||
self.channel = channel
|
|
||||||
self.pitch = pitch
|
|
||||||
self.velocity = velocity
|
|
||||||
self.delay = time
|
|
||||||
self.time_position = time_position
|
|
||||||
self.instrument = instrument
|
|
||||||
self.CD = "d"
|
|
||||||
|
|
||||||
def get_CD(self, start, end):
|
|
||||||
if end - start > 1.00:
|
|
||||||
self.CD = "c"
|
|
||||||
else:
|
|
||||||
self.CD = "d"
|
|
||||||
|
|
||||||
|
|
||||||
def midi_conversion(midfile: str):
|
|
||||||
import mido
|
|
||||||
# from msctspt.threadOpera import NewThread
|
|
||||||
from bgArrayLib.bpm import get
|
|
||||||
|
|
||||||
def Time(mt, tpb_a, bpm_a):
|
|
||||||
return round(mt / tpb_a / bpm_a * 60 * 20)
|
|
||||||
|
|
||||||
Notes = []
|
|
||||||
tracks = []
|
|
||||||
note_list = []
|
|
||||||
close = []
|
|
||||||
on = []
|
|
||||||
off = []
|
|
||||||
instruments = []
|
|
||||||
isPercussion = False
|
|
||||||
try:
|
|
||||||
mid = mido.MidiFile(midfile)
|
|
||||||
except FileNotFoundError:
|
|
||||||
log("找不到文件或无法读取文件" + midfile)
|
|
||||||
return False
|
|
||||||
tpb = mid.ticks_per_beat
|
|
||||||
bpm = get(midfile)
|
|
||||||
# 解析
|
|
||||||
# def loadMidi(track1):
|
|
||||||
for track in mid.tracks:
|
|
||||||
overallTime = 0.0
|
|
||||||
instrument = 0
|
|
||||||
for i in track:
|
|
||||||
overallTime += i.time
|
|
||||||
try:
|
|
||||||
if i.channel != 9:
|
|
||||||
# try:
|
|
||||||
# log("event_type(事件): " + str(i.type) + " channel(音轨): " + str(i.channel) +
|
|
||||||
# " note/pitch(音高): " +
|
|
||||||
# str(i[2]) +
|
|
||||||
# " velocity(力度): " + str(i.velocity) + " time(间隔时间): " + str(i.time) +
|
|
||||||
# " overallTime/globalTime/timePosition: " + str(overallTime) + " \n")
|
|
||||||
# except AttributeError:
|
|
||||||
# log("event_type(事件): " + str(i.type) + " thing(内容):" + str(i) + " \n")
|
|
||||||
if 'program_change' in str(i):
|
|
||||||
instrument = i.program
|
|
||||||
if instrument > 119: # 音色不够
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
instruments.append(i.program)
|
|
||||||
if 'note_on' in str(i) and i.velocity > 0:
|
|
||||||
print(i)
|
|
||||||
# print(i.note)
|
|
||||||
# print([Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), instrument)])
|
|
||||||
tracks.append(
|
|
||||||
[Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), instrument)])
|
|
||||||
note_list.append(
|
|
||||||
[i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), instrument])
|
|
||||||
on.append([i.note, Time(overallTime, tpb, bpm)])
|
|
||||||
# return [Note(i.channel, i, i.velocity, i.time, Time(overallTime, tpb, bpm))]
|
|
||||||
if 'note_off' in str(i) or 'note_on' in str(i) and i.velocity == 0:
|
|
||||||
# print(i)
|
|
||||||
# print([Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm))])
|
|
||||||
close.append(
|
|
||||||
[Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), instrument)])
|
|
||||||
off.append([i.note, Time(overallTime, tpb, bpm)])
|
|
||||||
# return [Note(i.channel, i, i.velocity, i.time, Time(overallTime, tpb, bpm))]
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
if 'note_on' in str(i) and i.channel == 9:
|
|
||||||
if 'note_on' in str(i) and i.velocity > 0:
|
|
||||||
print(i)
|
|
||||||
# print(i.note)
|
|
||||||
# print([Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), -1)])
|
|
||||||
tracks.append([Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), -1)])
|
|
||||||
note_list.append([i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), -1])
|
|
||||||
on.append([i.note, Time(overallTime, tpb, bpm)])
|
|
||||||
isPercussion = True
|
|
||||||
# return [Note(i.channel, i, i.velocity, i.time, Time(overallTime, tpb, bpm))]
|
|
||||||
Notes.append(tracks)
|
|
||||||
if instruments is []:
|
|
||||||
instruments.append(0)
|
|
||||||
instruments = list(set(instruments))
|
|
||||||
with open("1.pkl", 'wb') as b:
|
|
||||||
pickle.dump([instruments, isPercussion], b)
|
|
||||||
|
|
||||||
# for j, track in enumerate(mid.tracks):
|
|
||||||
# th = NewThread(loadMidi, (track,))
|
|
||||||
# th.start()
|
|
||||||
# Notes.append(th.getResult())
|
|
||||||
|
|
||||||
# print(Notes)
|
|
||||||
print(Notes.__len__())
|
|
||||||
# print(note_list)
|
|
||||||
print(instruments)
|
|
||||||
return Notes
|
|
||||||
# return [Notes, note_list]
|
|
||||||
|
|
||||||
|
|
||||||
def midiClassReader(midfile: str):
|
|
||||||
import mido
|
|
||||||
from bgArrayLib.bpm import get
|
|
||||||
|
|
||||||
def Time(mt, tpb_a, bpm_a):
|
|
||||||
return round(mt / tpb_a / bpm_a * 60 * 20)
|
|
||||||
Notes = []
|
|
||||||
tracks = []
|
|
||||||
try:
|
|
||||||
mid = mido.MidiFile(midfile)
|
|
||||||
except FileNotFoundError:
|
|
||||||
log("找不到文件或无法读取文件" + midfile)
|
|
||||||
return False
|
|
||||||
tpb = mid.ticks_per_beat
|
|
||||||
bpm = get(midfile)
|
|
||||||
for track in mid.tracks:
|
|
||||||
overallTime = 0.0
|
|
||||||
instrument = 0
|
|
||||||
for i in track:
|
|
||||||
overallTime += i.time
|
|
||||||
if 'note_on' in str(i) and i.velocity > 0:
|
|
||||||
print(i)
|
|
||||||
tracks.append(
|
|
||||||
[Note(i.channel, i.note, i.velocity, i.time, Time(overallTime, tpb, bpm), instrument)])
|
|
||||||
Notes.append(tracks)
|
|
||||||
print(Notes.__len__())
|
|
||||||
return Notes
|
|
||||||
|
|
||||||
|
|
||||||
def ReadOldProject(fn: str): # -> list
|
def ReadOldProject(fn: str): # -> list
|
||||||
@ -226,10 +88,41 @@ def ReadOldProject(fn: str): # -> list
|
|||||||
return dataset
|
return dataset
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# a = midi_conversion("L:\\0WorldMusicCreater-MFMS new edition\\框架\\v0.3.2\\Musicreater\\测试用\\同道殊途标准.mid")
|
# a = midi_conversion("L:\\0WorldMusicCreater-MFMS new edition\\框架\\v0.3.2\\Musicreater\\测试用\\同道殊途标准.mid")
|
||||||
# midi_conversion("L:\\0WorldMusicCreater-MFMS new edition\\框架\\v0.3.2\\Musicreater\\测试用\\"
|
# midi_conversion("L:\\0WorldMusicCreater-MFMS new edition\\框架\\v0.3.2\\Musicreater\\测试用\\"
|
||||||
# "Illusionary_Daytime_--------幻昼.mid")
|
# "Illusionary_Daytime_--------幻昼.mid")
|
||||||
# a = midi_conversion(r"C:\Users\lc\Documents\MuseScore3\乐谱\架子鼓.mid")
|
# a = midi_conversion(r"C:\Users\lc\Documents\MuseScore3\乐谱\架子鼓.mid")
|
||||||
|
from bgArrayLib.reader import midi_conversion
|
||||||
a = midi_conversion(r"C:\Users\lc\Documents\MuseScore3\乐谱\stay2.mid")
|
a = midi_conversion(r"C:\Users\lc\Documents\MuseScore3\乐谱\stay2.mid")
|
||||||
# print(a)
|
# print(a)
|
||||||
|
@ -83,6 +83,9 @@ def Mp32Mid(mp3File, midFile):
|
|||||||
PianoTranscription(device="cpu").transcribe(audio, midFile)
|
PianoTranscription(device="cpu").transcribe(audio, midFile)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 传入一个音符列表转为指令列表
|
# 传入一个音符列表转为指令列表
|
||||||
def Note2Cmd(Notes: list, ScoreboardName: str, Instrument: str, PlayerSelect: str = '',
|
def Note2Cmd(Notes: list, ScoreboardName: str, Instrument: str, PlayerSelect: str = '',
|
||||||
isProsess: bool = False) -> list:
|
isProsess: bool = False) -> list:
|
||||||
@ -105,41 +108,22 @@ def Note2Cmd(Notes: list, ScoreboardName: str, Instrument: str, PlayerSelect: st
|
|||||||
# def newDataStructureCounterChange():
|
# def newDataStructureCounterChange():
|
||||||
|
|
||||||
|
|
||||||
def classList_conversion(List: list, ScoreboardName: str,
|
|
||||||
isProsess: bool = False) -> list:
|
|
||||||
from bgArrayLib.compute import round_up
|
|
||||||
commands = []
|
|
||||||
length = len(List)
|
|
||||||
j = 1
|
|
||||||
print(List)
|
|
||||||
for k in range(len(List)):
|
|
||||||
i = List[k][0]
|
|
||||||
print(i)
|
|
||||||
print(type(i))
|
|
||||||
try:
|
|
||||||
if i.instrument > 119:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
commands.append("execute @e[scores={" +
|
|
||||||
ScoreboardName + "=" + str(round_up(i.time_position)).replace(".0", "") + "}] ~ ~" +
|
|
||||||
str(127 - i.velocity) +
|
|
||||||
" ~ playsound " +
|
|
||||||
str(i.instrument) +
|
|
||||||
str(i.CD) + "." +
|
|
||||||
str(i.pitch)
|
|
||||||
+ " @a ~ ~ ~ 1000 1.0 1000\n")
|
|
||||||
if isProsess:
|
|
||||||
commands.append("execute @a"" ~ ~ ~ execute @s[scores={" + ScoreboardName + "=" +
|
|
||||||
str(round_up(i.time_position)).replace(".0", "") +
|
|
||||||
"}] ~ ~ ~ title @s actionbar §e▶ 播放中: §a" +
|
|
||||||
str(j) + "/" + str(length) + " || " + str(int(j / length * 1000) / 10) + "\n")
|
|
||||||
j += 1
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
# a += List[i][1]
|
|
||||||
commands.append("\n\n# 凌云我的世界开发团队 x 凌云软件开发团队 : W-YI(金羿)\n")
|
|
||||||
print(commands)
|
|
||||||
return commands
|
|
||||||
|
|
||||||
|
|
||||||
# 简单载入方块
|
# 简单载入方块
|
||||||
|
@ -30,6 +30,14 @@ Copyright © W-YI 2022
|
|||||||
|
|
||||||
|
|
||||||
新更新日志
|
新更新日志
|
||||||
|
|
||||||
|
Delta 0.1.1
|
||||||
|
2022 1 30
|
||||||
|
1.新增设置调用方案,但未使用
|
||||||
|
2.新增多音轨生成单个BDX的功能,但必须用新方法解析
|
||||||
|
3.发现陈年旧bug:在msctspt.funcOpera中makeFuncFiles生成的指令格式不对
|
||||||
|
4.在nmcsup.trans中新增classList_conversion_SinglePlayer使用对于每个玩家的独立播放器
|
||||||
|
|
||||||
Delta 0.1.0
|
Delta 0.1.0
|
||||||
2022 1 27
|
2022 1 27
|
||||||
1.完成了多音色的支持,但仍需修改
|
1.完成了多音色的支持,但仍需修改
|
||||||
|
@ -39,4 +39,5 @@
|
|||||||
心愿之结晶,而何能之宝贵
|
心愿之结晶,而何能之宝贵
|
||||||
神明,正倾诉着他辉煌的过去……
|
神明,正倾诉着他辉煌的过去……
|
||||||
一切过程与结果都不重要,重要的是热爱与真情
|
一切过程与结果都不重要,重要的是热爱与真情
|
||||||
给大家带来笑容,这就是存在的使命
|
给大家带来笑容 这就是我存在的使命
|
||||||
|
不忘本源 牢记故地
|
||||||
|
Loading…
x
Reference in New Issue
Block a user