处理音乐宏语言的现代图书馆
MMLlib的Python项目详细描述
mmllib-用于处理音乐宏语言的现代库
关于
mmllib是与 Music Macro Language作为 由Microsoft®gw-basic®和Compatibles实现,它是 公共窗体,也由Linux中的PC扬声器驱动程序实现 BSD,有许多扩展名 以及更改:
- |表示一个条线,被linux/bsd驱动程序忽略
- 支持多个(平行)乐器音轨
- 带有工作元数据的每个文件头(可选)
- 以#开头的行是注释
- 不支持别名~。
库当前包含以下函数:
- 将(扩展的)mml文件解析为元数据和单个曲目
- 持续时间估计和磁道数将添加到元数据中
- 返回要播放的元组列表(频率、持续时间)(在线程中 翻译器,如floppi音乐)
- 条线分别表示为整数1
- 返回所有轨道上测量/条的面向事件的列表; 每个测量都有一个持续时间和一个时间固定音调开/关列表 事件;有助于在非线程解释器中播放, 可能,MIDI导出
- 将(扩展)mml导出到musicxml
- 可以通过例如MuseScore导入
到…
- 仔细检查mml分数,看是否有视觉表现中的错误
- 播放、安排音乐等
- 美化乐谱,将其打印为乐谱
- 导出为其他格式或在其网站上共享
- 检查磁道是否存在同步错误
- 丢失磁道,即0条
- 缺少条(当然,只能在末尾检测到)
- 相对于其他曲目,条形图中缺少注释
示例
一些示例扩展mml文件包含在示例中/ 目录,代替扩展格式的更好的文档 添加到MML format documentation。
使用mmllib
的项目- ::floppi音乐::
- Floppi-Music有 mml作为raspberry pi上软盘驱动器音乐的输入格式及其使用 mmllib用于处理。floppi音乐也是mmllib的起源。
(扩展)音乐宏语言的说明
基于http://www.antonis.de/qbebooks/gwbasman/play.html和 https://www.mirbsd.org/man4/spkr。
mml
的符号A-G[#,+,-][length]: | |
---|---|
A-G are notes. # or + following a note produces a sharp; - produces a flat. | |
L(n): | Sets the length of each note. L4 is a quarter note, L1 is a whole note, and so on. n may be from 1 to 64. Length may also follow the note to change the length for that note only. A16 is equivalent to L16A. Default is L4. |
ML: | Music legato. Each note plays the full period set by L. |
MN: | Music normal. Each note plays seven-eighths of the time determined by L (length). |
MS: | Music staccato. Each note plays three-quarters of the time determined by L. |
N(n): | Play note n. n may range from 0 to 84. In the 7 possible octaves, there are 84 notes. n set to 0 (or omitted) indicates a rest. |
O(n): | Octave 0 sets the current octave. There are 7 octaves (0 through 6). Default is 4. Middle C is at the beginning of octave 2. |
P(n): | Pause. n may range from 1-64; the current L value is used if omitted. |
T(n): | Tempo. T sets the number of L4s in a minute. n may range from 32-255. Default is 120. |
. (period): | A period after a note increases the playing time of the note by 3/2 times the period determined by L (length of note) times T (tempo). Multiple periods can appear after a note, and the playing time is scaled accordingly. For example, A. will cause the note A to play one and half times the playing time determined by L (length of the note) times T (the tempo); two periods placed after A (A..) will cause the note to be played at 9/4 times its ascribed value; an A with three periods (A…) at 27/8, etc. Periods may also appear after a P (pause), and increase the pause length as described above. |
>: | A greater-than symbol raises the current octave by one. |
<: | A less-than symbol lowers the current octave by one. |
|: | Optionally used as a synchronisation mark for multi-track music. This is a proprietary extension in the Floppi-Music project. |
声音
一首歌的声音交织在一起。它们按符号分组 系统,符号系统用空行隔开。
mmllib的更改日志
0.3
- 启用Python3兼容性。
- 添加新的mmllint脚本。
- 包括示例mml歌曲。
- 添加测试套件的第一部分。
- 一些错误修复。
0.2
- 添加mml2musicxml脚本。
0.1
- 与弗洛皮音乐分开。
评论
以开头的行是注释。在文件的开头, 注释可用于编码元数据。这还没有具体说明。 当前实现解析由冒号分隔的键/值对 一个空格,去掉键和值,小写并加上 去查字典。
MusicXML导出当前特别识别这些键:
任何其他键都被视为杂项字段。