mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2025-02-07 19:36:46 +08:00
commit
1103a06897
12
.gitignore
vendored
12
.gitignore
vendored
@ -1,16 +1,18 @@
|
|||||||
|
# sth. can't open
|
||||||
|
/msctPkgver/secrets/*.py
|
||||||
|
/msctPkgver/secrets/*.c
|
||||||
|
|
||||||
|
|
||||||
# mystuff
|
# mystuff
|
||||||
/.vscode
|
/.vscode
|
||||||
*.mid
|
*.mid
|
||||||
*.midi
|
*.midi
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.pyc
|
||||||
*$py.class
|
*$py.class
|
||||||
|
|
||||||
# C extensions
|
|
||||||
*.so
|
|
||||||
|
|
||||||
# Distribution / packaging
|
# Distribution / packaging
|
||||||
.Python
|
.Python
|
||||||
build/
|
build/
|
||||||
|
@ -1,3 +1,30 @@
|
|||||||
|
**注意,以下条款或版权声明应当且必须是高于此项目中任何其他声明的**
|
||||||
|
|
||||||
|
1. 音·创的全部开发者享有其完整版权,其开发者可以在任一时刻终止以后音·创源代码开放,若经由其开发者授予特殊权利,则授权对象可以将源代码进行特定的被特殊授权的操作
|
||||||
|
2. 音·创或(及)其代码允许在 Apache2.0 协议的条款与说明下进行非商业使用
|
||||||
|
3. 除部分代码特殊声明外,音·创允许对其或(及)其代码进行商业化使用,但是需要经过音·创主要开发者(诸葛亮与八卦阵、金羿)的一致授权,同时,授权对象在商业化授权的使用过程中必须依照 Apache2.0 协议的条款与说明
|
||||||
|
4. 若存在对于音·创包含的部分代码的特殊开源声明,则此部分代码依照其特定的开源方式授权,但若此部分代码经由此部分代码的主要开发者一致特殊授权后商用,则授权对象在商用时依照此部分的开发者所准许的方式(或条款)进行商用,或默认依照 Apache2.0 协议进行商业化使用
|
||||||
|
5. Apache2.0 协议的英文原文副本可见下文
|
||||||
|
|
||||||
|
> The English Translation of the TERMS AND CONDITIONS above is listed below
|
||||||
|
>
|
||||||
|
> This translated version is for reference only and has no legal effect.
|
||||||
|
>
|
||||||
|
> The version with legal effect is the Chinese version above.
|
||||||
|
|
||||||
|
**Note, The TERMS AND CONDITIONS below should and must be above all others in this project**
|
||||||
|
|
||||||
|
1. *Musicreater* is fully copyrighted by all its developers, the developers have the right to make *Musicreater* close sourced at any time. Operations are permitted under specific terms instructed by its developer(s).
|
||||||
|
2. Non-commercial use of *Musicreater* and(or) its source code is permitted under Apache License 2.0.
|
||||||
|
3. Commercial use of *Musicreater* is permitted under Apache License 2.0 with the unanimous permission of the steering developers of *Musicreater* (*bgArray*诸葛亮与八卦阵 and *Eilles*金羿).
|
||||||
|
4. *Musicreater* is open sourced under priority given:
|
||||||
|
1. License granted by the core developer(s) of a section after negotiation.
|
||||||
|
2. Explicitly stated license.
|
||||||
|
3. Apache 2.0 License.
|
||||||
|
5. A copy of the original Apache Lisence 2.0 can be found below.
|
||||||
|
|
||||||
|
|
||||||
|
```text
|
||||||
Apache License
|
Apache License
|
||||||
Version 2.0, January 2004
|
Version 2.0, January 2004
|
||||||
http://www.apache.org/licenses/
|
http://www.apache.org/licenses/
|
||||||
@ -189,4 +216,4 @@
|
|||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
```
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
**此分支为音·创的包版本,即便于其他软件使用的可被import版本**
|
**此分支为音·创的包版本,即便于其他软件使用的可被import版本**
|
||||||
|
|
||||||
### **看这看这!看这看这!看这看这!教程:[教程链接](https://gitee.com/EillesWan/Musicreater/blob/pkgver/docs/%E5%8A%9F%E8%83%BD%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.md)**
|
### **看这看这!看这看这!看这看这!教程:[教程链接](./docs/%E5%8A%9F%E8%83%BD%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.md)**
|
||||||
|
|
||||||
## 软件作者✒
|
## 软件作者✒
|
||||||
|
|
||||||
@ -45,9 +45,10 @@
|
|||||||
- 感谢由 **Charlie_Ping “查理平”** 带来的bdx文件转换参考,
|
- 感谢由 **Charlie_Ping “查理平”** 带来的bdx文件转换参考,
|
||||||
以及mid转我的世界乐器参考表格
|
以及mid转我的世界乐器参考表格
|
||||||
- 感谢由 **CMA_2401PT** 为我们的软件开发进行指导
|
- 感谢由 **CMA_2401PT** 为我们的软件开发进行指导
|
||||||
- 感谢由 **Dislink Sforza**\<QQ1600515314\>带来的midi音色解析以及转换指令的算法,我们将其改编并应用
|
- 感谢由 **Dislink Sforza “断联·斯福尔扎”**\<QQ1600515314\>带来的midi音色解析以及转换指令的算法,我们将其改编并应用;同时,感谢他的[网页版转换器](https://dislink.github.io/midi2bdx/)给我们的开发与更新带来巨大的压力和动力,让我们在原本一骑绝尘的摸鱼道路上转向开发
|
||||||
- 感谢 **Touch “偷吃”**\<QQ1793537164\>提供的测试支持,并对程序的改进提供了丰富的意见
|
- 感谢 **Touch “偷吃”**\<QQ1793537164\>提供的测试支持,并对程序的改进提供了丰富的意见;同时也感谢他的不断尝试新的内容,使我们的排错更进一步
|
||||||
- 感谢 **Mono**\<QQ738893087\>反馈安装时的问题
|
- 感谢 **Mono**\<QQ738893087\>反馈安装时的问题
|
||||||
|
- 感谢 **Ammelia** 敦促我们进行新的功能开发,并为新功能提出了非常优秀的大量建议
|
||||||
|
|
||||||
> 感谢广大群友为此程序提供的测试等支持
|
> 感谢广大群友为此程序提供的测试等支持
|
||||||
>
|
>
|
||||||
|
@ -28,7 +28,7 @@ Musicreater pkgver(Package Version 音·创 库版) is a free open source librar
|
|||||||
|
|
||||||
Welcome to join our QQ group: [861684859](https://jq.qq.com/?_wv=1027&k=hpeRxrYr)
|
Welcome to join our QQ group: [861684859](https://jq.qq.com/?_wv=1027&k=hpeRxrYr)
|
||||||
|
|
||||||
### **SEEEEEEEEE Tutorials [HERE](https://gitee.com/EillesWan/Musicreater/blob/pkgver/docs/Use%20of%20Funtions.md)**
|
### **SEEEEEEEEE Tutorials [HERE](./docs/Use%20of%20Funtions.md)**
|
||||||
|
|
||||||
### Authors✒
|
### Authors✒
|
||||||
|
|
||||||
|
@ -4,26 +4,17 @@
|
|||||||
# 音·创 开发交流群 861684859
|
# 音·创 开发交流群 861684859
|
||||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||||
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
||||||
# 若需转载或借鉴 请依照 Apache 2.0 许可证进行许可
|
# 若需转载或借鉴 许可声明请查看仓库目录下的 Lisence.md
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
音·创 库版 MIDI转换展示程序
|
音·创 库版 MIDI转换展示程序
|
||||||
Musicreater Package Version : Demo for Midi Conversion
|
Musicreater Package Version : Demo for Midi Conversion
|
||||||
|
|
||||||
Copyright 2022 all the developers of Musicreater
|
Copyright 2023 all the developers of Musicreater
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the 'License');
|
开源相关声明请见 ./Lisence.md
|
||||||
you may not use this file except in compliance with the License.
|
Terms & Conditions: ./Lisence.md
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an 'AS IS' BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from msctPkgver.main import *
|
from msctPkgver.main import *
|
||||||
@ -103,7 +94,8 @@ while True:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
m = 1
|
||||||
|
'''采用的算法编号'''
|
||||||
|
|
||||||
|
|
||||||
if os.path.isdir(midipath):
|
if os.path.isdir(midipath):
|
||||||
@ -112,8 +104,8 @@ if os.path.isdir(midipath):
|
|||||||
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(
|
print(convertion.tomcpack(
|
||||||
1,
|
m,
|
||||||
isAutoReset
|
isAutoReset
|
||||||
if isAutoReset != ''
|
if isAutoReset != ''
|
||||||
else bool(int(input('是否自动重置计分板(1|0):'))),
|
else bool(int(input('是否自动重置计分板(1|0):'))),
|
||||||
@ -121,10 +113,10 @@ if os.path.isdir(midipath):
|
|||||||
sbname if sbname != '' else input('请输入计分板名称:'),
|
sbname if sbname != '' else input('请输入计分板名称:'),
|
||||||
volume if volume != '' else float(input('请输入音量(0-1):')),
|
volume if volume != '' else float(input('请输入音量(0-1):')),
|
||||||
speed if speed != '' else float(input('请输入速度倍率:')),
|
speed if speed != '' else float(input('请输入速度倍率:')),
|
||||||
)
|
))
|
||||||
elif outFormat == 1:
|
elif outFormat == 1:
|
||||||
convertion.toBDXfile(
|
print(convertion.toBDXfile(
|
||||||
1,
|
m,
|
||||||
author if author != '' else input('请输入作者:'),
|
author if author != '' else input('请输入作者:'),
|
||||||
isProgress,
|
isProgress,
|
||||||
maxHeight if maxHeight != '' else int(input('请输入指令结构最大生成高度:')),
|
maxHeight if maxHeight != '' else int(input('请输入指令结构最大生成高度:')),
|
||||||
@ -134,21 +126,21 @@ if os.path.isdir(midipath):
|
|||||||
isAutoReset
|
isAutoReset
|
||||||
if isAutoReset != ''
|
if isAutoReset != ''
|
||||||
else bool(int(input('是否自动重置计分板(1|0):'))),
|
else bool(int(input('是否自动重置计分板(1|0):'))),
|
||||||
)
|
))
|
||||||
else:
|
else:
|
||||||
convertion.convert(midipath, outpath)
|
convertion.convert(midipath, outpath)
|
||||||
if outFormat == 0:
|
if outFormat == 0:
|
||||||
convertion.tomcpack(
|
print(convertion.tomcpack(
|
||||||
1,
|
m,
|
||||||
isAutoReset if isAutoReset != '' else bool(int(input('是否自动重置计分板(1|0):'))),
|
isAutoReset if isAutoReset != '' else bool(int(input('是否自动重置计分板(1|0):'))),
|
||||||
isProgress,
|
isProgress,
|
||||||
sbname if sbname != '' else input('请输入计分板名称:'),
|
sbname if sbname != '' else input('请输入计分板名称:'),
|
||||||
volume if volume != '' else float(input('请输入音量(0-1):')),
|
volume if volume != '' else float(input('请输入音量(0-1):')),
|
||||||
speed if speed != '' else float(input('请输入速度倍率:')),
|
speed if speed != '' else float(input('请输入速度倍率:')),
|
||||||
)
|
))
|
||||||
elif outFormat == 1:
|
elif outFormat == 1:
|
||||||
convertion.toBDXfile(
|
print(convertion.toBDXfile(
|
||||||
1,
|
m,
|
||||||
author if author != '' else input('请输入作者:'),
|
author if author != '' else input('请输入作者:'),
|
||||||
isProgress,
|
isProgress,
|
||||||
maxHeight if maxHeight != '' else int(input('请输入指令结构最大生成高度:')),
|
maxHeight if maxHeight != '' else int(input('请输入指令结构最大生成高度:')),
|
||||||
@ -156,4 +148,4 @@ else:
|
|||||||
volume if volume != '' else float(input('请输入音量(0-1):')),
|
volume if volume != '' else float(input('请输入音量(0-1):')),
|
||||||
speed if speed != '' else float(input('请输入速度倍率:')),
|
speed if speed != '' else float(input('请输入速度倍率:')),
|
||||||
isAutoReset if isAutoReset != '' else bool(int(input('是否自动重置计分板(1|0):'))),
|
isAutoReset if isAutoReset != '' else bool(int(input('是否自动重置计分板(1|0):'))),
|
||||||
)
|
))
|
||||||
|
@ -1,5 +1,22 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# THIS PROGRAM IS ONLY A TEST EXAMPLE
|
# THIS PROGRAM IS ONLY A TEST EXAMPLE
|
||||||
|
|
||||||
|
# 音·创 开发交流群 861684859
|
||||||
|
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||||
|
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
||||||
|
# 若需转载或借鉴 许可声明请查看仓库目录下的 Lisence.md
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
音·创 库版 MIDI转换展示程序
|
||||||
|
Musicreater Package Version : Demo for Midi Conversion
|
||||||
|
|
||||||
|
Copyright 2023 all the developers of Musicreater
|
||||||
|
|
||||||
|
开源相关声明请见 ./Lisence.md
|
||||||
|
Terms & Conditions: ./Lisence.md
|
||||||
|
"""
|
||||||
|
|
||||||
from msctPkgver.main import *
|
from msctPkgver.main import *
|
||||||
|
|
||||||
|
167
docs/download&atart/Android.md
Normal file
167
docs/download&atart/Android.md
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
## 使用前的准备工作
|
||||||
|
|
||||||
|
### 安装终端工具
|
||||||
|
|
||||||
|
这里我们选用 **Termux** 作为我们的终端工具来安装,这是一个强大的终端模拟器,旨在安卓环境下模拟Linux的软件包环境。
|
||||||
|
|
||||||
|
1. 下载
|
||||||
|
|
||||||
|
下载可以通过 [GitHub源](https://github.com/termux/termux-app/releases) 或者 [F-Droid源](https://f-droid.org/en/packages/com.termux/) ,个人建议选择 F-Droid 源,因为在国内可以访问得到,而 GitHub 源就看运气。
|
||||||
|
|
||||||
|
2. 安装
|
||||||
|
|
||||||
|
下载*APK*包后直接安装,安装后打开可以看到一个类似这样的界面:
|
||||||
|
|
||||||
|
<img height="512" src="https://foruda.gitee.com/images/1665933025120627254/a0479618_9911226.jpeg">
|
||||||
|
|
||||||
|
3. 完成
|
||||||
|
|
||||||
|
恭喜你,你已经获得了一个极客般流畅地操作你手机的终端工具。
|
||||||
|
|
||||||
|
### 安装运行环境
|
||||||
|
|
||||||
|
1. 换源
|
||||||
|
|
||||||
|
接下来,我们就要来准备安装一下 **Python** 运行环境了,这是运行 **Python** 源代码必要的。
|
||||||
|
|
||||||
|
首先,我估计你等不了多久,急得要死,所以我们要让下载速度稍微快一点,先来换个源。在 **Termux** 中,输入以下指令:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "deb https://mirror.mwt.me/termux/main stable main" > /data/data/com.termux/files/usr/etc/apt/sources.list
|
||||||
|
```
|
||||||
|
|
||||||
|
*感谢 天如<QQ 3291691454>为我们带来的简单换源方法。*
|
||||||
|
|
||||||
|
- *非必要步骤*:手动编辑换源
|
||||||
|
|
||||||
|
如果你闲着没事,非要要手动编辑个文档来换源,那用啥?用普通的编辑器肯定可以,于是我们就让他更普通一点,用**nano**吧!
|
||||||
|
|
||||||
|
在 **Termux** 中,输入以下指令:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export EDITOR=nano
|
||||||
|
apt edit-sources
|
||||||
|
```
|
||||||
|
|
||||||
|
那么请把看到的如左下图的界面变为右下图吧:
|
||||||
|
|
||||||
|
<table><tr>
|
||||||
|
<td><img src="https://foruda.gitee.com/images/1665933104313107707/41108f03_9911226.jpeg"> </td>
|
||||||
|
<td><img src="https://foruda.gitee.com/images/1665933122534781330/3887a901_9911226.jpeg"></td>
|
||||||
|
</tr></table>
|
||||||
|
|
||||||
|
- 图片中的文件,最后应该加入的两行为:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
deb https://mirrors.ustc.edu.cn/termux/apt/termux-main/ stable main
|
||||||
|
deb https://mirrors.tuna.tsinghua.edu.cn/termux/apt/termux-main/ stable main
|
||||||
|
```
|
||||||
|
|
||||||
|
然后键入 `Ctrl`+`S`,再键入 `Ctrl`+`X`,退出`nano`。
|
||||||
|
|
||||||
|
在换源之后,你可能会见到类似的提示:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Your '/data/data/com.termux/files/usr/etc/apt/sources.list' file changed. Please run 'apt-get update'.
|
||||||
|
```
|
||||||
|
|
||||||
|
那就遵循它的指引,输入:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apt-get update
|
||||||
|
```
|
||||||
|
|
||||||
|
Alright.
|
||||||
|
|
||||||
|
2. 安装 **Python**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apt-get install python3
|
||||||
|
```
|
||||||
|
|
||||||
|
如果遇到提示问是否继续,那就输入`Y`表示是,如左下图,安装成功后,图若右下。
|
||||||
|
|
||||||
|
<table><tr>
|
||||||
|
<td><img src="https://foruda.gitee.com/images/1665933181440420034/7f0fb5fd_9911226.jpeg"></td>
|
||||||
|
<td><img src="https://foruda.gitee.com/images/1665933238339972260/a9f06f4f_9911226.jpeg"></td>
|
||||||
|
</tr></table>
|
||||||
|
|
||||||
|
接下来,我们来试一试 **Python** 是不是安装成了吧,输入
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 -V
|
||||||
|
```
|
||||||
|
|
||||||
|
如果输出了形如 `Python 3.X.X` 的提示,则完成。
|
||||||
|
|
||||||
|
3. 安装依赖库
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 首先换源
|
||||||
|
pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/
|
||||||
|
# 然后安装
|
||||||
|
pip install mido
|
||||||
|
pip install brotli
|
||||||
|
```
|
||||||
|
|
||||||
|
- 如果出现以下情况,真是死了鬼的,我们要来再搞个设置:
|
||||||
|
|
||||||
|
<img height="512" src="https://foruda.gitee.com/images/1665933289612919459/b87b7804_9911226.jpeg">
|
||||||
|
|
||||||
|
我们来修改收信任的源设置:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip config set global.trusted-host mirrors.aliyun.com/
|
||||||
|
```
|
||||||
|
|
||||||
|
之后再来安装即可
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install mido
|
||||||
|
pip install brotli
|
||||||
|
```
|
||||||
|
|
||||||
|
安装成功后您可能会见到类似下图的提示:
|
||||||
|
|
||||||
|
<img src="https://foruda.gitee.com/images/1662737676719454287/f61a70f7_9911226.png">
|
||||||
|
|
||||||
|
### 安装下载工具
|
||||||
|
|
||||||
|
既然已经有了运行环境,那么我们就需要下载下我们的**音·创库版示例代码**工具,我非常推崇**Git**这种方便快捷好用还能下载仓库的代码管理器,这个世界上你也找不到第二个,所以我们来安装一下:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pkg install git
|
||||||
|
```
|
||||||
|
|
||||||
|
安装完成后记得测试一下:
|
||||||
|
|
||||||
|
<img height="512" src="https://foruda.gitee.com/images/1665933331269483373/9374c85d_9911226.jpeg">
|
||||||
|
|
||||||
|
## 本代码库的下载与演示程序的使用
|
||||||
|
|
||||||
|
1. 使用Git下载本库及其示例代码
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone -b pkgver https://gitee.com/EillesWan/Musicreater.git MSCTpkgver
|
||||||
|
```
|
||||||
|
|
||||||
|
当上述命令执行成功,你会在执行此命令的所在位置发现一个名为 `MSCTpkgver` 的文件夹,其中包含的正是我们心心念念下载的本程序和示例代码。
|
||||||
|
而我们要运行的也正是示例代码,因此,赶快进入下载到的文件夹:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd MSCTpkgver
|
||||||
|
```
|
||||||
|
|
||||||
|
1. 开始使用演示程序
|
||||||
|
|
||||||
|
依照你的需要,执行以下命令之一:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python demo_convert.py #计分板播放器,支持mcpack与BDX
|
||||||
|
python demo_convert_bdx_byDelay.py #延迟播放器,仅支持BDX
|
||||||
|
```
|
||||||
|
|
||||||
|
运行成功了,哦耶!
|
||||||
|
|
||||||
|
<img height="512" src="https://foruda.gitee.com/images/1665933366784631363/db9f80f6_9911226.jpeg">
|
||||||
|
|
104
docs/download&atart/Linux.md
Normal file
104
docs/download&atart/Linux.md
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
|
||||||
|
## 运行环境安装
|
||||||
|
|
||||||
|
### 检验Python运行环境
|
||||||
|
|
||||||
|
0. 一般的Linux发行版都有安装Python环境,我们只需要保证其版本即可,理论上 ≥Python3.6 都可以运行我们的库
|
||||||
|
|
||||||
|
我们可以使用
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -V
|
||||||
|
```
|
||||||
|
|
||||||
|
来查看 Python 版本,如下
|
||||||
|
|
||||||
|
<img src=https://foruda.gitee.com/images/1665120915821957090/429561fd_9911226.png>
|
||||||
|
|
||||||
|
1. *非必要环节*:回退版本
|
||||||
|
|
||||||
|
如果你跟作者一样,觉得 Python 3.10+ 太难用很烦人的话,那真是皆大欢喜,让我们一起来回退版本吧!
|
||||||
|
|
||||||
|
- pacman 包管理器(多用于Arch Linux上)
|
||||||
|
|
||||||
|
1. 让我们先来把 python3 加入忽略升级的列表中,使用`vim`修改`/etc/pacman.conf`,在`IgnorePkg`后加上`python3`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo vim /etc/pacman.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
<img src=https://foruda.gitee.com/images/1665124611490335193/5e99ca26_9911226.png>
|
||||||
|
|
||||||
|
2. 然后我们开始从[Arch Achieve](https://archive.archlinux.org/packages/)上找Python的版本列表。(*这里说明一下,在Arch中,Python默认指的是Python3,而与其他某些Linux发行版中Python默认指代Python2不同,所以在Arch Achieve中也是如此。*)我这里找到的是[Python3.8.6](https://archive.archlinux.org/packages/p/python/python-3.8.6-1-x86_64.pkg.tar.zst),于是我们用`pacman`把她下载下来并安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo pacman -U https://archive.archlinux.org/packages/p/python/python-3.8.6-1-x86_64.pkg.tar.zst
|
||||||
|
```
|
||||||
|
|
||||||
|
<img src=https://foruda.gitee.com/images/1665126362769399903/ea4b9598_9911226.png>
|
||||||
|
|
||||||
|
3. 完美!
|
||||||
|
|
||||||
|
- 其他包管理器
|
||||||
|
|
||||||
|
暂无
|
||||||
|
|
||||||
|
### 检查并安装pip包管理器依赖
|
||||||
|
|
||||||
|
1. 我们在安装依赖库之前,应该确认一下,Python自带的包管理器pip是否安装到位:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m pip # 确认pip是否安装
|
||||||
|
# 当这个命令输入后有长段提示出现则为已经安装
|
||||||
|
|
||||||
|
# 如果返回如下,那么则pip尚未安装
|
||||||
|
/usr/bin/python: No module named pip
|
||||||
|
# 可以使用如下命令来安装pip
|
||||||
|
sudo pacman -S python-pip
|
||||||
|
# 安装完成后记得验证
|
||||||
|
python -m pip
|
||||||
|
|
||||||
|
|
||||||
|
# 如果还是失败,那么就需要用其他工具安装pip:
|
||||||
|
wget https://bootstrap.pypa.io/get-pip.py
|
||||||
|
sudo python get-pip.py
|
||||||
|
# 安装完成后一定要验证!!!
|
||||||
|
python -m pip
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 确认完成之后,我们来安装一下依赖库:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install mido -i https://mirrors.aliyun.com/pypi/simple/
|
||||||
|
pip install brotli -i https://mirrors.aliyun.com/pypi/simple/
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 安装成功后可能会见到类似下图的提示:
|
||||||
|
|
||||||
|
<img src="https://foruda.gitee.com/images/1662737676719454287/f61a70f7_9911226.png">
|
||||||
|
|
||||||
|
|
||||||
|
## 本代码库的下载与使用
|
||||||
|
|
||||||
|
1. 使用Git下载本库及其示例代码
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone -b pkgver https://gitee.com/EillesWan/Musicreater.git MSCTpkgver
|
||||||
|
```
|
||||||
|
|
||||||
|
当上述命令执行成功,你会在执行此命令的所在位置发现一个名为 `MSCTpkgver` 的文件夹,其中包含的正是我们心心念念下载的本程序和示例代码。
|
||||||
|
而我们要运行的也正是示例代码,因此,赶快进入下载到的文件夹:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd MSCTpkgver
|
||||||
|
```
|
||||||
|
|
||||||
|
1. 开始使用
|
||||||
|
|
||||||
|
在目录下打开终端,执行以下命令:(选择你需要的)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python demo_convert.py #计分板播放器,支持mcpack与BDX
|
||||||
|
python demo_convert_bdx_byDelay.py #延迟播放器,仅支持BDX
|
||||||
|
```
|
||||||
|
|
89
docs/download&atart/Windows.md
Normal file
89
docs/download&atart/Windows.md
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
## 一、运行环境安装
|
||||||
|
|
||||||
|
### (一)安装 Python3.6+
|
||||||
|
|
||||||
|
1. 首先需要下载Python的安装包,最好是 *Python3.8*,因为作者就用的是这个版本
|
||||||
|
|
||||||
|
> [下载64位Python安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe)
|
||||||
|
> [下载32位Python安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe)
|
||||||
|
|
||||||
|
2. 在安装时,最好需要勾选 `Add Python 3.X to PATH`,如下图所示,当然,如果您对自己非常自信,您也可以手动设置此项目:
|
||||||
|
|
||||||
|
<img src=https://foruda.gitee.com/images/1662736520757331846/e38efb81_9911226.png>
|
||||||
|
|
||||||
|
- 若您对Python一知半解或者不怎么了解、并对自己的系统盘(通常是C盘)有大约150*兆字节*(MB)的信心的话,您可以在安装时直接选择*快速安装*(Install Now)
|
||||||
|
|
||||||
|
3. 若您选择了*自定义安装*(Customize Installation),请务必勾选 `pip` 和 `py launcher` 便于后续安装依赖,如下图:
|
||||||
|
|
||||||
|
<img src=https://foruda.gitee.com/images/1662736621235871190/2ac3d98f_9911226.png>
|
||||||
|
|
||||||
|
4. 安装结束之后可以在*终端*(命令行/PowerShell/Bash/etc)中输入:python 试试是否安装成功,成功安装之后,在终端中输入python会显示诸如如下图片的提示:
|
||||||
|
|
||||||
|
<img src=https://foruda.gitee.com/images/1659972669907359295/cmd.png>
|
||||||
|
|
||||||
|
|
||||||
|
### (二)安装依赖
|
||||||
|
|
||||||
|
1. 请以管理员模式打开您的*终端*(命令行/PowerShell/Bash/etc)
|
||||||
|
|
||||||
|
例如,命令行,可以如此打开:在*视窗开始菜单*(Windows开始)中搜索 `cmd`, 并以管理员身份运行
|
||||||
|
|
||||||
|
<img src="https://foruda.gitee.com/images/1662736878650993886/62487dd8_9911226.png">
|
||||||
|
|
||||||
|
2. 打开了终端之后,请在终端中输入以下指令
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install mido -i https://mirrors.aliyun.com/pypi/simple/
|
||||||
|
pip install brotli -i https://mirrors.aliyun.com/pypi/simple/
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 安装成功后您可能会见到类似下图的提示:
|
||||||
|
|
||||||
|
<img src="https://foruda.gitee.com/images/1662737676719454287/f61a70f7_9911226.png">
|
||||||
|
|
||||||
|
## 二、本工具的下载与使用
|
||||||
|
|
||||||
|
0. 下载本代码库以及演示程序
|
||||||
|
|
||||||
|
- 若您使用git,请直接克隆本仓库:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone -b pkgver https://gitee.com/EillesWan/Musicreater.git
|
||||||
|
```
|
||||||
|
|
||||||
|
- 若您不使用git,可以在[*码云*(Gitee)](https://gitee.com/EillesWan/Musicreater.git)或[*GitHub*](https://github.com/EillesWan/Musicreater.git)下载zip包,或者[加入QQ群聊861684859](https://jq.qq.com/?_wv=1027&k=hpeRxrYr),在群文件中获取。
|
||||||
|
|
||||||
|
<img src="https://foruda.gitee.com/images/1669540786443169766/fabf0acd_9911226.png" >
|
||||||
|
|
||||||
|
值得注意的是,这张图上有1、2两个数字,虽然是手写的,但确实是数字,表示着要进行的步骤。希望眼尖得能找出我的口头禅的你们能够发现这两个用鼠标手写的数字并在安装时认真地执行。我认为这并不算十分的难,移动鼠标并单击大约消耗不了多少卡路里,不过我没有进行精确的计算,我也不是十分的清楚这个活动对于一个常人来讲有多难,但我怀疑它不难。
|
||||||
|
|
||||||
|
|
||||||
|
1. 开始使用
|
||||||
|
|
||||||
|
在目录下打开终端。
|
||||||
|
|
||||||
|
例如:打开命令行:请进入到目录下,在文件资源管理器的地址框内输入`cmd`:
|
||||||
|
|
||||||
|
<img src=https://foruda.gitee.com/images/1659974437388532868/输入.png>
|
||||||
|
<img src=https://foruda.gitee.com/images/1659974754378201859/输入c.png>
|
||||||
|
|
||||||
|
执行以下命令:(选择你需要的)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python demo_convert.py #计分板播放器,支持mcpack与BDX
|
||||||
|
python demo_convert_bdx_byDelay.py #延迟播放器,仅支持BDX
|
||||||
|
```
|
||||||
|
|
||||||
|
## 三、安装时错误的补充说明
|
||||||
|
|
||||||
|
1. Microsoft Visual C++ Redistributable 环境出错
|
||||||
|
|
||||||
|
如果你遇到了类似以下这种情况:
|
||||||
|
|
||||||
|
<img src=https://foruda.gitee.com/images/1659972789779764953/bug.jpeg>
|
||||||
|
|
||||||
|
请下载最新的VCREDIST安装包,可以参照[这个网页](https://docs.microsoft.com/zh-CN/cpp/windows/latest-supported-vc-redist)的说明,也可以在这直接选择你需要的安装包下载:
|
||||||
|
> [下载64位VCREDIST安装包](https://aka.ms/vs/17/release/vc_redist.x64.exe)
|
||||||
|
> [下载32位VCREDIST安装包](https://aka.ms/vs/17/release/vc_redist.x86.exe)
|
||||||
|
|
||||||
|
感谢群友Mono帮我们发现这个问题。
|
375
docs/功能使用说明.md
375
docs/功能使用说明.md
@ -12,353 +12,39 @@
|
|||||||
|
|
||||||
*这是演示程序(demo)的使用教程,将在这里提供演示程序的相应的使用教程*
|
*这是演示程序(demo)的使用教程,将在这里提供演示程序的相应的使用教程*
|
||||||
|
|
||||||
## 视窗(Windows)操作系统
|
## 下载与启动教程
|
||||||
|
|
||||||
### 运行环境安装
|
### [视窗(Windows)操作系统](./download%26atart/Windows.md)
|
||||||
|
### [里纽克斯(Linux)操作系统](./download%26atart/Linux.md)
|
||||||
|
### [安卓(Android)与安卓衍生操作系统](./download%26atart/Android.md)
|
||||||
|
|
||||||
0. 安装 Python3.6+
|
## 演示程序使用教程
|
||||||
|
|
||||||
首先需要下载Python的安装包,最好是 *Python3.8*,因为作者就用的是这个版本
|
1. 参数说明
|
||||||
|
|
||||||
> [下载64位Python安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe)
|
<img src=https://foruda.gitee.com/images/1659974810147043475/运行.png>
|
||||||
> [下载32位Python安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe)
|
|
||||||
|
|
||||||
在安装时,最好需要勾选 `Add Python 3.X to PATH`,如下图所示,当然,如果您对自己非常自信,您也可以手动设置此项目:
|
- midi路径:含有mid文件路径、文件名、后缀的完整文件路径,或者一个目录(demo可接受批量转换)。可以使用相对或绝对路径皆可
|
||||||
|
|
||||||
<img src=https://foruda.gitee.com/images/1662736520757331846/e38efb81_9911226.png>
|
- 输出路径:输出文件夹的路径,不需要指示文件名
|
||||||
|
|
||||||
若您对Python一知半解或者不怎么了解、并对自己的系统盘(通常是C盘)有大约150*兆字节*(MB)的信心的话,您可以在安装时直接选择*快速安装*(Install Now)
|
- 是否重置计分板:`1`或`0`(歌曲放完是否重置,推荐`1`)
|
||||||
|
|
||||||
若您选择了*自定义安装*(Customize Installation),请务必勾选 `pip` 和 `py launcher` 便于后续安装依赖,如下图:
|
- 进度条:是否启用进度条,以及自定义进度条样式。输入`0`或`False`表示不启用进度条,输入`1`或`True`表示使用默认进度条,其余的输入均表示使用输入的格式作为自定义的进度条样式
|
||||||
|
|
||||||
<img src=https://foruda.gitee.com/images/1662736621235871190/2ac3d98f_9911226.png>
|
若不支持自定义,则仅能输入`0`或`1`表示“关闭”或“开启”
|
||||||
|
|
||||||
安装结束之后可以在*终端*(命令行/PowerShell/Bash/etc)中输入:python 试试是否安装成功,成功安装之后,在终端中输入python会显示诸如如下图片的提示:
|
|
||||||
|
|
||||||
<img src=https://foruda.gitee.com/images/1659972669907359295/cmd.png>
|
|
||||||
|
|
||||||
|
|
||||||
1. 安装依赖
|
|
||||||
|
|
||||||
请以管理员模式打开您的*终端*(命令行/PowerShell/Bash/etc)
|
|
||||||
|
|
||||||
例如,命令行,可以如此打开:在*视窗开始菜单*(Windows开始)中搜索 `cmd`, 并以管理员身份运行
|
|
||||||
|
|
||||||
<img src="https://foruda.gitee.com/images/1662736878650993886/62487dd8_9911226.png">
|
|
||||||
|
|
||||||
打开了终端之后,请在终端中输入以下指令
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install mido -i https://mirrors.aliyun.com/pypi/simple/
|
|
||||||
pip install brotli -i https://mirrors.aliyun.com/pypi/simple/
|
|
||||||
```
|
|
||||||
|
|
||||||
安装成功后您可能会见到类似下图的提示:
|
|
||||||
|
|
||||||
<img src="https://foruda.gitee.com/images/1662737676719454287/f61a70f7_9911226.png">
|
|
||||||
|
|
||||||
### 本工具的下载与使用
|
|
||||||
|
|
||||||
0. 下载本代码库以及演示程序
|
|
||||||
|
|
||||||
- 若您使用git,请直接克隆本仓库:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone -b pkgver https://gitee.com/EillesWan/Musicreater.git
|
|
||||||
```
|
|
||||||
|
|
||||||
- 若您不使用git,可以在[*码云*(Gitee)](https://gitee.com/EillesWan/Musicreater.git)或[*GitHub*](https://github.com/EillesWan/Musicreater.git)下载zip包,或者[加入QQ群聊861684859](https://jq.qq.com/?_wv=1027&k=hpeRxrYr),在群文件中获取。
|
|
||||||
|
|
||||||
<img src="https://foruda.gitee.com/images/1669540786443169766/fabf0acd_9911226.png" >
|
|
||||||
|
|
||||||
|
|
||||||
1. 开始使用
|
|
||||||
|
|
||||||
在目录下打开终端,例如,打开命令行,请进入到目录下,在地址框内输入`cmd`:
|
|
||||||
|
|
||||||
<img src=https://foruda.gitee.com/images/1659974437388532868/输入.png>
|
|
||||||
<img src=https://foruda.gitee.com/images/1659974754378201859/输入c.png>
|
|
||||||
|
|
||||||
执行以下命令:(选择你需要的)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python demo_convert.py
|
|
||||||
python demo_convert_bdx_byDelay.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### 补充错误说明
|
|
||||||
|
|
||||||
1. Microsoft Visual C++ Redistributable 环境出错
|
|
||||||
|
|
||||||
如果你遇到了类似以下这种情况:
|
|
||||||
|
|
||||||
<img src=https://foruda.gitee.com/images/1659972789779764953/bug.jpeg>
|
|
||||||
|
|
||||||
请下载最新的VCREDIST安装包,可以参照[这个网页](https://docs.microsoft.com/zh-CN/cpp/windows/latest-supported-vc-redist)的说明,也可以在这直接选择你需要的安装包下载:
|
|
||||||
> [下载64位VCREDIST安装包](https://aka.ms/vs/17/release/vc_redist.x64.exe)
|
|
||||||
> [下载32位VCREDIST安装包](https://aka.ms/vs/17/release/vc_redist.x86.exe)
|
|
||||||
|
|
||||||
感谢群友Mono帮我们发现这个问题
|
|
||||||
|
|
||||||
## 里纽克斯(Linux)操作系统
|
|
||||||
|
|
||||||
|
|
||||||
### 运行环境安装
|
|
||||||
|
|
||||||
0. 安装并检验Python运行环境
|
|
||||||
|
|
||||||
一般的Linux发行版都有安装Python环境,我们只需要保证其版本即可,理论上 ≥Python3.6 都可以运行我们的库
|
|
||||||
|
|
||||||
我们可以使用
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python -V
|
|
||||||
```
|
|
||||||
|
|
||||||
来查看 Python 版本,如下
|
|
||||||
|
|
||||||
<img src=https://foruda.gitee.com/images/1665120915821957090/429561fd_9911226.png>
|
|
||||||
|
|
||||||
- 非必要环节
|
|
||||||
|
|
||||||
如果你跟作者一样,觉得 Python 3.10+ 太难用很烦人的话,那真是皆大欢喜,让我们一起来回退版本吧!
|
|
||||||
|
|
||||||
- pacman 包管理器(多用于Arch Linux上)
|
|
||||||
|
|
||||||
让我们先来把 python3 加入忽略升级的列表中,使用`vim`修改`/etc/pacman.conf`,在`IgnorePkg`后加上`python3`
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo vim /etc/pacman.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
<img src=https://foruda.gitee.com/images/1665124611490335193/5e99ca26_9911226.png>
|
|
||||||
|
|
||||||
然后我们开始从[Arch Achieve](https://archive.archlinux.org/packages/)上找Python的版本列表。(*这里说明一下,在Arch中,Python默认指的是Python3,而与其他某些Linux发行版中Python默认指代Python2不同,所以在Arch Achieve中也是如此。*)我这里找到的是[Python3.8.6](https://archive.archlinux.org/packages/p/python/python-3.8.6-1-x86_64.pkg.tar.zst),于是我们用`pacman`把她下载下来:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo pacman -U https://archive.archlinux.org/packages/p/python/python-3.8.6-1-x86_64.pkg.tar.zst
|
|
||||||
```
|
|
||||||
|
|
||||||
<img src=https://foruda.gitee.com/images/1665126362769399903/ea4b9598_9911226.png>
|
|
||||||
|
|
||||||
完美!
|
|
||||||
|
|
||||||
1. 检查并安装pip包管理器依赖
|
|
||||||
|
|
||||||
我们在安装依赖库之前,应该确认一下,Python自带的包管理器pip是否安装到位:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python -m pip # 确认pip是否安装
|
|
||||||
# 当这个命令输入后有长段提示出现则为已经安装
|
|
||||||
|
|
||||||
# 如果返回如下,那么则pip尚未安装
|
|
||||||
/usr/bin/python: No module named pip
|
|
||||||
# 可以使用如下命令来安装pip
|
|
||||||
sudo pacman -S python-pip
|
|
||||||
# 安装完成后记得验证
|
|
||||||
python -m pip
|
|
||||||
|
|
||||||
|
|
||||||
# 如果还是失败,那么就需要用其他工具安装pip:
|
|
||||||
wget https://bootstrap.pypa.io/get-pip.py
|
|
||||||
sudo python get-pip.py
|
|
||||||
# 安装完成后一定要验证!!!
|
|
||||||
python -m pip
|
|
||||||
```
|
|
||||||
|
|
||||||
确认完成之后,我们来安装一下依赖库:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install mido -i https://mirrors.aliyun.com/pypi/simple/
|
|
||||||
pip install brotli -i https://mirrors.aliyun.com/pypi/simple/
|
|
||||||
```
|
|
||||||
|
|
||||||
安装成功后您可能会见到类似下图的提示:
|
|
||||||
|
|
||||||
<img src="https://foruda.gitee.com/images/1662737676719454287/f61a70f7_9911226.png">
|
|
||||||
|
|
||||||
|
|
||||||
### 本代码库的下载与使用
|
|
||||||
|
|
||||||
1. 使用Git下载本库及其示例代码
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone -b pkgver https://gitee.com/EillesWan/Musicreater.git MSCTpkgver
|
|
||||||
```
|
|
||||||
|
|
||||||
当上述命令执行成功,你会在执行此命令的所在位置发现一个名为 `MSCTpkgver` 的文件夹,其中包含的正是我们心心念念下载的本程序和示例代码。
|
|
||||||
而我们要运行的也正是示例代码,因此,赶快进入下载到的文件夹:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd MSCTpkgver
|
|
||||||
```
|
|
||||||
|
|
||||||
1. 开始使用
|
|
||||||
|
|
||||||
在目录下打开终端,执行以下命令:(选择你需要的)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python demo_convert.py
|
|
||||||
python demo_convert_bdx_byDelay.py
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 安卓(Android)与安卓衍生操作系统
|
|
||||||
|
|
||||||
|
|
||||||
### 使用前的准备工作
|
|
||||||
|
|
||||||
0. 安装终端工具
|
|
||||||
|
|
||||||
这里我们选用 **Termux** 作为我们的终端工具来安装,这是一个强大的终端模拟器,旨在安卓环境下模拟Linux的软件包环境。
|
|
||||||
|
|
||||||
下载可以通过 [GitHub](https://github.com/termux/termux-app/releases) 或者 [F-Droid](https://f-droid.org/en/packages/com.termux/) ,个人建议选择 F-Droid 源,因为在国内可以访问得到,而 GitHub 源就看运气。
|
|
||||||
|
|
||||||
下载后直接按照,打开后可以看到一个类似这样的界面:
|
|
||||||
|
|
||||||
<img src="https://foruda.gitee.com/images/1665933025120627254/a0479618_9911226.jpeg">
|
|
||||||
|
|
||||||
恭喜你,你已经获得了一个极客般流畅地操作你手机的终端工具。
|
|
||||||
|
|
||||||
1. 安装运行环境
|
|
||||||
|
|
||||||
接下来,我们就要来安装一下 **Python** 运行环境了,这是运行 **Python** 源代码必要的。
|
|
||||||
|
|
||||||
首先,我估计你等不了多久,急得要死,所以我们要让下载速度稍微快一点,先来换个源。换源要手动编辑个文档,那用啥?用普通的编辑器肯定可以,于是我们就让他更普通一点,用**nano**吧!
|
|
||||||
|
|
||||||
在 **Termux** 中,输入以下指令:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export EDITOR=nano
|
|
||||||
apt edit-sources
|
|
||||||
```
|
|
||||||
|
|
||||||
你可能会看到如下一个简单的界面:
|
|
||||||
|
|
||||||
<img src="https://foruda.gitee.com/images/1665933104313107707/41108f03_9911226.jpeg">
|
|
||||||
|
|
||||||
好,让我们动起你的双手,把它变成这样吧:
|
|
||||||
|
|
||||||
<img src="https://foruda.gitee.com/images/1665933122534781330/3887a901_9911226.jpeg">
|
|
||||||
|
|
||||||
- 图片中的文件,最后应该加入的两行为:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
deb https://mirrors.ustc.edu.cn/termux/apt/termux-main/ stable main
|
|
||||||
deb https://mirrors.tuna.tsinghua.edu.cn/termux/apt/termux-main/ stable main
|
|
||||||
```
|
|
||||||
|
|
||||||
然后键入 `Ctrl`+`S`,再键入 `Ctrl`+`X`,你会见到差不多如下的提示:
|
|
||||||
|
|
||||||
```text
|
|
||||||
Your '/data/data/com.termux/files/usr/etc/apt/sources.list' file changed. Please run 'apt-get update'.
|
|
||||||
```
|
|
||||||
|
|
||||||
那就遵循它的指引,输入:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
apt-get update
|
|
||||||
```
|
|
||||||
|
|
||||||
然后就完美了,我们来安装 **Python** 吧!
|
|
||||||
|
|
||||||
```bash
|
|
||||||
apt-get install python3
|
|
||||||
```
|
|
||||||
|
|
||||||
如果遇到提示问是否继续,那就输入`Y`表示是,如图。
|
|
||||||
|
|
||||||
<img src="https://foruda.gitee.com/images/1665933181440420034/7f0fb5fd_9911226.jpeg">
|
|
||||||
|
|
||||||
如果你安装成功,应该是差不多这样的:
|
|
||||||
|
|
||||||
<img src="https://foruda.gitee.com/images/1665933238339972260/a9f06f4f_9911226.jpeg">
|
|
||||||
|
|
||||||
我们来试一试 **Python** 是不是安装成了吧,输入
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 -V
|
|
||||||
```
|
|
||||||
|
|
||||||
如果输出了形如 `Python 3.X.X` 的提示,则完成。
|
|
||||||
|
|
||||||
确认完成之后,我们来安装一下依赖库:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 首先换源
|
|
||||||
pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/
|
|
||||||
# 然后安装
|
|
||||||
pip install mido
|
|
||||||
pip install brotli
|
|
||||||
```
|
|
||||||
|
|
||||||
- 如果出现以下情况,真是死了鬼的,我们要来再搞个设置:
|
|
||||||
|
|
||||||
<img src="https://foruda.gitee.com/images/1665933289612919459/b87b7804_9911226.jpeg">
|
|
||||||
|
|
||||||
我们来修改收信任的源设置:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip config set global.trusted-host mirrors.aliyun.com/
|
|
||||||
```
|
|
||||||
|
|
||||||
之后再来安装即可
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install mido
|
|
||||||
pip install brotli
|
|
||||||
```
|
|
||||||
|
|
||||||
安装成功后您可能会见到类似下图的提示:
|
|
||||||
|
|
||||||
<img src="https://foruda.gitee.com/images/1662737676719454287/f61a70f7_9911226.png">
|
|
||||||
|
|
||||||
3. 安装下载工具
|
|
||||||
|
|
||||||
既然已经有了运行环境,那么我们就需要下载下我们的**音·创库版示例代码**工具,我非常推崇**Git**这种方便快捷好用还能下载仓库的代码管理器,这个世界上你也找不到第二个,所以我们来安装一下:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pkg install git
|
|
||||||
```
|
|
||||||
|
|
||||||
安装完成后记得测试一下:
|
|
||||||
|
|
||||||
<img src="https://foruda.gitee.com/images/1665933331269483373/9374c85d_9911226.jpeg">
|
|
||||||
|
|
||||||
### 本代码库的下载与使用
|
|
||||||
|
|
||||||
1. 使用Git下载本库及其示例代码
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone -b pkgver https://gitee.com/EillesWan/Musicreater.git MSCTpkgver
|
|
||||||
```
|
|
||||||
|
|
||||||
当上述命令执行成功,你会在执行此命令的所在位置发现一个名为 `MSCTpkgver` 的文件夹,其中包含的正是我们心心念念下载的本程序和示例代码。
|
|
||||||
而我们要运行的也正是示例代码,因此,赶快进入下载到的文件夹:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd MSCTpkgver
|
|
||||||
```
|
|
||||||
|
|
||||||
1. 开始使用
|
|
||||||
|
|
||||||
在目录下打开终端,执行以下命令:(选择你需要的)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python demo_convert.py
|
|
||||||
python demo_convert_bdx_byDelay.py
|
|
||||||
```
|
|
||||||
|
|
||||||
运行成功了,哦耶!
|
|
||||||
|
|
||||||
<img src="https://foruda.gitee.com/images/1665933366784631363/db9f80f6_9911226.jpeg">
|
|
||||||
|
|
||||||
|
- 计分板名称:游戏内的计分板名称
|
||||||
|
|
||||||
|
- 音量:0-1之间的小数(含0,1)正常来说推荐`1`
|
||||||
|
|
||||||
|
- 速度倍率:小数数据,其值不可为0,一般写`1`
|
||||||
|
|
||||||
|
- 玩家选择器:包括 `@x` 在内的全部选择器,即若要选择全部标签为`Holo`的玩家,则需要如此输入:`@a[tag=Holo]`
|
||||||
|
|
||||||
|
- 没有报错且在输出路径下找到mcpack或bdx即为生成成功:
|
||||||
|
|
||||||
|
<img src=https://foruda.gitee.com/images/1659973655881460036/输出.png>
|
||||||
|
|
||||||
|
|
||||||
# 其他说明
|
# 其他说明
|
||||||
@ -373,31 +59,6 @@
|
|||||||
|
|
||||||
答2:详见问1,切换你所需要的播放器即可。
|
答2:详见问1,切换你所需要的播放器即可。
|
||||||
|
|
||||||
## 对于 参数 的补充说明
|
|
||||||
|
|
||||||
<img src=https://foruda.gitee.com/images/1659974810147043475/运行.png>
|
|
||||||
|
|
||||||
- midi路径:含有mid文件路径、文件名、后缀的完整文件路径,或者一个目录(demo可接受批量转换)。可以使用相对或绝对路径皆可
|
|
||||||
|
|
||||||
- 输出路径:输出文件夹的路径,不需要指示文件名
|
|
||||||
|
|
||||||
- 是否重置计分板:1或0(歌曲放完是否重置,推荐1)
|
|
||||||
|
|
||||||
- *进度条:是否启用进度条,以及自定义进度条样式。输入0或False表示不启用进度条,输入1或True表示使用默认进度条,其余的输入均表示使用输入的格式作为自定义的进度条样式
|
|
||||||
|
|
||||||
- 计分板名称:游戏内的计分板名称
|
|
||||||
|
|
||||||
- 音量:0-1之间的小数(含0,1)正常来说推荐1
|
|
||||||
|
|
||||||
- 速度倍率:小数数据,不可为0,一般写1
|
|
||||||
|
|
||||||
- 玩家选择器:包括 `@x` 在内的全部选择器,即若要选择全部标签为`Holo`的玩家,则需要如此输入:`@a[tag=Holo]`
|
|
||||||
|
|
||||||
- 没有报错且在输出路径下找到mcpack或bdx即为生成成功:
|
|
||||||
|
|
||||||
<img src=https://foruda.gitee.com/images/1659973655881460036/输出.png>
|
|
||||||
|
|
||||||
|
|
||||||
## 对于 进度条自定义 功能的说明
|
## 对于 进度条自定义 功能的说明
|
||||||
|
|
||||||
因为我们提供了可以自动转换进度条的功能,因此在这里给出进度条自定义参数的详细解释。
|
因为我们提供了可以自动转换进度条的功能,因此在这里给出进度条自定义参数的详细解释。
|
||||||
|
180
docs/新手答疑指南.md
Normal file
180
docs/新手答疑指南.md
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
<h1 align="center">音·创 Musicreater</h1>
|
||||||
|
|
||||||
|
<h2 align="center">库版 Package Version</h2>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img width="128" height="128" src="https://s1.ax1x.com/2022/05/06/Ouhghj.md.png" >
|
||||||
|
</p>
|
||||||
|
|
||||||
|
# 新手答疑指南
|
||||||
|
|
||||||
|
**考虑到某些用户电脑技术不是特别先进,且对这个项目充满了好奇心,但是又了解的不是很充分,
|
||||||
|
为此,我特别在这里写一份文档,解答各位的好奇心。放心,本文件全程中文,英文版本随后更新!**
|
||||||
|
|
||||||
|
## 第一部分 关于音·创的作用
|
||||||
|
|
||||||
|
### 1.1 音·创简介
|
||||||
|
|
||||||
|
音·创 Musicreater 是一款免费开源的 **《我的世界:基岩版》** 音乐制作软件
|
||||||
|
|
||||||
|
音·创 库版 (Musicreater Package Version) 是一款免费开源的针对 **《我的世界:基岩版》** 的midi音乐转换库
|
||||||
|
|
||||||
|
音·创 采用的是**带有特殊条款的Apache2.0**开源协议,详情请见[这里](https://gitee.com/EillesWan/Musicreater/blob/master/LICENSE.md)。
|
||||||
|
|
||||||
|
音·创
|
||||||
|
目前已经具备较为完善的**教程**,如果你还不知道音·创有教程,请点击
|
||||||
|
[
|
||||||
|
这里](https://gitee.com/EillesWan/Musicreater/blob/pkgver/docs/%E5%8A%9F%E8%83%BD%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.md)。
|
||||||
|
|
||||||
|
### 1.2 音·创到底目前有什么功能?
|
||||||
|
* - [x] 支持导入.mid文件
|
||||||
|
* - [x] 支持写入.mcpack文件
|
||||||
|
* - [x] 支持写入.bdx文件
|
||||||
|
|
||||||
|
|
||||||
|
* 不支持导入.mp3 .mp4 .wav等音频流文件
|
||||||
|
|
||||||
|
## 第二部分 关于格式的问题
|
||||||
|
|
||||||
|
### 2.1 关于.mid格式
|
||||||
|
其实对于经常玩音乐电子制作的朋友们来说,mid格式并不陌生,这里我简单介绍一下。
|
||||||
|
|
||||||
|
> mid格式是由MIDI继承而来。MID文件并不是一段录制好的声音,而是记录声音的信息,然后再告诉声卡如何再现音乐的一组指令。
|
||||||
|
> 这样一个MIDI文件每存1分钟的音乐只用大约5~10KB。今天,MID文件主要用于原始乐器作品、流行歌曲的业余表演、游戏音轨以及电子贺卡等。
|
||||||
|
>
|
||||||
|
> ——百度百科
|
||||||
|
>
|
||||||
|
> MIDI 音乐,保存在电脑上,就是 *.mid 类型的文件。和一般意义上的“音乐”不同,mid 类型的音乐通常并不是可直接发行供大众欣赏的音乐,
|
||||||
|
> 它更像是一种音乐创作者使用的工程文件。它没有歌词,不含有人类语言。如果说五线谱是给人类阅读的乐谱,
|
||||||
|
> MIDI音乐文件便是给计算机或其他电子设备使用的乐谱。对于“音乐”这个世界来说,它微不足道,却又是现代数字音乐的基石。虽不为大众所知,
|
||||||
|
> 但在 MIDI 音乐爱好者眼中,它却是非常有意思的东西。有了 MIDI 音乐技术和一台电脑,基本就等于拥有了一个乐队,加上相关的音乐知识,
|
||||||
|
> 就可以自己指挥这个“乐队”,创作音乐作品了!
|
||||||
|
> 同时,MIDI 技术由于数据结构简单,又与音乐有关,也成为了部分技术极客的爱好。有人使用MIDI技术+Arduino开源硬件制作了架子鼓,
|
||||||
|
> 有人通过分析大量MIDI乐曲结构,设计了人工智能作曲软件,还有更酷的人使用MIDI音乐制作了随节奏变幻的特斯拉线圈!
|
||||||
|
> 在MIDI 音乐的世界里,汇聚了一批喜欢音乐又热爱技术的人。我们有理由相信,玩MIDI音乐的你,定是多才多艺的。
|
||||||
|
>
|
||||||
|
> ——midishow.com
|
||||||
|
|
||||||
|
**所以,mid文件的本质是电子乐谱,而不是记录声音波形文件的.mp3/.wav/.m4a等等文件!**
|
||||||
|
|
||||||
|
### 2.2 关于.mid格式的获取
|
||||||
|
|
||||||
|
通过刚刚的介绍,你可能已经发现,*.mid文件因为受众并不多而并没有被广泛熟知,因而你之前可能完全没见过这个文件,更何况要弄一首自己心仪的歌了。
|
||||||
|
|
||||||
|
这里介绍几个获取.mid格式的方法:
|
||||||
|
|
||||||
|
1. 最简单的方法就是成为一个作编曲的人,当然,很多人做不到这一点,但是有必要提到这一点,当你在下面的渠道中都无法获得想要的文件时,
|
||||||
|
你应该考虑是不是需要自己创作内容,或者,请别人帮你创作内容。
|
||||||
|
2. 当你没有这样的文件时,问问别人或者从群里下在公告的免费的也是个思路,不过这个办法通常使用次数有限。
|
||||||
|
3. 自己找mid:现在,我将给你提供一个完整的找mid的方法,请认真学习:
|
||||||
|
**1.** 首先你需要在www.midishow.com中注册一个账号,并不复杂,你可能只需要一个QQ号。
|
||||||
|
**2.** 登录你的账号,主界面应该如下图所示:
|
||||||
|
<img src="https://foruda.gitee.com/images/1672644995747340749/36c9c143_10062986.png">
|
||||||
|
**3.** 在显眼的搜索框中,输入你想要的歌曲名称,接下来的教程,我以`夜空中最亮的星`这首歌及它的mid来演示下载流程。点击搜索框,完成这一步。
|
||||||
|
<img src="https://foruda.gitee.com/images/1672645340943813483/44d0db69_10062986.png">
|
||||||
|
**4.** 接下来看到搜索结果如下,你可以点进去一个听听,决定你是否要下载;也有可能你什么都没搜到,那你就得换首歌或者换个途径了。
|
||||||
|
<img src="https://foruda.gitee.com/images/1672645574402099694/6b7e18e5_10062986.png">
|
||||||
|
**5.** 点击播放按钮试听,网站上的效果可能一般,但是会听音乐的人应该很快就能决定你是否需要下载这个音乐。如果需要下载,你可以进行到下一步,
|
||||||
|
如果不行,那你可以退回刚刚的页面换一个。
|
||||||
|
<img src="https://foruda.gitee.com/images/1672645752246438160/47cead78_10062986.png">
|
||||||
|
**6.** 翻到最下面,如图,你可以对这首歌进行打分,打分可以使积分+1,建议打5分;你可以对这首歌进行评论,一次有意义的评论可以+3分。
|
||||||
|
下载一首歌需要-3积分,如果你先完成了这两项操作再下载,那你还会再赚1积分。所以推荐这样做!
|
||||||
|
<img src="https://foruda.gitee.com/images/1672646433045265565/26ea29b2_10062986.png">
|
||||||
|
**完成后会像这样:**
|
||||||
|
<img src="https://foruda.gitee.com/images/1672646242419857480/5e8809b8_10062986.png">
|
||||||
|
**7.** 接下来下载,往上翻网页,找到这个标识,然后单击。
|
||||||
|
<img src="https://foruda.gitee.com/images/1672646275215822535/63b402db_10062986.png">
|
||||||
|
**8.** 确认完毕后点击下载。
|
||||||
|
<img src="https://foruda.gitee.com/images/1672646309787744490/f459adac_10062986.png">
|
||||||
|
**9.** 完成下载,如图:
|
||||||
|
<img src="https://foruda.gitee.com/images/1672646335942429563/2449ed0b_10062986.png">
|
||||||
|
4. 使用mp3转换为mid的工具:不得不说,科技的进步带来了许多便利,让这样困难的事情也变得简单。如果上述方法仍然没有解决你的问题,
|
||||||
|
那么你可以在下一章节中找到有关这个途径的说明。
|
||||||
|
|
||||||
|
### 2.3 .mp3格式转换为.mid格式
|
||||||
|
|
||||||
|
**注意,使用这个技术有一定难度,酌情使用!**
|
||||||
|
|
||||||
|
概述:mp3转mid需要把**模拟的波形频谱信号转为数字乐谱信号**,这个过程**一定有损失**。
|
||||||
|
|
||||||
|
请各位以后不要在答疑群中问类似于我这个转换效果为什么不好这样的问题,谢谢。
|
||||||
|
|
||||||
|
如果直接用**widi**的话相当于对声音进行了**傅里叶变换**,你确实可以分离出其中的音高,但是效果在不同情况下差异较大,
|
||||||
|
尤其是有架子鼓啊啥的玩也的时候,比较**差**。
|
||||||
|
([widi工具链接](https://pan.baidu.com/s/1j_Jui0piQ6rMOXM0GJtqTg) 提取码:b0lw )
|
||||||
|
|
||||||
|
**如果只有钢琴的谱子需要分离,有一个完美的选择**:[这里](https://zhuanlan.zhihu.com/p/270999354)
|
||||||
|
|
||||||
|
如果不然有其他的乐器也需要分离,那么可能就有点困难,像cakewalk就确实也可以吧音频变成mid,但是可能要
|
||||||
|
**先把原MP3分离成人声音轨、贝斯音轨等再傅里叶变换。**
|
||||||
|
|
||||||
|
当然我也可能了解的不全,没准现在已经有传新的技术可以分离的更好了,那就太棒了!(〃'▽'〃)
|
||||||
|
|
||||||
|
另外,我们开发者也象征性的找了一些mp3转mid的网站,我们没使用过,不担保效果。
|
||||||
|
[https://www.serocs.cn/transcription/](https://www.serocs.cn/transcription/)
|
||||||
|
|
||||||
|
同时,midishow论坛里有一些大佬也提供了解决方案,看看他们的发言也是一个不错的选择。
|
||||||
|
|
||||||
|
我就只给个论坛链接了,经常有人问这种问题,你可以去那里随便找到一篇帖子看看。
|
||||||
|
[论坛](https://www.midishow.com/question)
|
||||||
|
|
||||||
|
### 2.4 输出格式的问题
|
||||||
|
|
||||||
|
在前面说到,输出主要有`.mcpack`和`.bdx`文件的输出,接下来我会围绕这两个文件进行简单的说明。
|
||||||
|
|
||||||
|
#### 2.4.1 .mcpack是什么
|
||||||
|
|
||||||
|
输出.mcpack文件其实对于一个**资深基岩版我的世界玩家**应该并不陌生。
|
||||||
|
|
||||||
|
.mcpack文件其实就是我的世界基岩版的附加包,里面一般分为行为包和材质包
|
||||||
|
|
||||||
|
我们生成的命令组属于**行为包** (下图就是一个例子)
|
||||||
|
|
||||||
|
<img src="https://foruda.gitee.com/images/1672647779755793187/884abaa9_10062986.png">
|
||||||
|
|
||||||
|
如果你是国际电脑版基岩玩家就像我一样,是可以直接打开这个文件,并将这个包导入我的世界的。
|
||||||
|
|
||||||
|
关于怎么使用,请看[**这里**](https://gitee.com/EillesWan/Musicreater/blob/pkgver/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)。
|
||||||
|
|
||||||
|
#### 2.4.2 .bdx是什么
|
||||||
|
|
||||||
|
.bdx 文件其实是FastBuilder这款软件的结构文件,可以导入到我的世界。
|
||||||
|
|
||||||
|
由于这不属于官方文件,且我并不是很熟悉这个结构,所以请对这个格式有问题的好兄弟加一下QQ群,问问群里负责导入的大佬。
|
||||||
|
|
||||||
|
## 第三部分 关于其他问题
|
||||||
|
|
||||||
|
**由于开发者们都很忙,群友们的耐心也都有限,所以恳请大家提出有意义的问题。这里附一个关于提问方法的链接,大家可以看看。**
|
||||||
|
|
||||||
|
[提问的智慧](https://github.com/tvvocold/How-To-Ask-Questions-The-Smart-Way)
|
||||||
|
|
||||||
|
希望不要我把这个文件在聊天中甩给你,那说明我可能已经没有耐心了。
|
||||||
|
|
||||||
|
看完这份说明,如果你打算开始使用我们的工具的话,请移步至[这里](https://gitee.com/EillesWan/Musicreater/blob/pkgver/docs/%E5%8A%9F%E8%83%BD%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.md)。
|
||||||
|
|
||||||
|
## 结尾
|
||||||
|
|
||||||
|
### 作者\<*金羿*\>(Eilles)联系方式
|
||||||
|
|
||||||
|
1. QQ 2647547478
|
||||||
|
2. 电邮 EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||||
|
3. 微信 WYI_DoctorYI
|
||||||
|
4. Telegram [@EillesWan](https://t.me/EillesWan)
|
||||||
|
|
||||||
|
### 作者\<*诸葛亮与八卦阵*\>(bgArray)联系方式
|
||||||
|
|
||||||
|
1. QQ 4740437765
|
||||||
|
|
||||||
|
**欢迎加群:[861684859](https://jq.qq.com/?_wv=1027&k=hpeRxrYr)**
|
||||||
|
|
||||||
|
**欢迎加群:[861684859](https://jq.qq.com/?_wv=1027&k=hpeRxrYr)**
|
||||||
|
|
||||||
|
**欢迎加群:[861684859](https://jq.qq.com/?_wv=1027&k=hpeRxrYr)**
|
||||||
|
|
||||||
|
(重要的事情说三遍)
|
||||||
|
|
||||||
|
**(有能力的同志麻烦给仓库star一下)**
|
||||||
|
|
||||||
|
**(有能力的同志麻烦给仓库star一下)**
|
||||||
|
|
||||||
|
**(有能力的同志麻烦给仓库star一下)**
|
114
magicDemo.py
114
magicDemo.py
@ -4,26 +4,17 @@
|
|||||||
# 音·创 开发交流群 861684859
|
# 音·创 开发交流群 861684859
|
||||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||||
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
||||||
# 若需转载或借鉴 请依照 Apache 2.0 许可证进行许可
|
# 若需转载或借鉴 许可声明请查看仓库目录下的 Lisence.md
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
音·创 库版 MIDI转换示例程序
|
音·创 库版 MIDI转换示例程序
|
||||||
Musicreater Package Version : Demo for Midi Conversion
|
Musicreater Package Version : Demo for Midi Conversion
|
||||||
|
|
||||||
Copyright 2022 all the developers of Musicreater
|
Copyright 2023 all the developers of Musicreater
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the 'License');
|
开源相关声明请见 ./Lisence.md
|
||||||
you may not use this file except in compliance with the License.
|
Terms & Conditions: ./Lisence.md
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an 'AS IS' BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
languages = {
|
languages = {
|
||||||
@ -42,6 +33,8 @@ languages = {
|
|||||||
"ChoosePlayer": "请选择播放方式[计分板(1) 或 延迟(0)]",
|
"ChoosePlayer": "请选择播放方式[计分板(1) 或 延迟(0)]",
|
||||||
"ChoosePath": "请输入MIDI路径或所在文件夹",
|
"ChoosePath": "请输入MIDI路径或所在文件夹",
|
||||||
"WhetherArgEntering": "是否为文件夹内文件的转换统一参数[是(1) 或 否(0)]",
|
"WhetherArgEntering": "是否为文件夹内文件的转换统一参数[是(1) 或 否(0)]",
|
||||||
|
"EnterArgs": "请输入转换参数",
|
||||||
|
"noteofArgs": "注:文件夹内的全部midi将统一以此参数转换",
|
||||||
"ChooseSbReset": "是否自动重置计分板[是(1) 或 否(0)]",
|
"ChooseSbReset": "是否自动重置计分板[是(1) 或 否(0)]",
|
||||||
"WhetherCstmProgressBar": "是否自定义进度条[是(1) 或 否(0)]",
|
"WhetherCstmProgressBar": "是否自定义进度条[是(1) 或 否(0)]",
|
||||||
"EnterProgressBarStyle": "请输入进度条样式",
|
"EnterProgressBarStyle": "请输入进度条样式",
|
||||||
@ -54,7 +47,7 @@ languages = {
|
|||||||
"Re-Enter": "请重新输入",
|
"Re-Enter": "请重新输入",
|
||||||
"Dealing": "正在处理",
|
"Dealing": "正在处理",
|
||||||
"FileNotFound": "文件(夹)不存在",
|
"FileNotFound": "文件(夹)不存在",
|
||||||
"ChooseOutPath": "请输入输出路径",
|
"ChooseOutPath": "请输入结果输出路径",
|
||||||
"EnterSelecter": "请输入播放者选择器",
|
"EnterSelecter": "请输入播放者选择器",
|
||||||
"Saying": "言·论",
|
"Saying": "言·论",
|
||||||
}
|
}
|
||||||
@ -63,7 +56,6 @@ languages = {
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
if sys.argv.__len__() > 0:
|
if sys.argv.__len__() > 0:
|
||||||
currentLang = sys.argv[0]
|
currentLang = sys.argv[0]
|
||||||
if not currentLang in languages.keys():
|
if not currentLang in languages.keys():
|
||||||
@ -74,31 +66,16 @@ else:
|
|||||||
|
|
||||||
def _(__):
|
def _(__):
|
||||||
'''
|
'''
|
||||||
:ChooseFileFormat 请输入输出格式[bdx(1)或mcpack(0)]
|
`languages`
|
||||||
:ChoosePlayer 请选择播放方式[计分板(1) 或 延迟(0)]
|
|
||||||
:ChoosePath 请输入midi路径或所在文件夹
|
|
||||||
:WhetherArgEntering 是否为文件夹内文件的转换统一参数[是1 或 否0]
|
|
||||||
:ChooseSbReset 是否自动重置计分板[1或0]:
|
|
||||||
:WhetherCstmProgressBar 是否自定义进度条
|
|
||||||
:EnterProgressBarStyle 请输入进度条样式
|
|
||||||
:EnterSbName 请输入计分板名称
|
|
||||||
:EnterVolume 请输入音量大小(0~1)
|
|
||||||
:EnterSpeed 请输入速度倍率
|
|
||||||
:EnterAuthor 请输入作者
|
|
||||||
:EnterMaxHeight 请输入指令结构最大生成高度
|
|
||||||
:ErrEnter 输入错误
|
|
||||||
:Re-Enter 请重新输入
|
|
||||||
:Dealing 正在处理
|
|
||||||
:FileNotFound 文件不存在
|
|
||||||
:ChooseOutPath 请输入输出路径
|
|
||||||
:EnterSelecter 请输入播放者选择器
|
|
||||||
:Saying 箴言
|
|
||||||
'''
|
'''
|
||||||
return languages[currentLang][__]
|
return languages[currentLang][__]
|
||||||
|
|
||||||
|
|
||||||
from msctPkgver.main import *
|
|
||||||
import os
|
import os
|
||||||
|
import random
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from msctPkgver.main import *
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
@ -109,7 +86,14 @@ except ModuleNotFoundError as E:
|
|||||||
else:
|
else:
|
||||||
raise E
|
raise E
|
||||||
|
|
||||||
MainConsole = Console()
|
try:
|
||||||
|
import zhdate
|
||||||
|
except ModuleNotFoundError as E:
|
||||||
|
if input("您需要安装 zhdate 模块才能使用这个样例\n请问是否安装?(y/n)").lower() in ('y', '1'):
|
||||||
|
os.system("pip install zhdate -i https://mirrors.aliyun.com/pypi/")
|
||||||
|
import zhdate
|
||||||
|
else:
|
||||||
|
raise E
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -122,6 +106,8 @@ except ModuleNotFoundError as E:
|
|||||||
raise E
|
raise E
|
||||||
|
|
||||||
|
|
||||||
|
MainConsole = Console()
|
||||||
|
|
||||||
MainConsole.print(
|
MainConsole.print(
|
||||||
"[#121110 on #F0F2F4] ",
|
"[#121110 on #F0F2F4] ",
|
||||||
style="#121110 on #F0F2F4",
|
style="#121110 on #F0F2F4",
|
||||||
@ -129,13 +115,14 @@ MainConsole.print(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# 显示大标题
|
||||||
MainConsole.rule(title="[bold #AB70FF]欢迎使用音·创独立转换器", characters="=", style="#26E2FF")
|
MainConsole.rule(title="[bold #AB70FF]欢迎使用音·创独立转换器", characters="=", style="#26E2FF")
|
||||||
MainConsole.rule(
|
MainConsole.rule(
|
||||||
title="[bold #AB70FF]Welcome to Independent Musicreater Convernter", characters="-"
|
title="[bold #AB70FF]Welcome to Independent Musicreater Convernter", characters="-"
|
||||||
)
|
)
|
||||||
|
|
||||||
import random
|
|
||||||
|
|
||||||
|
# 显示箴言部分
|
||||||
MainConsole.print(
|
MainConsole.print(
|
||||||
"[#121110 on #F0F2F4]"
|
"[#121110 on #F0F2F4]"
|
||||||
+ random.choice(
|
+ random.choice(
|
||||||
@ -150,12 +137,12 @@ MainConsole.print(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
from typing import Any, Optional, TextIO, Literal
|
from typing import Any, Literal, Optional, TextIO
|
||||||
|
|
||||||
JustifyMethod = Literal["default", "left", "center", "right", "full"]
|
JustifyMethod = Literal["default", "left", "center", "right", "full"]
|
||||||
OverflowMethod = Literal["fold", "crop", "ellipsis", "ignore"]
|
OverflowMethod = Literal["fold", "crop", "ellipsis", "ignore"]
|
||||||
|
|
||||||
|
# 高级的打印函数
|
||||||
def prt(
|
def prt(
|
||||||
*objects: Any,
|
*objects: Any,
|
||||||
sep: str = " ",
|
sep: str = " ",
|
||||||
@ -211,7 +198,7 @@ def prt(
|
|||||||
|
|
||||||
prt(f"{_('LangChd')}{_(':')}{_(currentLang)}")
|
prt(f"{_('LangChd')}{_(':')}{_(currentLang)}")
|
||||||
|
|
||||||
|
# 高级的输入函数
|
||||||
def ipt(
|
def ipt(
|
||||||
*objects: Any,
|
*objects: Any,
|
||||||
sep: str = " ",
|
sep: str = " ",
|
||||||
@ -275,14 +262,37 @@ def ipt(
|
|||||||
return MainConsole.input("", password=password, stream=stream)
|
return MainConsole.input("", password=password, stream=stream)
|
||||||
|
|
||||||
|
|
||||||
|
def formatipt(notice: str, fun, errnote: str = "", *extraArg):
|
||||||
|
'''循环输入,以某种格式
|
||||||
|
notice: 输入时的提示
|
||||||
|
fun: 格式函数
|
||||||
|
errnote: 输入不符格式时的提示
|
||||||
|
*extraArg: 对于函数的其他参数'''
|
||||||
|
while True:
|
||||||
|
result = ipt(notice)
|
||||||
|
try:
|
||||||
|
funresult = fun(result, *extraArg)
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
prt(errnote)
|
||||||
|
continue
|
||||||
|
return result, funresult
|
||||||
|
|
||||||
|
|
||||||
|
# 获取midi列表
|
||||||
while True:
|
while True:
|
||||||
midipath = ipt(f"{_('ChoosePath')}{_(':')}").lower()
|
midipath = ipt(f"{_('ChoosePath')}{_(':')}").lower()
|
||||||
if os.path.exists(midipath):
|
if os.path.exists(midipath):
|
||||||
if os.path.isfile(midipath):
|
if os.path.isfile(midipath):
|
||||||
midis = (midipath,)
|
midis = (midipath,)
|
||||||
elif os.path.isdir(midipath):
|
elif os.path.isdir(midipath):
|
||||||
midis = tuple((os.path.join(midipath,i) for i in os.listdir(midipath) if i.lower().endswith('.mid') or i.lower().endswith('.midi')))
|
midis = tuple(
|
||||||
|
(
|
||||||
|
os.path.join(midipath, i)
|
||||||
|
for i in os.listdir(midipath)
|
||||||
|
if i.lower().endswith('.mid') or i.lower().endswith('.midi')
|
||||||
|
)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
prt(f"{_('ErrEnter')}{_(',')}{_('Re-Enter')}{_('.')}")
|
prt(f"{_('ErrEnter')}{_(',')}{_('Re-Enter')}{_('.')}")
|
||||||
continue
|
continue
|
||||||
@ -291,23 +301,23 @@ while True:
|
|||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# 获取输出地址
|
||||||
|
outpath = formatipt(
|
||||||
|
f"{_('ChooseOutPath')}{_(':')}",
|
||||||
|
os.path.exists,
|
||||||
|
f"{_('FileNotFound')}{_(',')}{_('Re-Enter')}{_('.')}",
|
||||||
|
).lower()
|
||||||
|
|
||||||
|
|
||||||
|
# 选择输出格式
|
||||||
while True:
|
while True:
|
||||||
fileFormat = ipt(f"{_('ChooseFileFormat')}{_(':')}").lower()
|
fileFormat = ipt(f"{_('ChooseFileFormat')}{_(':')}").lower()
|
||||||
if fileFormat in ('0', 'mcpack'):
|
if fileFormat in ('0', 'mcpack'):
|
||||||
fileFormat = 0
|
fileFormat = 0
|
||||||
|
prt(_("EnterArgs"))
|
||||||
if len(midis) > 1:
|
if len(midis) > 1:
|
||||||
while True:
|
prt(_("noteofArgs"))
|
||||||
isFirstArgs = ipt(f"{_('WhetherArgEntering')}{_(':')}").lower()
|
|
||||||
if isFirstArgs in ('0','否'):
|
|
||||||
isFirstArgs = 0
|
|
||||||
elif isFirstArgs in ('1','是'):
|
|
||||||
isFirstArgs = 1
|
|
||||||
else:
|
|
||||||
prt(f"{_('ErrEnter')}{_(',')}{_('Re-Enter')}{_('.')}")
|
|
||||||
continue
|
|
||||||
break
|
|
||||||
elif fileFormat in ('1', 'bdx'):
|
elif fileFormat in ('1', 'bdx'):
|
||||||
fileFormat = 1
|
fileFormat = 1
|
||||||
while True:
|
while True:
|
||||||
@ -330,6 +340,4 @@ if fileFormat == 0:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MainConsole.input()
|
MainConsole.input()
|
||||||
|
@ -4,34 +4,23 @@
|
|||||||
# 音·创 开发交流群 861684859
|
# 音·创 开发交流群 861684859
|
||||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||||
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
||||||
# 若需转载或借鉴 请依照 Apache 2.0 许可证进行许可
|
# 若需转载或借鉴 许可声明请查看仓库目录下的 Lisence.md
|
||||||
|
|
||||||
|
|
||||||
__version__ = '0.0.1'
|
__version__ = '0.1.0'
|
||||||
__all__ = []
|
__all__ = []
|
||||||
__author__ = (('金羿', 'Eilles Wan'), ('诸葛亮与八卦阵', 'bgArray'), ('鸣凤鸽子', 'MingFengPigeon'))
|
__author__ = (('金羿', 'Eilles Wan'), ('诸葛亮与八卦阵', 'bgArray'), ('鸣凤鸽子', 'MingFengPigeon'))
|
||||||
|
|
||||||
"""
|
"""
|
||||||
音·创 库版 (Musicreater Package Version)
|
音·创 库版 (Musicreater Package Version)
|
||||||
是一款免费开源的针对《我的世界:基岩版》的midi音乐转换库
|
是一款免费开源的针对《我的世界:基岩版》的midi音乐转换库
|
||||||
注意!除了此源文件以外,任何属于此仓库以及此项目的文件均依照Apache许可证进行许可
|
|
||||||
Musicreater pkgver (Package Version 音·创 库版)
|
Musicreater pkgver (Package Version 音·创 库版)
|
||||||
A free open source library used for convert midi file into formats that is suitable for **Minecraft: Bedrock Edition**.
|
A free open source library used for convert midi file into formats that is suitable for **Minecraft: Bedrock Edition**.
|
||||||
Note! Except for this source file, all the files in this repository and this project are licensed under Apache License 2.0
|
|
||||||
|
|
||||||
Copyright © 2022 all the developers of Musicreater
|
Copyright 2023 all the developers of Musicreater
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the 'License');
|
开源相关声明请见 ../Lisence.md
|
||||||
you may not use this file except in compliance with the License.
|
Terms & Conditions: ../Lisence.md
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an 'AS IS' BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -40,3 +29,6 @@ from .main import *
|
|||||||
|
|
||||||
print('此Midi转换功能由音·创开发者开发,版权归参与开发的人员共同所有。')
|
print('此Midi转换功能由音·创开发者开发,版权归参与开发的人员共同所有。')
|
||||||
print('Copyright © 2022 all the developers of Musicreater')
|
print('Copyright © 2022 all the developers of Musicreater')
|
||||||
|
print("小贴:不妨试试Mid-BDX转换网页:在线的多功能Midi转换器")
|
||||||
|
print("https://dislink.github.io/midi2bdx/")
|
||||||
|
|
||||||
|
@ -4,30 +4,19 @@
|
|||||||
# 音·创 开发交流群 861684859
|
# 音·创 开发交流群 861684859
|
||||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||||
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
||||||
# 若需使用或借鉴 请依照 Apache 2.0 许可证进行许可
|
# 若需转载或借鉴 许可声明请查看仓库目录下的 Lisence.md
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
音·创 库版 (Musicreater Package Version)
|
音·创 库版 (Musicreater Package Version)
|
||||||
是一款免费开源的针对《我的世界:基岩版》的midi音乐转换库
|
是一款免费开源的针对《我的世界:基岩版》的midi音乐转换库
|
||||||
注意!除了此源文件以外,任何属于此仓库以及此项目的文件均依照Apache许可证进行许可
|
|
||||||
Musicreater pkgver (Package Version 音·创 库版)
|
Musicreater pkgver (Package Version 音·创 库版)
|
||||||
A free open source library used for convert midi file into formats that is suitable for **Minecraft: Bedrock Edition**.
|
A free open source library used for convert midi file into formats that is suitable for **Minecraft: Bedrock Edition**.
|
||||||
Note! Except for this source file, all the files in this repository and this project are licensed under Apache License 2.0
|
|
||||||
|
|
||||||
Copyright 2022 all the developers of Musicreater
|
Copyright 2023 all the developers of Musicreater
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the 'License');
|
开源相关声明请见 ../Lisence.md
|
||||||
you may not use this file except in compliance with the License.
|
Terms & Conditions: ../Lisence.md
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an 'AS IS' BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,30 +4,19 @@
|
|||||||
# 音·创 开发交流群 861684859
|
# 音·创 开发交流群 861684859
|
||||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||||
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
||||||
# 若需使用或借鉴 请依照 Apache 2.0 许可证进行许可
|
# 若需转载或借鉴 许可声明请查看仓库目录下的 Lisence.md
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
音·创 库版 (Musicreater Package Version)
|
音·创 库版 (Musicreater Package Version)
|
||||||
是一款免费开源的针对《我的世界:基岩版》的midi音乐转换库
|
是一款免费开源的针对《我的世界:基岩版》的midi音乐转换库
|
||||||
注意!除了此源文件以外,任何属于此仓库以及此项目的文件均依照Apache许可证进行许可
|
|
||||||
Musicreater pkgver (Package Version 音·创 库版)
|
Musicreater pkgver (Package Version 音·创 库版)
|
||||||
A free open source library used for convert midi file into formats that is suitable for **Minecraft: Bedrock Edition**.
|
A free open source library used for convert midi file into formats that is suitable for **Minecraft: Bedrock Edition**.
|
||||||
Note! Except for this source file, all the files in this repository and this project are licensed under Apache License 2.0
|
|
||||||
|
|
||||||
Copyright 2022 all the developers of Musicreater
|
Copyright 2023 all the developers of Musicreater
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the 'License');
|
开源相关声明请见 ../Lisence.md
|
||||||
you may not use this file except in compliance with the License.
|
Terms & Conditions: ../Lisence.md
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an 'AS IS' BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -64,7 +53,9 @@ def makeZip(sourceDir, outFilename, compression=8, exceptFile=None):
|
|||||||
|
|
||||||
|
|
||||||
class SingleNote:
|
class SingleNote:
|
||||||
def __init__(self, instrument: int, pitch: int, velocity, startTime, lastTime):
|
def __init__(
|
||||||
|
self, instrument: int, pitch: int, velocity, startTime: int, lastTime: int
|
||||||
|
):
|
||||||
"""用于存储单个音符的类
|
"""用于存储单个音符的类
|
||||||
:param instrument 乐器编号
|
:param instrument 乐器编号
|
||||||
:param pitch 音符编号
|
:param pitch 音符编号
|
||||||
@ -73,17 +64,24 @@ class SingleNote:
|
|||||||
注:此处的时间是用从乐曲开始到当前的毫秒数
|
注:此处的时间是用从乐曲开始到当前的毫秒数
|
||||||
:param lastTime 音符延续时间(ms)"""
|
:param lastTime 音符延续时间(ms)"""
|
||||||
self.instrument = instrument
|
self.instrument = instrument
|
||||||
|
'''乐器编号'''
|
||||||
self.note = pitch
|
self.note = pitch
|
||||||
|
'''音符编号'''
|
||||||
self.velocity = velocity
|
self.velocity = velocity
|
||||||
|
'''力度/响度'''
|
||||||
self.startTime = startTime
|
self.startTime = startTime
|
||||||
|
'''开始之时 ms'''
|
||||||
self.lastTime = lastTime
|
self.lastTime = lastTime
|
||||||
|
'''音符持续时间 ms'''
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def inst(self):
|
def inst(self):
|
||||||
|
'''乐器编号'''
|
||||||
return self.instrument
|
return self.instrument
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pitch(self):
|
def pitch(self):
|
||||||
|
'''音符编号'''
|
||||||
return self.note
|
return self.note
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
@ -118,6 +116,21 @@ tempo * amount_of_beats => 毫秒数
|
|||||||
|
|
||||||
tempo * tick / ticks_per_beat => 毫秒数
|
tempo * tick / ticks_per_beat => 毫秒数
|
||||||
|
|
||||||
|
###########
|
||||||
|
|
||||||
|
seconds per tick:
|
||||||
|
(tempo / 1000000.0) / ticks_per_beat
|
||||||
|
|
||||||
|
seconds:
|
||||||
|
tick * tempo / 1000000.0 / ticks_per_beat
|
||||||
|
|
||||||
|
microseconds:
|
||||||
|
tick * tempo / 1000.0 / ticks_per_beat
|
||||||
|
|
||||||
|
gameticks:
|
||||||
|
tick * tempo / 1000000.0 / ticks_per_beat * 一秒多少游戏刻
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -161,7 +174,7 @@ class midiConvert:
|
|||||||
贝斯bass、迪吉里杜管didgeridoo的时候为8
|
贝斯bass、迪吉里杜管didgeridoo的时候为8
|
||||||
长笛flute、牛铃cou_bell的时候为5
|
长笛flute、牛铃cou_bell的时候为5
|
||||||
钟琴bell、管钟chime、木琴xylophone的时候为4
|
钟琴bell、管钟chime、木琴xylophone的时候为4
|
||||||
而存在一些打击乐器basedrum、hat、snare,没有音域,则没有X,那么我们返回7即可
|
而存在一些打击乐器bd(basedrum)、hat、snare,没有音域,则没有X,那么我们返回7即可
|
||||||
:param instrumentID: midi的乐器ID
|
:param instrumentID: midi的乐器ID
|
||||||
default: 如果instrumentID不在范围内,返回的默认我的世界乐器名称
|
default: 如果instrumentID不在范围内,返回的默认我的世界乐器名称
|
||||||
:return: (str我的世界乐器名, int转换算法中的X)"""
|
:return: (str我的世界乐器名, int转换算法中的X)"""
|
||||||
@ -283,23 +296,88 @@ class midiConvert:
|
|||||||
113: ("note.bell", 4),
|
113: ("note.bell", 4),
|
||||||
114: ("note.harp", 6),
|
114: ("note.harp", 6),
|
||||||
115: ("note.cow_bell", 5),
|
115: ("note.cow_bell", 5),
|
||||||
116: ("note.basedrum", 7), # 打击乐器无音域
|
116: ("note.bd", 7), # 打击乐器无音域
|
||||||
117: ("note.bass", 8),
|
117: ("note.bass", 8),
|
||||||
118: ("note.bit", 6),
|
118: ("note.bit", 6),
|
||||||
119: ("note.basedrum", 7), # 打击乐器无音域
|
119: ("note.bd", 7), # 打击乐器无音域
|
||||||
120: ("note.guitar", 7),
|
120: ("note.guitar", 7),
|
||||||
121: ("note.harp", 6),
|
121: ("note.harp", 6),
|
||||||
122: ("note.harp", 6),
|
122: ("note.harp", 6),
|
||||||
123: ("note.harp", 6),
|
123: ("note.harp", 6),
|
||||||
124: ("note.harp", 6),
|
124: ("note.harp", 6),
|
||||||
125: ("note.hat", 7), # 打击乐器无音域
|
125: ("note.hat", 7), # 打击乐器无音域
|
||||||
126: ("note.basedrum", 7), # 打击乐器无音域
|
126: ("note.bd", 7), # 打击乐器无音域
|
||||||
127: ("note.snare", 7), # 打击乐器无音域
|
127: ("note.snare", 7), # 打击乐器无音域
|
||||||
}[instrumentID]
|
}[instrumentID]
|
||||||
except BaseException:
|
except BaseException:
|
||||||
a = ("note.harp", 6)
|
a = ("note.flute", 5)
|
||||||
return a
|
return a
|
||||||
|
|
||||||
|
def __bitInst2IDwithX(self, instrumentID):
|
||||||
|
try:
|
||||||
|
try:
|
||||||
|
return {
|
||||||
|
34: ('note.bd', 7),
|
||||||
|
35: ('note.bd', 7),
|
||||||
|
36: ('note.hat', 7),
|
||||||
|
37: ('note.snare', 7),
|
||||||
|
38: ('note.snare', 7),
|
||||||
|
39: ('note.snare', 7),
|
||||||
|
40: ('note.hat', 7),
|
||||||
|
41: ('note.snare', 7),
|
||||||
|
42: ('note.hat', 7),
|
||||||
|
43: ('note.snare', 7),
|
||||||
|
44: ('note.snare', 7),
|
||||||
|
45: ('note.bell', 4),
|
||||||
|
46: ('note.snare', 7),
|
||||||
|
47: ('note.snare', 7),
|
||||||
|
48: ('note.bell', 4),
|
||||||
|
49: ('note.hat', 7),
|
||||||
|
50: ('note.bell', 4),
|
||||||
|
51: ('note.bell', 4),
|
||||||
|
52: ('note.bell', 4),
|
||||||
|
53: ('note.bell', 4),
|
||||||
|
54: ('note.bell', 4),
|
||||||
|
55: ('note.bell', 4),
|
||||||
|
56: ('note.snare', 7),
|
||||||
|
57: ('note.hat', 7),
|
||||||
|
58: ('note.chime', 4),
|
||||||
|
59: ('note.iron_xylophone', 6),
|
||||||
|
60: ('note.bd', 7),
|
||||||
|
61: ('note.bd', 7),
|
||||||
|
62: ('note.xylophone', 4),
|
||||||
|
63: ('note.xylophone', 4),
|
||||||
|
64: ('note.xylophone', 4),
|
||||||
|
65: ('note.hat', 7),
|
||||||
|
66: ('note.bell', 4),
|
||||||
|
67: ('note.bell', 4),
|
||||||
|
68: ('note.hat', 7),
|
||||||
|
69: ('note.hat', 7),
|
||||||
|
70: ('note.flute', 5),
|
||||||
|
71: ('note.flute', 5),
|
||||||
|
72: ('note.hat', 7),
|
||||||
|
73: ('note.hat', 7),
|
||||||
|
74: ('note.xylophone', 4),
|
||||||
|
75: ('note.hat', 7),
|
||||||
|
76: ('note.hat', 7),
|
||||||
|
77: ('note.xylophone', 4),
|
||||||
|
78: ('note.xylophone', 4),
|
||||||
|
79: ('note.bell', 4),
|
||||||
|
80: ('note.bell', 4),
|
||||||
|
}[instrumentID]
|
||||||
|
except:
|
||||||
|
return ("note.bd", 7)
|
||||||
|
except:
|
||||||
|
print("WARN", "无法导入打击乐器列表动态链接库,可能是不支持当前及其环境,打击乐器使用Dislink算法代替。")
|
||||||
|
if instrumentID == 55:
|
||||||
|
return ("note.cow_bell", 5)
|
||||||
|
elif instrumentID in [41, 43, 45]:
|
||||||
|
return ("note.hat", 7)
|
||||||
|
elif instrumentID in [36, 37, 39]:
|
||||||
|
return ("note.snare", 7)
|
||||||
|
else:
|
||||||
|
return ("note.bd", 7)
|
||||||
|
|
||||||
def __score2time(self, score: int):
|
def __score2time(self, score: int):
|
||||||
return str(int(int(score / 20) / 60)) + ":" + str(int(int(score / 20) % 60))
|
return str(int(int(score / 20) / 60)) + ":" + str(int(int(score / 20) % 60))
|
||||||
|
|
||||||
@ -518,35 +596,38 @@ class midiConvert:
|
|||||||
except NameError:
|
except NameError:
|
||||||
raise NotDefineTempoError("计算当前分数时出错 未定义参量 Tempo")
|
raise NotDefineTempoError("计算当前分数时出错 未定义参量 Tempo")
|
||||||
maxscore = max(maxscore, nowscore)
|
maxscore = max(maxscore, nowscore)
|
||||||
|
if msg.channel == 9:
|
||||||
|
soundID, _X = self.__bitInst2IDwithX(instrumentID)
|
||||||
|
else:
|
||||||
soundID, _X = self.__Inst2soundIDwithX(instrumentID)
|
soundID, _X = self.__Inst2soundIDwithX(instrumentID)
|
||||||
|
|
||||||
# /playsound <sound: string> [player: target] [position: x y z]
|
# /playsound <sound: string> [player: target] [position: x y z]
|
||||||
# [volume: float] [pitch: float] [minimumVolume: float]
|
# [volume: float] [pitch: float] [minimumVolume: float]
|
||||||
|
|
||||||
volume_d = 1 / volume - 1
|
# volume_d = 1 / volume - 1
|
||||||
if volume_d == 0.0:
|
# if volume_d == 0.0:
|
||||||
volume_d = ""
|
# volume_d = ""
|
||||||
command_now = "playsound {0} @a[scores={{{1}}}] ~ ~{2} ~ {3} {4}" \
|
# command_now = "playsound {0} @a[scores={{{1}}}] ~ ~{2} ~ {3} {4}" \
|
||||||
.format(soundID, "{}={}".format(scoreboardname,
|
# .format(soundID, "{}={}".format(scoreboardname,
|
||||||
nowscore), volume_d,
|
# nowscore), volume_d,
|
||||||
msg.velocity, 2 ** ((msg.note - 60 - _X) / 12))
|
# msg.velocity, 2 ** ((msg.note - 60 - _X) / 12))
|
||||||
singleTrack.append(command_now)
|
# singleTrack.append(command_now)
|
||||||
# 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} ~ "
|
+ f"] ~ ~ ~ playsound {soundID} @s ~ ~{1 / volume - 1} ~ "
|
||||||
# f"{msg.velocity * (0.7 if msg.channel == 0 else 0.9)} {2 ** ((msg.note - 60 - _X) / 12)}"
|
f"{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]
|
||||||
|
|
||||||
# 这与上面的算法几乎没有差别 甚至更慢了一点 但是是为了线性插值做准备
|
# 原本这个算法的转换效果应该和上面的算法相似的
|
||||||
def _toCmdList_m2(
|
def _toCmdList_m2(
|
||||||
self,
|
self,
|
||||||
scoreboardname: str = "mscplay",
|
scoreboardname: str = "mscplay",
|
||||||
@ -639,8 +720,12 @@ class midiConvert:
|
|||||||
|
|
||||||
if channels.index(track) == 0:
|
if channels.index(track) == 0:
|
||||||
CheckFirstChannel = True
|
CheckFirstChannel = True
|
||||||
|
SpecialBits = False
|
||||||
|
elif channels.index(track) == 9:
|
||||||
|
SpecialBits = True
|
||||||
else:
|
else:
|
||||||
CheckFirstChannel = False
|
CheckFirstChannel = False
|
||||||
|
SpecialBits = False
|
||||||
|
|
||||||
nowTrack = []
|
nowTrack = []
|
||||||
|
|
||||||
@ -651,6 +736,9 @@ class midiConvert:
|
|||||||
|
|
||||||
elif msg[0] == "NoteS":
|
elif msg[0] == "NoteS":
|
||||||
|
|
||||||
|
if SpecialBits:
|
||||||
|
soundID, _X = self.__bitInst2IDwithX(InstID)
|
||||||
|
else:
|
||||||
soundID, _X = self.__Inst2soundIDwithX(InstID)
|
soundID, _X = self.__Inst2soundIDwithX(InstID)
|
||||||
score_now = round(msg[-1] / float(speed) / 50000)
|
score_now = round(msg[-1] / float(speed) / 50000)
|
||||||
maxScore = max(maxScore, score_now)
|
maxScore = max(maxScore, score_now)
|
||||||
@ -670,11 +758,7 @@ class midiConvert:
|
|||||||
|
|
||||||
return [tracks, cmdAmount, maxScore]
|
return [tracks, cmdAmount, maxScore]
|
||||||
|
|
||||||
# 这才是加了线性插值的算法
|
# 简单的单音填充
|
||||||
# 此算法有巨大问题
|
|
||||||
# 暂时无法使用
|
|
||||||
# 已经经过验证 需要再次修改
|
|
||||||
# 等一段时间后我来通知
|
|
||||||
def _toCmdList_m3(
|
def _toCmdList_m3(
|
||||||
self,
|
self,
|
||||||
scoreboardname: str = "mscplay",
|
scoreboardname: str = "mscplay",
|
||||||
@ -682,7 +766,7 @@ class midiConvert:
|
|||||||
speed: float = 1.0,
|
speed: float = 1.0,
|
||||||
) -> list:
|
) -> list:
|
||||||
"""
|
"""
|
||||||
使用金羿的转换思路,将midi转换为我的世界命令列表,并使用线性插值算法优化音量
|
使用金羿的转换思路,将midi转换为我的世界命令列表,并使用完全填充算法优化音感
|
||||||
:param scoreboardname: 我的世界的计分板名称
|
:param scoreboardname: 我的世界的计分板名称
|
||||||
:param MaxVolume: 音量,注意:这里的音量范围为(0,1],如果超出将被处理为正确值,其原理为在距离玩家 (1 / volume -1) 的地方播放音频
|
:param MaxVolume: 音量,注意:这里的音量范围为(0,1],如果超出将被处理为正确值,其原理为在距离玩家 (1 / volume -1) 的地方播放音频
|
||||||
:param speed: 速度,注意:这里的速度指的是播放倍率,其原理为在播放音频的时候,每个音符的播放时间除以 speed
|
:param speed: 速度,注意:这里的速度指的是播放倍率,其原理为在播放音频的时候,每个音符的播放时间除以 speed
|
||||||
@ -799,11 +883,18 @@ class midiConvert:
|
|||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
totalCount = int(note.lastTime / 500000)
|
totalCount = int(note.lastTime / 500)
|
||||||
|
|
||||||
for i in range(totalCount):
|
for i in range(totalCount):
|
||||||
result.append((note.startTime + i * 500000, note.instrument, note.pitch, note.velocity,
|
result.append(
|
||||||
MaxVolume * ((totalCount - i) / totalCount)))
|
(
|
||||||
|
note.startTime + i * 500,
|
||||||
|
note.instrument,
|
||||||
|
note.pitch,
|
||||||
|
note.velocity,
|
||||||
|
MaxVolume * ((totalCount - i) / totalCount),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -815,8 +906,12 @@ class midiConvert:
|
|||||||
|
|
||||||
if note_channels.index(track) == 0:
|
if note_channels.index(track) == 0:
|
||||||
CheckFirstChannel = True
|
CheckFirstChannel = True
|
||||||
|
SpecialBits = False
|
||||||
|
elif note_channels.index(track) == 9:
|
||||||
|
SpecialBits = True
|
||||||
else:
|
else:
|
||||||
CheckFirstChannel = False
|
CheckFirstChannel = False
|
||||||
|
SpecialBits = False
|
||||||
|
|
||||||
nowTrack = []
|
nowTrack = []
|
||||||
|
|
||||||
@ -826,11 +921,12 @@ class midiConvert:
|
|||||||
# 应该是计算的时候出了点小问题
|
# 应该是计算的时候出了点小问题
|
||||||
# 我们应该用一个MC帧作为时间单位而不是半秒
|
# 我们应该用一个MC帧作为时间单位而不是半秒
|
||||||
|
|
||||||
soundID, _X = self.__Inst2soundIDwithX(everynote[1])
|
if SpecialBits:
|
||||||
|
soundID, _X = self.__bitInst2IDwithX(InstID)
|
||||||
|
else:
|
||||||
|
soundID, _X = self.__Inst2soundIDwithX(InstID)
|
||||||
|
|
||||||
score_now = round(
|
score_now = round(everynote[0] / speed / 50000)
|
||||||
everynote[0] / speed / 50000
|
|
||||||
)
|
|
||||||
|
|
||||||
maxScore = max(maxScore, score_now)
|
maxScore = max(maxScore, score_now)
|
||||||
|
|
||||||
@ -1184,17 +1280,20 @@ class midiConvert:
|
|||||||
:param isAutoReset: 是否自动重置计分板
|
:param isAutoReset: 是否自动重置计分板
|
||||||
:return 成功与否,成功返回(True,未经过压缩的源,结构占用大小),失败返回(False,str失败原因)
|
:return 成功与否,成功返回(True,未经过压缩的源,结构占用大小),失败返回(False,str失败原因)
|
||||||
"""
|
"""
|
||||||
try:
|
# try:
|
||||||
cmdlist, totalcount, maxScore = self.methods[method - 1](
|
cmdlist, totalcount, maxScore = self.methods[method - 1](
|
||||||
scoreboardname, volume, speed
|
scoreboardname, volume, speed
|
||||||
)
|
)
|
||||||
except:
|
# except Exception as E:
|
||||||
return (False, f"无法找到算法ID{method}对应的转换算法")
|
# return (False, f"无法找到算法ID{method}对应的转换算法: {E}")
|
||||||
|
|
||||||
if not os.path.exists(self.outputPath):
|
if not os.path.exists(self.outputPath):
|
||||||
os.makedirs(self.outputPath)
|
os.makedirs(self.outputPath)
|
||||||
|
|
||||||
with open(os.path.abspath(os.path.join(self.outputPath, f"{self.midFileName}.bdx")), "w+") as f:
|
with open(
|
||||||
|
os.path.abspath(os.path.join(self.outputPath, f"{self.midFileName}.bdx")),
|
||||||
|
"w+",
|
||||||
|
) as f:
|
||||||
f.write("BD@")
|
f.write("BD@")
|
||||||
|
|
||||||
_bytes = (
|
_bytes = (
|
||||||
@ -1293,10 +1392,13 @@ class midiConvert:
|
|||||||
|
|
||||||
_bytes += key[y][int(yforward)]
|
_bytes += key[y][int(yforward)]
|
||||||
|
|
||||||
with open(os.path.abspath(os.path.join(self.outputPath, f"{self.midFileName}.bdx")), "ab+") as f:
|
with open(
|
||||||
|
os.path.abspath(os.path.join(self.outputPath, f"{self.midFileName}.bdx")),
|
||||||
|
"ab+",
|
||||||
|
) as f:
|
||||||
f.write(brotli.compress(_bytes + b"XE"))
|
f.write(brotli.compress(_bytes + b"XE"))
|
||||||
|
|
||||||
return (True, _bytes, (nowx, maxheight, _sideLength))
|
return (True, totalcount, maxScore, _bytes, (nowx, maxheight, _sideLength))
|
||||||
|
|
||||||
def toBDXfile_withDelay(
|
def toBDXfile_withDelay(
|
||||||
self,
|
self,
|
||||||
@ -1330,7 +1432,10 @@ class midiConvert:
|
|||||||
if not os.path.exists(self.outputPath):
|
if not os.path.exists(self.outputPath):
|
||||||
os.makedirs(self.outputPath)
|
os.makedirs(self.outputPath)
|
||||||
|
|
||||||
with open(os.path.abspath(os.path.join(self.outputPath, f"{self.midFileName}.bdx")), "w+") as f:
|
with open(
|
||||||
|
os.path.abspath(os.path.join(self.outputPath, f"{self.midFileName}.bdx")),
|
||||||
|
"w+",
|
||||||
|
) as f:
|
||||||
f.write("BD@")
|
f.write("BD@")
|
||||||
|
|
||||||
_bytes = (
|
_bytes = (
|
||||||
@ -1405,11 +1510,15 @@ class midiConvert:
|
|||||||
|
|
||||||
_bytes += key[y][int(yforward)]
|
_bytes += key[y][int(yforward)]
|
||||||
|
|
||||||
with open(os.path.abspath(os.path.join(self.outputPath, f"{self.midFileName}.bdx")), "ab+") as f:
|
with open(
|
||||||
|
os.path.abspath(os.path.join(self.outputPath, f"{self.midFileName}.bdx")),
|
||||||
|
"ab+",
|
||||||
|
) as f:
|
||||||
f.write(brotli.compress(_bytes + b"XE"))
|
f.write(brotli.compress(_bytes + b"XE"))
|
||||||
|
|
||||||
return (True, _bytes, (nowx, maxheight, _sideLength))
|
return (True, _bytes, (nowx, maxheight, _sideLength))
|
||||||
|
|
||||||
|
|
||||||
# def isProgressBar(pgbarLike:str):
|
# def isProgressBar(pgbarLike:str):
|
||||||
# '''判断所输入数据是否为进度条式样数据
|
# '''判断所输入数据是否为进度条式样数据
|
||||||
# 注意,使用本函数时不得直接放在 if 后,正确用法如下:
|
# 注意,使用本函数时不得直接放在 if 后,正确用法如下:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user