文档改动

This commit is contained in:
EillesWan 2024-12-26 02:02:13 +08:00
parent bd031ef547
commit b3ddfc7ade
4 changed files with 78 additions and 36 deletions

View File

@ -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")

View File

@ -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>感谢 **油炸**&lt;QQ2836146704&gt; 激励我们不断开发新的内容</td><td><img height="50" src="https://foruda.gitee.com/images/1695478907647543027/08ea9909_9911226.jpeg"></td></tr></table>
- 感谢 ****\<QQ237667809\> 反馈在新版本的指令格式下计分板播放器的附加包无法播放的问题
> 感谢广大群友为此库提供的测试和建议等

View File

@ -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="&quot;It was once, a convert-QQ-bot is just in front my eyes&quot;&#10;&quot;Until lose, I finally know cannot chase back what I needs&quot;"></td><td><small>&quot;It was once, a convert-QQ-bot is just in front my eyes&quot;<br>&quot;Until lose, I finally know cannot chase back what I needs&quot;</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> &lt;QQ2836146704&gt; 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="&quot;It was once, a convert-QQ-bot is just in front my eyes&quot;&#10;&quot;Until lose, I finally know cannot chase back what I needs&quot;"></td><td><small>&quot;It was once, a convert-QQ-bot is just in front my eyes&quot;<br>&quot;Until lose, I finally know cannot chase back what I needs&quot;</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
View 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 | 若前述**是否启用声像位移**已启用则此值启用三个值分别代表 xyz 轴上的便宜每个值支持数值 0~65535注意这里每个 1 代表最小音量的 0.001 个单位即取值是此处表示数字的千分倍 |