mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2025-02-07 19:36:46 +08:00
文档改动
This commit is contained in:
parent
bd031ef547
commit
b3ddfc7ade
@ -321,23 +321,23 @@ class MusicSequence:
|
||||
bytes_buffer = (
|
||||
b"MSQ@"
|
||||
+ (
|
||||
(len(r := self.music_name.encode("GB18030")) << 10)
|
||||
+ round(self.minimum_volume * 1000)
|
||||
(len(r := self.music_name.encode("GB18030")) << 10) # 音乐名称长度
|
||||
+ round(self.minimum_volume * 1000) # 最小音量
|
||||
).to_bytes(2, "big")
|
||||
+ (
|
||||
(
|
||||
(
|
||||
(high_time_precision << 1)
|
||||
+ (1 if (k := round(self.music_deviation * 1000)) < 0 else 0)
|
||||
(high_time_precision << 1) # 是否启用“高精度”音符时间控制
|
||||
+ (1 if (k := round(self.music_deviation * 1000)) < 0 else 0) # 总音调偏移的正负位
|
||||
)
|
||||
<< 14
|
||||
)
|
||||
+ abs(k)
|
||||
+ abs(k) # 总音调偏移
|
||||
).to_bytes(2, "big", signed=False)
|
||||
+ r
|
||||
)
|
||||
|
||||
# 若启用“高精度”,则在每个音符前添加一个字节,用于存储音符时间控制精度偏移
|
||||
# 若启用“高精度”,则每个音符皆添加一个字节,用于存储音符时间控制精度偏移
|
||||
# 此值每增加 1,则音符向后播放时长增加 1/1250 秒
|
||||
for channel_index, note_list in self.channels.items():
|
||||
bytes_buffer += len(note_list).to_bytes(4, "big")
|
||||
|
@ -73,7 +73,7 @@
|
||||
|
||||
**诸葛亮与八卦阵 bgArray**:我的世界基岩版玩家,喜欢编程和音乐,深圳学生。
|
||||
|
||||
**偷吃不是Touch Touch**:我的世界基岩版指令师,提供 BDX 导入测试支持
|
||||
**偷吃不是Touch Touch**:我的世界基岩版指令制作者,提供测试支持
|
||||
|
||||
## 致谢 🙏
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
- 感谢 **指令师\_苦力怕 playjuice123**\<QQ240667197\> 为我们的程序找出错误,并提醒我们修复一个一直存在的大 bug。
|
||||
- 感谢 **雷霆**\<QQ3555268519\> 用他那令所有开发者都大为光火的操作方法为我们的程序找出错误,并提醒修复 bug。
|
||||
- 感谢 **小埋**\<QQ2039310975\> 反馈附加包生成时缺少描述和标题的问题。
|
||||
- <table><tr><td>感谢 **油炸**\<QQ2836146704\> 激励我们不断开发新的内容。</td><td><img height="50" src="https://foruda.gitee.com/images/1695478907647543027/08ea9909_9911226.jpeg"></td></tr></table>
|
||||
- <table><tr><td>感谢 **油炸**<QQ2836146704> 激励我们不断开发新的内容。</td><td><img height="50" src="https://foruda.gitee.com/images/1695478907647543027/08ea9909_9911226.jpeg"></td></tr></table>
|
||||
- 感谢 **雨**\<QQ237667809\> 反馈在新版本的指令格式下,计分板播放器的附加包无法播放的问题。
|
||||
|
||||
> 感谢广大群友为此库提供的测试和建议等
|
||||
|
12
README_EN.md
12
README_EN.md
@ -73,7 +73,7 @@ Commands such as `python`、`pip` could be changed to some like `python3` or `pi
|
||||
|
||||
**bgArray (诸葛亮与八卦阵)**: A student, player of _Minecraft: Bedrock Edition_, which is a fan of music and programming.
|
||||
|
||||
**Touch (偷吃不是Touch)**: A man who is good at using command(s) in _Minecraft: Bedrock Edition_, who supported us of debugging and testing program and algorithm
|
||||
**Touch (偷吃不是 Touch)**: A man who is good at using command(s) in _Minecraft: Bedrock Edition_, who supported us of debugging and testing program and algorithm
|
||||
|
||||
## Acknowledgements 🙏
|
||||
|
||||
@ -86,11 +86,11 @@ This list is not in any order.
|
||||
- Thank _Mono_\<QQ738893087\> for reporting problems while installing
|
||||
- Thank _Ammelia “艾米利亚”_\<QQ2838334637\> for urging us to develop new functions, and put forward a lot of excellent suggestions for new functions, as well as the BDX file's importing test support provided, which has given a lot of practical theoretical support for our new Structure Generating Algorithm
|
||||
- Thank _[神羽](https://gitee.com/snowykami) “[SnowyKami](https://github.com/snowyfirefly)”_ for supporting and promoting our project, and also thanks him for his server which given us to use for free.
|
||||
- Thank **指令师\_苦力怕 playjuice123**\<QQ240667197\> for finding bugs within our code, and noticed us to repair a big problem.
|
||||
- Thank **雷霆**\<QQ3555268519\> for his annoying and provoking operations which may awake some problems within the program by chance and reminding us to repair.
|
||||
- Thank **小埋**\<QQ2039310975\> for reporting the empty add-on packs title and description problem.
|
||||
- <table><tr><td>Thank **油炸**\<QQ2836146704\> for inspiring us to constantly develop something new.</td><td><img width="260" src="https://foruda.gitee.com/images/1695478907647543027/08ea9909_9911226.jpeg" alt="The groupmate on the picture was saying that our convert-QQ-bot had once brought him great convinience but now it closed down by some reason so he was feeling regretful." title=""It was once, a convert-QQ-bot is just in front my eyes" "Until lose, I finally know cannot chase back what I needs""></td><td><small>"It was once, a convert-QQ-bot is just in front my eyes"<br>"Until lose, I finally know cannot chase back what I needs"</small></td></tr></table>
|
||||
- Thank **雨**\<QQ237667809\> for give us report that under the new `execute` command format that the scoreboard player's add-on packs cannot play correctly.
|
||||
- Thank _指令师\_苦力怕 “playjuice123”_\<QQ240667197\> for finding bugs within our code, and noticed us to repair a big problem.
|
||||
- Thank _雷霆_\<QQ3555268519\> for his annoying and provoking operations which may awake some problems within the program by chance and reminding us to repair.
|
||||
- Thank _小埋_\<QQ2039310975\> for reporting the empty add-on packs title and description problem.
|
||||
- <table><tr><td>Thank <i>油炸</i> <QQ2836146704> for inspiring us to constantly develop something new.</td><td><img width="260" src="https://foruda.gitee.com/images/1695478907647543027/08ea9909_9911226.jpeg" alt="The groupmate on the picture was saying that our convert-QQ-bot had once brought him great convinience but now it closed down by some reason so he was feeling regretful." title=""It was once, a convert-QQ-bot is just in front my eyes" "Until lose, I finally know cannot chase back what I needs""></td><td><small>"It was once, a convert-QQ-bot is just in front my eyes"<br>"Until lose, I finally know cannot chase back what I needs"</small></td></tr></table>
|
||||
- Thank _雨_\<QQ237667809\> for give us report that under the new `execute` command format that the scoreboard player's add-on packs cannot play correctly.
|
||||
|
||||
> Thanks for the support and help of a lot of groupmates
|
||||
>
|
||||
|
42
docs/MSQ文件格式.md
Normal file
42
docs/MSQ文件格式.md
Normal file
@ -0,0 +1,42 @@
|
||||
# MSQ 文件格式
|
||||
|
||||
MSQ 文件是 音·创 存储音符序列的一种格式,取自 MusicSeQuence。
|
||||
|
||||
## MSQ 第二版
|
||||
|
||||
第二版的码头是 MSQ@ ,这一版中,所有的**字符串**以 _**GB18030**_ 编码进行编解码,**数值**以**_大端序_**存储。
|
||||
|
||||
码头是文件前四个字节的内容,这一部分内容是可读的 ASCII 字串。因此,第二版的文件前四个字节的内容必为 MSQ@。
|
||||
|
||||
取 MSQ@ 是因为美式键盘上 @ 是 Shift+2 键 按下取得的,故代表 MSQ 第二版。
|
||||
|
||||
### 元信息
|
||||
|
||||
| 信息名称 | 西文代号 | 位长(多少个 0 或 1) | 支持说明 |
|
||||
| ------------------------------ | -------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **音乐名称长度** | music_name_length | 6 位 | 支持数值 0~63 |
|
||||
| **最小音量** | minimum_volume | 10 位 | 支持数值 0~1023,注意,这里每个 1 代表最小音量的 0.001 个单位,即取值是此处表示数字的千分倍 |
|
||||
| **是否启用高精度音符时间控制** | enable_high_precision_time | 1 位 | 1 是启用,反之同理 |
|
||||
| **总音调偏移** | music_deviation | 15 位 | 支持数值 -16383~16383,这里也是表示三位小数的,和最小音量一样。这里 15 位中的第一位(从左往右)是正负标记,若为 1 则为负数,反之为正数,后面的 14 位是数值 |
|
||||
| **音乐名称** | music_name | 依据先前定义 | 最多可支持 31 个中文字符 或 63 个西文字符,其长度取决于先前获知的 “音乐名称长度” 的定义 |
|
||||
|
||||
在这一元信息中,**音乐名称长度**和**最小音量**合计共 2 字节;**高精度音符时间控制启用**和**总音调偏移**合计共 2 字节;因此,除**音乐名称**为任意长度,前四字节内容均为固定。
|
||||
|
||||
### 音符序列
|
||||
|
||||
每个序列前 4 字节为一个用以表示当前通道中音符数量的值,也就是**通道音符数**(notes_count)。也即是说,一个通道内的音符可以是 0~4294967295 个。
|
||||
|
||||
在这之后,就是这些数量的音符了,其中每个音符的信息存储方式如下
|
||||
|
||||
| 信息名称 | 西文代号 | 位长 | 支持说明 |
|
||||
| ---------------------------- | ------------------------ | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **乐器名称长度** | name_length | 6 位 | 支持数值 0~63 |
|
||||
| **Midi 音高** | note_pitch | 7 位 | 支持数值 0~127 |
|
||||
| **开始时刻** | start_tick | 17 位 | 单位 二十分之一秒,即约为 1 命令刻;支持数值 0~131071 即 109.22583 分钟 合 1.8204305 小时 |
|
||||
| **音符持续刻数** | duration | 17 位 | 同上 |
|
||||
| **是否作为打击乐器** | percussive | 1 位 | 1 是启用,反之同理 |
|
||||
| **响度(力度)** | velocity | 7 位 | 支持数值 0~127 |
|
||||
| **是否启用声像位移** | is_displacement_included | 1 位 | 1 是启用,反之同理 |
|
||||
| **时间精度提升值**(非必含) | high_time_precision | 8 位 | 支持数值 0~255,若在 元信息 中启用**高精度音符时间控制**,则此值启用,代表音符时间控制精度偏移,此值每增加 1,则音符开始时刻向后增加 1/1250 秒 |
|
||||
| **乐器名称** | sound_name | 依据先前定义 | 最多可支持 31 个中文字符 或 63 个西文字符,其长度取决于先前获知的 “乐器名称长度” 的定义 |
|
||||
| **声像位移**(非必含) | position_displacement | 共三个值,每个值 16 位 共 48 位 | 若前述**是否启用声像位移**已启用,则此值启用;三个值分别代表 x、y、z 轴上的便宜,每个值支持数值 0~65535,注意,这里每个 1 代表最小音量的 0.001 个单位,即取值是此处表示数字的千分倍 |
|
Loading…
x
Reference in New Issue
Block a user