jpfun 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -1
- package/dist/converter/midi/convert.d.ts +50 -0
- package/dist/converter/midi/convert.js +700 -0
- package/dist/converter/midi/index.d.ts +5 -0
- package/dist/converter/midi/index.js +11 -0
- package/dist/converter/midi/json.d.ts +38 -0
- package/dist/converter/midi/json.js +1 -0
- package/dist/converter/midi/triplet.d.ts +30 -0
- package/dist/converter/midi/triplet.js +75 -0
- package/dist/converter/musicxml/dom.d.ts +25 -0
- package/dist/converter/musicxml/dom.js +65 -0
- package/dist/converter/musicxml/features.d.ts +51 -0
- package/dist/converter/musicxml/features.js +232 -0
- package/dist/converter/musicxml/index.d.ts +9 -0
- package/dist/converter/musicxml/index.js +1140 -0
- package/dist/converter/musicxml/model.d.ts +123 -0
- package/dist/converter/musicxml/model.js +1 -0
- package/dist/converter/source.d.ts +22 -0
- package/dist/converter/source.js +51 -0
- package/dist/core.d.ts +22 -0
- package/dist/core.js +22 -0
- package/dist/functions/ASTtypes.d.ts +30 -26
- package/dist/functions/ASTtypes.js +25 -23
- package/dist/functions/adjust/index.js +13 -6
- package/dist/functions/arpeggio/index.d.ts +2 -0
- package/dist/functions/arpeggio/index.js +184 -0
- package/dist/functions/arpeggio/shape.d.ts +7 -0
- package/dist/functions/arpeggio/shape.js +122 -0
- package/dist/functions/bar/index.js +30 -23
- package/dist/functions/beam/auto.d.ts +1 -1
- package/dist/functions/beam/auto.js +1 -1
- package/dist/functions/beam/index.js +6 -1
- package/dist/functions/beam/layout.d.ts +3 -3
- package/dist/functions/beam/layout.js +5 -3
- package/dist/functions/box/index.js +10 -3
- package/dist/functions/br/index.js +10 -6
- package/dist/functions/dash/index.js +12 -9
- package/dist/functions/default.js +6 -2
- package/dist/functions/div/index.d.ts +4 -1
- package/dist/functions/div/index.js +8 -7
- package/dist/functions/dot/index.js +18 -25
- package/dist/functions/dyn/index.d.ts +2 -0
- package/dist/functions/dyn/index.js +242 -0
- package/dist/functions/grace/index.d.ts +1 -1
- package/dist/functions/grace/index.js +17 -11
- package/dist/functions/head/index.js +168 -159
- package/dist/functions/key/index.js +12 -7
- package/dist/functions/meter/index.js +14 -6
- package/dist/functions/note/index.js +73 -31
- package/dist/functions/note/noteNameFSM.js +52 -63
- package/dist/functions/page/index.d.ts +5 -1
- package/dist/functions/page/index.js +38 -16
- package/dist/functions/program/index.d.ts +2 -0
- package/dist/functions/program/index.js +39 -0
- package/dist/functions/set/index.js +13 -8
- package/dist/functions/stack/index.js +7 -5
- package/dist/functions/symbol/index.d.ts +13 -3
- package/dist/functions/symbol/index.js +71 -22
- package/dist/functions/symbol/shape.d.ts +2 -0
- package/dist/functions/symbol/shape.js +14 -10
- package/dist/functions/symbol/symbols/dc.d.ts +4 -0
- package/dist/functions/symbol/symbols/dc.js +82 -0
- package/dist/functions/symbol/symbols/{f.d.ts → ds.d.ts} +1 -1
- package/dist/functions/symbol/symbols/ds.js +93 -0
- package/dist/functions/symbol/symbols/dynamics.d.ts +3 -0
- package/dist/functions/symbol/symbols/dynamics.js +168 -0
- package/dist/functions/symbol/symbols/{p.d.ts → fine.d.ts} +1 -1
- package/dist/functions/symbol/symbols/fine.js +12 -0
- package/dist/functions/symbol/symbols/mordent.js +44 -31
- package/dist/functions/symbol/symbols/prall.d.ts +2 -0
- package/dist/functions/symbol/symbols/prall.js +42 -0
- package/dist/functions/symbol/symbols/segno.d.ts +4 -0
- package/dist/functions/symbol/symbols/segno.js +82 -0
- package/dist/functions/symbol/symbols/tr.js +0 -4
- package/dist/functions/tempo/index.js +12 -4
- package/dist/functions/temporal.d.ts +138 -0
- package/dist/functions/temporal.js +101 -0
- package/dist/functions/text/index.js +25 -10
- package/dist/functions/tie/index.js +45 -30
- package/dist/functions/tuplet/index.js +21 -8
- package/dist/functions/up/index.js +38 -33
- package/dist/functions/voice/index.js +153 -68
- package/dist/functions/volta/index.js +62 -55
- package/dist/iife/core.d.ts +1 -0
- package/dist/iife/core.js +3 -0
- package/dist/iife/from-midi.d.ts +1 -0
- package/dist/iife/from-midi.js +15 -0
- package/dist/iife/from-musicxml.d.ts +1 -0
- package/dist/iife/from-musicxml.js +3 -0
- package/dist/iife/full.d.ts +1 -0
- package/dist/iife/full.js +3 -0
- package/dist/index.d.ts +3 -21
- package/dist/index.js +3 -21
- package/dist/jpfun.core.min.js +119 -0
- package/dist/jpfun.from-midi.min.js +9 -0
- package/dist/jpfun.from-musicxml.min.js +12 -0
- package/dist/jpfun.min.js +111 -122
- package/dist/layout/default.js +2 -3
- package/dist/layout/engine.d.ts +2 -1
- package/dist/layout/engine.js +71 -26
- package/dist/layout/model.d.ts +4 -4
- package/dist/layout/model.js +15 -12
- package/dist/layout/page.js +5 -4
- package/dist/layout/path.js +3 -3
- package/dist/layout/types.d.ts +20 -2
- package/dist/lowering/loweringContext.d.ts +3 -1
- package/dist/lowering/loweringContext.js +28 -14
- package/dist/lowering/track.d.ts +4 -8
- package/dist/lowering/track.js +6 -1
- package/dist/lowering/types.d.ts +5 -128
- package/dist/lowering/types.js +1 -98
- package/dist/parser/parse-utils/string-utils.d.ts +2 -0
- package/dist/parser/parse-utils/string-utils.js +4 -0
- package/dist/parser/parserContext.d.ts +7 -8
- package/dist/parser/parserContext.js +41 -36
- package/dist/pipeline.d.ts +6 -5
- package/dist/pipeline.js +4 -5
- package/dist/playback/compile.d.ts +1 -1
- package/dist/playback/compile.js +15 -2
- package/dist/playback/event.d.ts +17 -3
- package/dist/playback/event.js +30 -12
- package/dist/playback/time.js +1 -1
- package/dist/playback/types.d.ts +5 -4
- package/dist/render/text.d.ts +6 -1
- package/dist/render/text.js +8 -1
- package/grammar.md +111 -57
- package/package.json +11 -2
- package/dist/functions/symbol/symbols/f.js +0 -55
- package/dist/functions/symbol/symbols/p.js +0 -61
package/dist/playback/event.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const EVENT_PRIORITY = {
|
|
2
2
|
tempo: 0,
|
|
3
3
|
"time-signature": 1,
|
|
4
|
-
"
|
|
5
|
-
"note-
|
|
4
|
+
"program-change": 2,
|
|
5
|
+
"note-off": 3,
|
|
6
|
+
"note-on": 4,
|
|
6
7
|
};
|
|
7
8
|
export function comparePlaybackDraftEvents(left, right) {
|
|
8
9
|
const byTime = left.at.compare(right.at);
|
|
@@ -51,37 +52,54 @@ export function finalizePlaybackEvents(events, trackOrder) {
|
|
|
51
52
|
if (!trackIds.has(track))
|
|
52
53
|
trackIds.set(track, trackIds.size);
|
|
53
54
|
}
|
|
54
|
-
const output =
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const output = [];
|
|
56
|
+
for (const event of events) {
|
|
57
|
+
if (event.kind === "tempo") {
|
|
58
|
+
output.push({ kind: "tempo", at: event.at, bpm: event.bpm });
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
57
61
|
if (event.kind === "time-signature") {
|
|
58
|
-
|
|
62
|
+
output.push({
|
|
59
63
|
kind: "time-signature",
|
|
60
64
|
at: event.at,
|
|
61
65
|
numerator: event.numerator,
|
|
62
66
|
denominator: event.denominator,
|
|
63
|
-
};
|
|
67
|
+
});
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (event.kind === "program-change") {
|
|
71
|
+
const track = trackIds.get(event.track);
|
|
72
|
+
if (track !== undefined)
|
|
73
|
+
output.push({
|
|
74
|
+
kind: "program-change",
|
|
75
|
+
at: event.at,
|
|
76
|
+
track,
|
|
77
|
+
program: event.program,
|
|
78
|
+
});
|
|
79
|
+
continue;
|
|
64
80
|
}
|
|
65
81
|
const on = event.kind === "note-on" ? event : noteOns.get(event.noteId);
|
|
66
82
|
const track = trackIds.get(on.track);
|
|
67
83
|
if (event.kind === "note-on") {
|
|
68
|
-
|
|
84
|
+
output.push({
|
|
69
85
|
kind: "note-on",
|
|
70
86
|
at: event.at,
|
|
71
87
|
noteId: event.noteId,
|
|
72
88
|
track,
|
|
73
89
|
midi: event.midi,
|
|
74
90
|
velocity: event.velocity,
|
|
91
|
+
...(event.percussion ? { percussion: true } : {}),
|
|
75
92
|
sourceSpans: event.sourceSpans,
|
|
76
|
-
};
|
|
93
|
+
});
|
|
94
|
+
continue;
|
|
77
95
|
}
|
|
78
|
-
|
|
96
|
+
output.push({
|
|
79
97
|
kind: "note-off",
|
|
80
98
|
at: event.at,
|
|
81
99
|
noteId: event.noteId,
|
|
82
100
|
track,
|
|
83
101
|
midi: on.midi,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
86
104
|
return { events: output, tracks: [...trackIds.keys()] };
|
|
87
105
|
}
|
package/dist/playback/time.js
CHANGED
package/dist/playback/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Diagnostic } from "../diagnostic.js";
|
|
2
2
|
import type { Fraction } from "../fraction.js";
|
|
3
|
-
import type { LoweringAttachment
|
|
3
|
+
import type { LoweringAttachment } from "../lowering/types.js";
|
|
4
|
+
import type { TemporalNodeBase } from "../functions/temporal.js";
|
|
4
5
|
import type { Track } from "../lowering/track.js";
|
|
5
6
|
import type { PlaybackDraftEvent, PlaybackEvent, PlaybackEventInput, PlaybackNoteId } from "./event.js";
|
|
6
7
|
export type * from "./event.js";
|
|
@@ -43,12 +44,12 @@ export interface PlaybackFlow {
|
|
|
43
44
|
/**
|
|
44
45
|
* 记谱位置固化到 Temporal 上的基础状态
|
|
45
46
|
*
|
|
46
|
-
* 将来支持音色时,在这里增加具名的 `program?: number`,并同步扩展系统状态和最终 ProgramChange 事件
|
|
47
47
|
* 不要用任意键索引,否则具体 MIDI 状态会失去类型约束
|
|
48
48
|
*/
|
|
49
49
|
export interface PlaybackState {
|
|
50
50
|
readonly bpm?: number;
|
|
51
51
|
readonly velocity?: number;
|
|
52
|
+
readonly program?: number;
|
|
52
53
|
}
|
|
53
54
|
/** 按线性化时间扫描的可变系统状态 */
|
|
54
55
|
export interface PlaybackSystemState {
|
|
@@ -64,7 +65,7 @@ export interface PlaybackSystemSnapshot {
|
|
|
64
65
|
export type PlaybackControl = (state: PlaybackSystemState) => void;
|
|
65
66
|
/** 当前节点的局部变换完成后,检查或改写此前已发布的事件,例如 dash 延后前音的 NoteOff */
|
|
66
67
|
export type PlaybackHook = (context: PlaybackHookContext) => void;
|
|
67
|
-
/** 修饰同一 play frame 中排在声明者之后的一次具体访问,例如 accent、tr
|
|
68
|
+
/** 修饰同一 play frame 中排在声明者之后的一次具体访问,例如 accent、tr 和波音 */
|
|
68
69
|
export type PlaybackTransform = (context: PlaybackHookContext, events: PlaybackDraftEvent[]) => PlaybackDraftEvent[] | void;
|
|
69
70
|
export interface PlaybackHookContext {
|
|
70
71
|
/** 完整 Tempo 表,以及当前位置此前已经发布的音符事件;relation 阶段包含完整计划 */
|
|
@@ -117,7 +118,7 @@ export interface PlaybackScorePoint {
|
|
|
117
118
|
* 应表示为有限计划加循环点,不是无限序列。
|
|
118
119
|
*/
|
|
119
120
|
export interface PlaybackPlan {
|
|
120
|
-
/** 按演奏时间升序;同刻依次为 tempo、time-signature、note-off、note-on */
|
|
121
|
+
/** 按演奏时间升序;同刻依次为 tempo、time-signature、program-change、note-off、note-on */
|
|
121
122
|
readonly events: readonly PlaybackEvent[];
|
|
122
123
|
readonly scoreMap: readonly PlaybackScorePoint[];
|
|
123
124
|
/** 最终至少含一个 NoteOn 的原始 Track;事件 track 是此数组的索引 */
|
package/dist/render/text.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { GlyphMetrics, TextMeasurer, TextStyle } from "./types.js";
|
|
|
2
2
|
/** 未指定字体族时,普通文本使用的字体栈 */
|
|
3
3
|
export declare const DEFAULT_TEXT_FONT = "sans-serif";
|
|
4
4
|
/** 简谱数字及同类谱面数字使用的字体栈 */
|
|
5
|
-
export declare const JIANPU_NUMBER_FONT = "
|
|
5
|
+
export declare const JIANPU_NUMBER_FONT = "'Cascadia Mono', Consolas, 'Liberation Mono', 'Noto Sans Mono', monospace";
|
|
6
6
|
/** Canvas 的 font 简写;测量与绘制必须用同一份,否则量到的不是将要画出的字形 */
|
|
7
7
|
export declare function canvasFont(style: TextStyle): string;
|
|
8
8
|
/** 默认文本测量保持确定性,不依赖浏览器和操作系统字体。 */
|
|
@@ -19,5 +19,10 @@ export declare class CanvasTextMeasurer implements TextMeasurer {
|
|
|
19
19
|
private readonly context;
|
|
20
20
|
private readonly widths;
|
|
21
21
|
constructor(context: CanvasRenderingContext2D);
|
|
22
|
+
/**
|
|
23
|
+
* 字体名称不变但实际资源变化时调用,例如 Web 字体加载完成后,旧缓存仍是回退字体的宽度。
|
|
24
|
+
* 清理后宿主需重新编译、布局和绘制;仅切换字体族、字号或字重无需清理,它们已包含在缓存键中。
|
|
25
|
+
*/
|
|
26
|
+
clearCache(): void;
|
|
22
27
|
measureText(text: string, style: TextStyle): GlyphMetrics;
|
|
23
28
|
}
|
package/dist/render/text.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** 未指定字体族时,普通文本使用的字体栈 */
|
|
2
2
|
export const DEFAULT_TEXT_FONT = "sans-serif";
|
|
3
3
|
/** 简谱数字及同类谱面数字使用的字体栈 */
|
|
4
|
-
export const JIANPU_NUMBER_FONT = '
|
|
4
|
+
export const JIANPU_NUMBER_FONT = "'Cascadia Mono', Consolas, 'Liberation Mono', 'Noto Sans Mono', monospace";
|
|
5
5
|
/** Canvas 的 font 简写;测量与绘制必须用同一份,否则量到的不是将要画出的字形 */
|
|
6
6
|
export function canvasFont(style) {
|
|
7
7
|
return `${style.fontWeight ?? "normal"} ${style.fontSize}px ${style.fontFamily ?? DEFAULT_TEXT_FONT}`;
|
|
@@ -34,6 +34,13 @@ export class CanvasTextMeasurer {
|
|
|
34
34
|
constructor(context) {
|
|
35
35
|
this.context = context;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* 字体名称不变但实际资源变化时调用,例如 Web 字体加载完成后,旧缓存仍是回退字体的宽度。
|
|
39
|
+
* 清理后宿主需重新编译、布局和绘制;仅切换字体族、字号或字重无需清理,它们已包含在缓存键中。
|
|
40
|
+
*/
|
|
41
|
+
clearCache() {
|
|
42
|
+
this.widths.clear();
|
|
43
|
+
}
|
|
37
44
|
measureText(text, style) {
|
|
38
45
|
const font = canvasFont(style);
|
|
39
46
|
const key = `${font}\u0000${text}`;
|
package/grammar.md
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
title: jpFun 语法规范
|
|
3
|
+
description: jpFun 语言的完整语法、类型与内置函数规范
|
|
4
|
+
sidebar:
|
|
5
|
+
order: 1
|
|
6
|
+
---
|
|
2
7
|
|
|
3
8
|
## 1. 核心思想
|
|
4
9
|
完全函数式,但提供语法糖供快捷调用。
|
|
5
10
|
|
|
6
11
|
## 2. 基本类型
|
|
7
|
-
- 字符串,用引号包裹,只能用英文双引号`"
|
|
12
|
+
- 字符串,用引号包裹,只能用英文双引号`"`。如果不会引起歧义,可以不加引号(单引号用于其他语法糖)。
|
|
8
13
|
- 引号必须配对才算字符串,找不到闭引号时它只是普通字符;可跨行
|
|
9
14
|
- `\` 后的任意字符取字面量,如 `"说\"你好\""`;没有 `\n` 这类语义转义
|
|
10
15
|
- bool值,只能为 `true` / `false`,
|
|
@@ -24,12 +29,13 @@
|
|
|
24
29
|
注释:`%` 直到行末
|
|
25
30
|
|
|
26
31
|
## 3. 主要函数
|
|
27
|
-
- `@
|
|
32
|
+
- `@key(tonality)` / `@1(...)` 修改调性 如 `1=C` 作用域为当前时间之后
|
|
28
33
|
- 规范写法:`[音名][最多一个 #/b][绝对八度]`,音名可用 `A`~`G` 或 `1`~`7`,八度可省(默认 4)
|
|
29
34
|
- 不规范但读得懂的写法会**按实际音高归一化**,并报 `W_KEY_TONALITY` 说明切换到了什么:`C##`→`D4`、`Cbb`→`Bb3`、`B#4`→`C5`、`Cn`→`C4`、小写 `f#`→`F#4`;落在黑键上时跟随原来的升降方向拼写
|
|
30
35
|
- 彻底读不懂时(`X`、`H4`)退回 `C4`,同样报 `W_KEY_TONALITY`
|
|
31
36
|
- `strict` 为真时,以上两种情况都抛 `E_KEY_TONALITY`
|
|
32
37
|
- `@tempo(number)` 修改bpm 作用域为当前时间之后
|
|
38
|
+
- `@program(number)` / `@instrument(...)` 将当前音轨后续音符切换到 MIDI program `0..127`,默认值为 `0`
|
|
33
39
|
- `@meter(num, den, size=0.7em)` 设置拍号 `num/den`,以分数形式显示
|
|
34
40
|
- 第一条小节线前允许不满拍,但不能超拍;之后由小节线、拍号变更或文档结尾关闭并校验完整时长
|
|
35
41
|
- `@set(key=value, ...)` 修改函数的缺省值,作用域为当前 `{}`
|
|
@@ -65,9 +71,72 @@
|
|
|
65
71
|
- 连续声明合成一个 head,空行或普通内容结束组合;一次声明固定为一行
|
|
66
72
|
- `H.left/center/right:` 接受任意零时长 DSL 内容;裸文本自动转成 `@text`
|
|
67
73
|
|
|
74
|
+
- `@note(...)` / `@n(...)`
|
|
75
|
+
- 音名:`A B C D E F G`
|
|
76
|
+
- JE 谱兼容:遇到 `(` 或 `]` 降低一个八度,遇到 `[` 或 `)` 升高一个八度;可嵌套,作用域不越过当前 `{}`
|
|
77
|
+
- 可见休止:`0`(`Z` 等价 `0`)
|
|
78
|
+
- 静音隐形占位:`8`
|
|
79
|
+
- 节拍记号:`9` 或 `X`,均显示为 `X`,发固定的短促打击音(不显示升降号和八度点,不受调性与移调影响)
|
|
80
|
+
- `9 - -` 只起音一次,增时线将其记谱时值延至三拍;MIDI 导出为 channel 10 的 GM Side Stick 键 37,浏览器使用单音色木击近似
|
|
81
|
+
- 升降符:`#` `b` `n`(可重复,如 `bb`、`###`)
|
|
82
|
+
|
|
83
|
+
- `@div(内容, n=1, autobeam=true)` / `@/(...)`
|
|
84
|
+
- 语法糖:直接在后面加`/`,可多个
|
|
85
|
+
- 同一个 `div` 内容中的减时事件始终连接,与 `autobeam` 无关
|
|
86
|
+
- 默认自动连接同轨、连续、同一逻辑行且位于同一四分音符拍内的独立 `div`,例如 `1/ 2// 3/`
|
|
87
|
+
- 自动连接在拍边界、小节线、显式换行、时间间隙、同轨可见非候选元素、普通长事件、开关变化或手工 `@beam` 处结束
|
|
88
|
+
- `autobeam=false` 关闭**该 div** 与周围 div 的自动连接,内部减时线仍然连接
|
|
89
|
+
|
|
90
|
+
- `@dot(...)` / `@.(...)`
|
|
91
|
+
- 语法糖:直接在后面加`.`,可多个
|
|
92
|
+
- 内容在 lowering 后必须恰好产生一个事件;`up/down` 折叠体算一个,所以 `{1^2}.`、`{1_2}.` 合法,并分别等价于 `{1.^2}`、`{1._2}`
|
|
93
|
+
|
|
94
|
+
- `@dash()` / `@-()`
|
|
95
|
+
- 语法糖:直接在后面加`-`,可多个
|
|
96
|
+
|
|
97
|
+
- `@bar(...)` / `@|(...)` 创建一个小节线,时间线上强制对齐
|
|
98
|
+
- `|:` 标记反复起点,`:|` 回到此前最近的反复起点;没有起点时回到曲首
|
|
99
|
+
- 每条 `:|` 只回跳一次,连续写多条即可增加遍数
|
|
100
|
+
- 重叠反复按最近起点解释:`|: 1 |: 2 :| 3 :|` 播放为 `1 2 2 3 2 3`
|
|
101
|
+
|
|
102
|
+
- `@text(内容, size=1em, lineheight=1.25, align=left)` 文本标记
|
|
103
|
+
- 语法糖:`"渐强"` 等价于 `@text(渐强)`;引号内的逗号和右括号不再是参数分隔符
|
|
104
|
+
- 括号内可以直接换行,`lineheight` 是相对自身字号的倍数
|
|
105
|
+
- `align=left`(默认)各行左对齐,锚点在第一行首字符中心,单字标记因此能像音符一样对准宿主
|
|
106
|
+
- `align=center` 各行居中,锚点取整块中心,适合多行标题
|
|
107
|
+
- `align=right` 各行右对齐,锚点取第一行末字符中心,适合谱头作者栏
|
|
108
|
+
- 受预处理规则影响:行尾奇数个 `\` 会把换行当续行吃掉,不加引号时第二行的 `%` 会开启行注释
|
|
109
|
+
|
|
110
|
+
- `@symbol(name, size=0.5em)` / `@$(...)` 乐谱符号容器
|
|
111
|
+
- 语法糖:`$name`,名称必须以 ASCII 字母开头,后续可含字母、数字、`_` 和 `-`
|
|
112
|
+
- 名称按小写查询内置符号表;未知名称默认报告 `W_UNKNOWN_SYMBOL`,严格模式抛出 `E_UNKNOWN_SYMBOL`
|
|
113
|
+
- 每个符号是 `src/functions/symbol/symbols/` 下的一个对象字面量:固定图形加可选播放规则,符号之间互不依赖
|
|
114
|
+
- 两处例外:力度记号族由 m/f/p 三个字母横向拼接、共享一条力度阶梯,合住 `symbols/dynamics.ts`;`$ds` 要知道往哪里跳,所以单向引用 `$segno` 的标记常量
|
|
115
|
+
- 符号高度 = `size × weight`,`weight` 由符号自己声明,用来修正宽扁字形的视觉重量
|
|
116
|
+
- `$fine` 不是固定图形而是交给宿主字体绘制的文字记号,字号同样是 `size × weight`
|
|
117
|
+
- 内置记号:`$tr`(颤音)、`$fermata`(延长记号)、`$prall`(上波音)、`$mordent`(下波音)、`$accent`(重音)
|
|
118
|
+
- 内置力度:`$ppp` `$pp` `$p` `$mp` `$mf` `$f` `$ff` `$fff`,velocity 依次为 16/32/48/64/80/96/112/127,`$mf` 恰好是默认力度
|
|
119
|
+
- 内置反复:`$dc`(从头反复)、`$ds`(从记号处反复)、`$segno`(反复记号,D.S. 的回跳目标)、`$fine`(终止记号)
|
|
120
|
+
- 持续类记号按**记谱位置**生效,从它所在位置一直到下一个同类记号;反复回跳后用的是目标位置之前的那个值
|
|
121
|
+
- 力度属于声部,只在**自己所在的音轨**上流动:`@stack({1 2}, {3 $p 4})` 里的 `$p` 不会压低上面那条旋律
|
|
122
|
+
- 新声部继承分叉处父轨的力度,所以 `$f 1 @voices(...)` 里的 `$f` 会传给每个声部;一旦声部自己开始发声,就不再跟随父轨的后续变化
|
|
123
|
+
- 修饰类记号只作用于同一 `up` 中排在符号下方的成员,独立写出时只绘制:重音 velocity `+20`、`$tr` 在本音与调内上方二度间交替、`$prall` 为本音—上方音—本音、`$mordent` 为本音—下方音—本音(命名同 LilyPond)
|
|
124
|
+
- 延长记号把目标音覆盖区间的速度减半;NoteOn/NoteOff 的 QN 位置不变,实际秒数翻倍
|
|
125
|
+
- 装饰音的交替密度按发声时的速度决定(落在 8~64 Hz),默认速度下恰好是 `1/8` 四分音符
|
|
126
|
+
- `$dc` 只在第一次到达时跳回曲首,第二次经过就正常收尾,所以整首曲子恰好演两遍;回跳后的那一遍不再重复曲中的 `|: :|`
|
|
127
|
+
- `$ds` 同理,但跳回它之前最近的 `$segno`;谱里没写 `$segno` 时退回曲首,等价于 `$dc`
|
|
128
|
+
- `$fine` 按“它后面最近的那个 `$dc` / `$ds` 是否已经跳过”判断是否收尾,所以写在 `|: :|` 里也不会被反复线提前触发;后面没有回跳记号时它不生效
|
|
129
|
+
- 跟 `:|` 一样,这三个记号所在的时间列在跳转或收尾的那一遍不发声,所以应该写在小节线上下(`| _$dc`)而不是叠在音符上
|
|
130
|
+
|
|
131
|
+
- `@br(offset=1)` 在后续事件前偏移指定行数
|
|
132
|
+
- `offset` 是第一个位置参数,因此通常写作 `@br(2)`
|
|
133
|
+
- 默认值为 1;按非负整数固化,小数向下取整,负数视为 0
|
|
134
|
+
- `@br(0)` 不换行,`@br(2)` 会保留一个空行
|
|
135
|
+
- 每次调用独立生效,多个 br 暂不合并
|
|
136
|
+
|
|
68
137
|
- `@stack(...)` 临时伴奏/临时多声部:第一个成员留在宿主轨,其余成员按书写顺序依次向上叠放;与 `^` 的区别见下面的对照表
|
|
69
|
-
- `@voices(...)` 多声部块:所有成员都有独立轨道,整块在宿主基线上局部居中(首末两条基线的中点对齐宿主轴),两个以上成员时在声部名与音符之间画多声部括线;里面只能是 `@voice`,一般用语法糖创建
|
|
70
|
-
- `@voice({}, 音轨名, 名称1={}, 名称2={}, ...)`
|
|
138
|
+
- `@voices(...)` / `@vs(...)` 多声部块:所有成员都有独立轨道,整块在宿主基线上局部居中(首末两条基线的中点对齐宿主轴),两个以上成员时在声部名与音符之间画多声部括线;里面只能是 `@voice`,一般用语法糖创建
|
|
139
|
+
- `@voice({}, 音轨名, 名称1={}, 名称2={}, ...)` / `@v(...)`
|
|
71
140
|
语法糖:
|
|
72
141
|
```
|
|
73
142
|
N(音轨名): ... (note等元素)
|
|
@@ -76,6 +145,7 @@
|
|
|
76
145
|
```
|
|
77
146
|
起始条件1: `N(xxx):`。终止条件:该层级的换行符或结束。可以有大括号,大括号内随意换行
|
|
78
147
|
起始条件2: `L(xxx):`。终止条件:该层级的换行符或结束。如果上一个不是voice就报错
|
|
148
|
+
- 歌词默认按空格、连字符和非 ASCII 字符分词;`{你好}` 强制把多字符文本作为一个音符槽,显示时不含花括号
|
|
79
149
|
|
|
80
150
|
- `@up(...)` 和弦:把同一时间位置的几个音合成一个符号。语法糖 `^`,自下而上写
|
|
81
151
|
- 时值、对齐基准和减时线都以最下面的成员为准
|
|
@@ -103,6 +173,14 @@
|
|
|
103
173
|
| 能否整体当一个符号用 | 能(可以做倚音、连音线端点) | 不能,放进倚音会报 `E_GRACE_PARALLEL_CONTENT` |
|
|
104
174
|
| 典型用途 | 和弦、文本 | 临时伴奏、临时多声部 |
|
|
105
175
|
|
|
176
|
+
- `@arp(content, direction)` / `@arpeggio(...)` 琶音
|
|
177
|
+
- content 必须是同一音轨、至少两个成员组成的 `@up` / `@down` 折叠体,例如 `@arp({1 ^ 3 ^ 5})`
|
|
178
|
+
- 省略 direction:只画无箭头波浪线,播放仍按视觉位置从下到上依次延迟成员
|
|
179
|
+
- `direction=up`:按视觉位置从下到上依次延迟成员,在波浪线顶端画向上箭头
|
|
180
|
+
- `direction=down`:按视觉位置从上到下依次延迟成员,在波浪线底端画向下箭头
|
|
181
|
+
- 每个成员都占一个延迟槽,无论它是否发声;只错开音符事件,速度、音色等系统状态仍在和弦时刻生效
|
|
182
|
+
- 相邻槽默认错开 `1/8 QN`;短和弦会压缩间隔,使最后一个槽不晚于总时值的一半
|
|
183
|
+
|
|
106
184
|
- `@grace(宿主, 倚音, side=pre)` 倚音
|
|
107
185
|
- 语法糖:`>` 与 `<`,**箭头永远指向宿主**
|
|
108
186
|
- `2>1` 前倚音:`2` 画在 `1` 的左上角;`1<2` 后倚音:`2` 画在 `1` 的右上角
|
|
@@ -120,57 +198,18 @@
|
|
|
120
198
|
- 连音数字 `actual = writtenTotal / shortest`,必须是大于等于 2 的整数
|
|
121
199
|
- 缩放后总时值为 `shortest * normal`,即所有成员的时间统一乘以 `normal / actual`
|
|
122
200
|
- `@tuplet({1/23}, 4)` 中原时值为 `1/2 + 1 + 1 = 5/2 QN`,共 5 个最短单位;缩放后总时值为 `2 QN`,上方显示数字 5
|
|
123
|
-
-
|
|
201
|
+
- 内容必须位于同一音轨和同一谱面行;允许嵌套,外层括线会避让先生成的内层括线
|
|
124
202
|
|
|
125
|
-
- `@
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
- 自动连接在拍边界、小节线、显式换行、时间间隙、同轨可见非候选元素、普通长事件、开关变化或手工 `@beam` 处结束
|
|
136
|
-
- `autobeam=false` 关闭**该 div** 与周围 div 的自动连接,内部减时线仍然连接
|
|
137
|
-
- `@dot(...)` / `@.(...)`
|
|
138
|
-
- 语法糖:直接在后面加`.`,可多个
|
|
139
|
-
- `@dash()` / `@-()`
|
|
140
|
-
- 语法糖:直接在后面加`-`,可多个
|
|
141
|
-
- `@bar(...)` 创建一个小节线,时间线上强制对齐
|
|
142
|
-
- `|:` 标记反复起点,`:|` 回到此前最近的反复起点;没有起点时回到曲首
|
|
143
|
-
- 每条 `:|` 只回跳一次,连续写多条即可增加遍数
|
|
144
|
-
- 重叠反复按最近起点解释:`|: 1 |: 2 :| 3 :|` 播放为 `1 2 2 3 2 3`
|
|
145
|
-
- `@text(内容, size=1em, lineheight=1.25, align=left)` 文本标记
|
|
146
|
-
- 语法糖:`"渐强"` 等价于 `@text(渐强)`;引号内的逗号和右括号不再是参数分隔符
|
|
147
|
-
- 括号内可以直接换行,`lineheight` 是相对自身字号的倍数
|
|
148
|
-
- `align=left`(默认)各行左对齐,锚点在第一行首字符中心,单字标记因此能像音符一样对准宿主
|
|
149
|
-
- `align=center` 各行居中,锚点取整块中心,适合多行标题
|
|
150
|
-
- `align=right` 各行右对齐,锚点取第一行末字符中心,适合谱头作者栏
|
|
151
|
-
- 受预处理规则影响:行尾奇数个 `\` 会把换行当续行吃掉,不加引号时第二行的 `%` 会开启行注释
|
|
152
|
-
- `@symbol(name, size=0.5em)` 乐谱符号容器
|
|
153
|
-
- 语法糖:`$name`,名称必须以 ASCII 字母开头,后续可含字母、数字、`_` 和 `-`
|
|
154
|
-
- 名称按小写查询内置符号表;未知名称抛出 `E_UNKNOWN_SYMBOL`
|
|
155
|
-
- 每个符号是 `src/functions/symbol/symbols/` 下的一个对象字面量:固定图形加可选播放规则,符号之间互不依赖
|
|
156
|
-
- 符号高度 = `size × weight`,`weight` 由符号自己声明,用来修正宽扁字形的视觉重量
|
|
157
|
-
- 内置:`$tr`(颤音)、`$f`(强)、`$p`(弱)、`$fermata`(延长记号)、`$mordent`(波音)、`$accent`(重音)
|
|
158
|
-
- 持续类记号按**记谱位置**生效,从它所在位置一直到下一个同类记号:`$p=48`、`$f=96`;反复回跳后用的是目标位置之前的那个值
|
|
159
|
-
- 修饰类记号只作用于同一 `up` 中排在符号下方的成员,独立写出时只绘制:重音 velocity `+20`、`$tr` 在本音与调内上方二度间交替、`$mordent` 为本音—上方音—本音
|
|
160
|
-
- 延长记号把目标音覆盖区间的速度减半;NoteOn/NoteOff 的 QN 位置不变,实际秒数翻倍
|
|
161
|
-
- 装饰音的交替密度按发声时的速度决定(落在 8~64 Hz),默认速度下恰好是 `1/8` 四分音符
|
|
162
|
-
- `@volta(from, to, pass, ...)` 反复房子:一段只在指定遍数演奏的区间
|
|
163
|
-
- `from` `to` 是区间首末音符的标签,两者可以是同一个;写顺序不限,按时间列取 min/max
|
|
164
|
-
- 遍数必填(房子上的数字本来就是谱面的一部分),必须是正整数,否则抛 `E_VOLTA_INVALID_PASS`。可以再跟任意多个遍数表示**几遍共用一个房子**,如 `@volta(a, b, 1, 2)`;重复和乱序都会被规整,标签按升序写成 `1.2.`
|
|
165
|
-
- 不指向任何具体的反复线,属于哪个反复段完全由区间位置决定,每段的遍数各自从第一遍数起
|
|
166
|
-
- 同一列被两个房子标成互斥的遍数时它一遍都不会演,报 `W_PLAYBACK_COLUMN_NEVER_PLAYED`
|
|
167
|
-
- 按记谱惯例,括线两端会贴到相邻小节线的锚点上(相邻列不是小节线时才按内容取边)
|
|
168
|
-
- `@br(offset=1)` 在后续事件前偏移指定行数
|
|
169
|
-
- `offset` 是第一个位置参数,因此通常写作 `@br(2)`
|
|
170
|
-
- 默认值为 1;按非负整数固化,小数向下取整,负数视为 0
|
|
171
|
-
- `@br(0)` 不换行,`@br(2)` 会保留一个空行
|
|
172
|
-
- 每次调用独立生效,多个 br 暂不合并
|
|
173
|
-
- `@adjust(内容, dx=0px, dy=0px, dw=0px, dh=0px)` 手工微调排版盒
|
|
203
|
+
- `@box(content, padding=0em, stroke=1px, width=-1px)` 给内容加矩形外框
|
|
204
|
+
- `content` 必填,可以是单个对象或用 `{}` 包裹的一组内容;外框本身不产生时间事件,不改变内容的播放效果
|
|
205
|
+
- `padding` 是内容与边框之间的留白,`stroke` 是边框线宽;两者均为长度,负值按 0 处理,`stroke=0px` 隐藏边框
|
|
206
|
+
- `width <= 0` 时随内容的自然排版范围确定宽度;正值约束内容的水平跨度,不含留白和边框,并调整区间内的列间距,同时间列的其他音轨也保持对齐
|
|
207
|
+
- 默认按成员的排版盒及写在框内的关系对象取包围范围;写在框外的连音线不会仅因端点在框内就被纳入
|
|
208
|
+
- 内容不能跨谱面行,否则抛 `E_BOX_CROSS_LINE`;空内容不绘制外框
|
|
209
|
+
- 定宽外框允许嵌套,但不允许部分交叉;宽度过小、同一区间宽度约束冲突或部分交叉都会报错
|
|
210
|
+
- 例如 `@box({1 2 3}, padding=0.2em, width=6em)`;设为 `stroke=0px` 时可以只约束宽度而不显示边框
|
|
211
|
+
|
|
212
|
+
- `@adjust(内容, dx=0px, dy=0px, dw=0px, dh=0px)` / `@adj(...)` 手工微调排版盒
|
|
174
213
|
- `dx`/`dy` 在排版完成后平移,邻居不会让开,因此可以故意重叠;关系函数读取的是平移后的盒子,连音线等会跟着走
|
|
175
214
|
- `dw`/`dh` 在排版之前增减占位,邻居会跟着让开或收拢,最终宽高不会小于 0;`dw` 按原左右占位比例分配,`dh` 只调整下方
|
|
176
215
|
- 括住多个对象时逐个施加同一增量;括住的若是关系对象且其中没有对象,平移的就是这条关系对象
|
|
@@ -180,10 +219,25 @@
|
|
|
180
219
|
|
|
181
220
|
### 关系型
|
|
182
221
|
参数类型为标签,如果不传,则默认取最后两个注册的节点(比如note)
|
|
183
|
-
- `@beam(...)`:手工连接传参的减时线;不受 `div.autobeam`
|
|
222
|
+
- `@beam(...)`:手工连接传参的减时线;不受 `div.autobeam` 开关影响。参数必须按时间顺序对应同轨、同谱面行中的相邻可见元素,允许跨过零时长小节线;连线直接穿过小节线,保留原有间距;over 只有第一参数内的元素可参与外层 beam
|
|
184
223
|
- `@tie(...)`:按参数顺序连接元素;跨轨端点仍绘制连音线,但播放时只有同轨、同音且连续的音符才合并。近距离使用普通弧线,远距离或跨行时使用带水平段的连音线
|
|
224
|
+
- `@volta(from, to, pass, ...)` 反复房子:一段只在指定遍数演奏的区间
|
|
225
|
+
- `from` `to` 是区间首末音符的标签,两者可以是同一个;写顺序不限,按时间列取 min/max
|
|
226
|
+
- 遍数必填(房子上的数字本来就是谱面的一部分),必须是正整数,否则抛 `E_VOLTA_INVALID_PASS`。可以再跟任意多个遍数表示**几遍共用一个房子**,如 `@volta(a, b, 1, 2)`;重复和乱序都会被规整,标签按升序写成 `1.2.`
|
|
227
|
+
- 不指向任何具体的反复线,属于哪个反复段完全由区间位置决定,每段的遍数各自从第一遍数起
|
|
228
|
+
- 同一列被两个房子标成互斥的遍数时它一遍都不会演,报 `W_PLAYBACK_COLUMN_NEVER_PLAYED`
|
|
229
|
+
- 按记谱惯例,括线两端会贴到相邻小节线的锚点上(相邻列不是小节线时才按内容取边)
|
|
230
|
+
- `@dyn(from, to, dv)` 渐强渐弱
|
|
231
|
+
- `from`、`to` 是同一音轨上两个不同时间的标签;参数书写顺序不限,始终按记谱时间从早到晚生效
|
|
232
|
+
- `dv` 是非零力度增量:正数渐强,负数渐弱;有限值超出 -127~127 时会被限制并产生警告;起点增量为 0,终点增量为完整 `dv`,中间按记谱时间线性插值
|
|
233
|
+
- 增量叠加在每个音符已经固化的力度上,所以区间内的 `$p`、`$f` 仍独立生效,曲线可以在该处跳变
|
|
234
|
+
- 终点后的完整增量保持到下一次原始力度变化;最终力度钳在 1~127,不在核心层取整
|
|
235
|
+
- 楔形线画在数字上方,闭区间覆盖起点主体左边界到终点主体右边界;两个端点列也参与避让
|
|
236
|
+
- 区间内的高对象和先声明且横向重叠的 attachment 会把楔形线向外推;后声明者排在外层
|
|
237
|
+
- dyn 不特判或移动 `$p`、`$f`;要把力度记号放在楔形线两侧,可将它们写在区间外相邻音符上,如 `1 ^ $p 2@a 3@b 4 ^ $f @dyn(a,b,48)`
|
|
238
|
+
|
|
185
239
|
|
|
186
|
-
|
|
240
|
+
### 语法糖示例:
|
|
187
241
|
- `"渐强"` -> `@text(渐强)`
|
|
188
242
|
- `@bar(C1 C3)` -> `@bar({ C1 C3 })`
|
|
189
243
|
- `{...}//` -> `@div({ ... }, 2)`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jpfun",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "A functional numbered musical notation typesetting engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"import": "./dist/index.js"
|
|
14
14
|
},
|
|
15
|
+
"./converter/midi": {
|
|
16
|
+
"types": "./dist/converter/midi/index.d.ts",
|
|
17
|
+
"import": "./dist/converter/midi/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./converter/musicxml": {
|
|
20
|
+
"types": "./dist/converter/musicxml/index.d.ts",
|
|
21
|
+
"import": "./dist/converter/musicxml/index.js"
|
|
22
|
+
},
|
|
15
23
|
"./package.json": "./package.json"
|
|
16
24
|
},
|
|
17
25
|
"sideEffects": false,
|
|
@@ -39,7 +47,7 @@
|
|
|
39
47
|
"scripts": {
|
|
40
48
|
"clean": "node -e \"for (const path of ['dist', 'tsconfig.tsbuildinfo']) require('node:fs').rmSync(path, { recursive: true, force: true })\"",
|
|
41
49
|
"build": "pnpm run clean && tsc -p tsconfig.json && pnpm run build:bundle",
|
|
42
|
-
"build:bundle": "
|
|
50
|
+
"build:bundle": "node ../../scripts/build-jpfun-bundles.mjs && node --test ../../scripts/test-jpfun-bundles.mjs",
|
|
43
51
|
"prepack": "pnpm run build",
|
|
44
52
|
"typecheck": "tsc -p test/tsconfig.json",
|
|
45
53
|
"test": "node --import tsx --test \"test/*.test.ts\"",
|
|
@@ -56,6 +64,7 @@
|
|
|
56
64
|
"license": "Apache-2.0",
|
|
57
65
|
"devDependencies": {
|
|
58
66
|
"@types/node": "^26.2.0",
|
|
67
|
+
"@xmldom/xmldom": "^0.9.12",
|
|
59
68
|
"esbuild": "^0.25.0",
|
|
60
69
|
"tsx": "^4.23.12",
|
|
61
70
|
"typescript": "^7.0.2"
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const FORTE_VELOCITY = 96;
|
|
2
|
-
export const fSymbol = {
|
|
3
|
-
name: "f",
|
|
4
|
-
description: "强",
|
|
5
|
-
shapes: [
|
|
6
|
-
{
|
|
7
|
-
path: [
|
|
8
|
-
{ op: "M", x: 6.805, y: 3.24553 },
|
|
9
|
-
{ op: "L", x: 8.5437, y: 3.24553 },
|
|
10
|
-
{ op: "L", x: 8.5437, y: 3.89757 },
|
|
11
|
-
{ op: "L", x: 6.60698, y: 3.89757 },
|
|
12
|
-
{ op: "C", cx1: 6.05169, cy1: 5.7957, cx2: 5.56385, cy2: 7.20105, x: 5.14365, y: 8.11383 },
|
|
13
|
-
{ op: "C", cx1: 4.83447, cy1: 8.76586, cx2: 4.53022, cy2: 9.3261, x: 4.23564, y: 9.79455 },
|
|
14
|
-
{ op: "C", cx1: 3.94108, cy1: 10.26319, cx2: 3.57392, cy2: 10.664, x: 3.13455, y: 10.99733 },
|
|
15
|
-
{ op: "C", cx1: 2.69497, cy1: 11.33542, cx2: 2.17827, cy2: 11.53344, x: 1.58419, y: 11.59615 },
|
|
16
|
-
{ op: "C", cx1: 1.18814, cy1: 11.59615, cx2: 0.82592, cy2: 11.46084, x: 0.49258, y: 11.19535 },
|
|
17
|
-
{ op: "C", cx1: 0.16419, cy1: 10.92968, cx2: 0, cy2: 10.59161, x: 0, y: 10.17141 },
|
|
18
|
-
{ op: "C", cx1: 0, cy1: 9.90098, cx2: 0.07735, cy2: 9.64006, x: 0.2366, y: 9.38407 },
|
|
19
|
-
{ op: "C", cx1: 0.39605, cy1: 9.12808, cx2: 0.65204, cy2: 8.97831, x: 1.00951, y: 8.92531 },
|
|
20
|
-
{ op: "C", cx1: 1.24611, cy1: 8.92531, cx2: 1.44887, cy2: 9.00266, x: 1.62771, y: 9.15716 },
|
|
21
|
-
{ op: "C", cx1: 1.80634, cy1: 9.31643, cx2: 1.89813, cy2: 9.50494, x: 1.89813, y: 9.73186 },
|
|
22
|
-
{ op: "C", cx1: 1.89813, cy1: 9.88637, cx2: 1.85936, cy2: 10.01197, x: 1.78695, y: 10.10852 },
|
|
23
|
-
{ op: "C", cx1: 1.71455, cy1: 10.21001, cx2: 1.59387, cy2: 10.33066, x: 1.43443, y: 10.48043 },
|
|
24
|
-
{ op: "C", cx1: 1.27497, cy1: 10.63017, cx2: 1.16874, cy2: 10.76055, x: 1.12521, y: 10.86203 },
|
|
25
|
-
{ op: "C", cx1: 1.15905, cy1: 10.9924, cx2: 1.23639, cy2: 11.06006, x: 1.34757, y: 11.06006 },
|
|
26
|
-
{ op: "C", cx1: 1.74837, cy1: 11.06006, cx2: 2.10584, cy2: 10.81377, x: 2.4196, y: 10.32118 },
|
|
27
|
-
{ op: "C", cx1: 2.73355, cy1: 9.83335, cx2: 2.99447, cy2: 9.26339, x: 3.2022, y: 8.61136 },
|
|
28
|
-
{ op: "C", cx1: 3.40971, cy1: 7.95932, cx2: 3.64651, cy2: 7.10927, x: 3.92168, y: 6.06119 },
|
|
29
|
-
{ op: "C", cx1: 4.19706, cy1: 5.00836, cx2: 4.40952, cy2: 4.28867, x: 4.54959, y: 3.89757 },
|
|
30
|
-
{ op: "L", x: 3.24552, y: 3.89757 },
|
|
31
|
-
{ op: "L", x: 3.24552, y: 3.24553 },
|
|
32
|
-
{ op: "L", x: 4.82496, y: 3.24553 },
|
|
33
|
-
{ op: "C", cx1: 5.05187, cy1: 2.68054, cx2: 5.36582, cy2: 2.15393, x: 5.77156, y: 1.6566 },
|
|
34
|
-
{ op: "C", cx1: 6.18204, cy1: 1.15907, cx2: 6.65546, cy2: 0.76302, x: 7.19155, y: 0.45876 },
|
|
35
|
-
{ op: "C", cx1: 7.72766, cy1: 0.1545, cx2: 8.29265, cy2: 0, x: 8.88176, y: 0 },
|
|
36
|
-
{ op: "C", cx1: 9.36486, cy1: 0, cx2: 9.67384, cy2: 0.14975, x: 9.85268, y: 0.34777 },
|
|
37
|
-
{ op: "C", cx1: 10.03131, cy1: 0.5458, cx2: 10.14727, cy2: 0.83541, x: 10.20998, y: 0.97073 },
|
|
38
|
-
{ op: "C", cx1: 10.20998, cy1: 1.3282, cx2: 10.10374, cy2: 1.68548, x: 9.89602, y: 2.038 },
|
|
39
|
-
{ op: "C", cx1: 9.68851, cy1: 2.39072, cx2: 9.38899, cy2: 2.57905, x: 9.00264, y: 2.59349 },
|
|
40
|
-
{ op: "C", cx1: 8.9544, cy1: 2.54522, cx2: 8.86733, cy2: 2.49695, x: 8.74666, y: 2.44373 },
|
|
41
|
-
{ op: "C", cx1: 8.51006, cy1: 2.33275, cx2: 8.3892, cy2: 2.24571, x: 8.35061, y: 1.94145 },
|
|
42
|
-
{ op: "C", cx1: 8.39412, cy1: 1.49714, cx2: 8.59689, cy2: 1.19762, x: 8.95912, y: 1.04807 },
|
|
43
|
-
{ op: "C", cx1: 9.19573, cy1: 0.9901, cx2: 9.3166, cy2: 0.89831, x: 9.3166, y: 0.77269 },
|
|
44
|
-
{ op: "C", cx1: 9.3166, cy1: 0.5988, cx2: 9.17159, cy2: 0.49257, x: 8.88177, y: 0.45399 },
|
|
45
|
-
{ op: "C", cx1: 8.39416, cy1: 0.45399, cx2: 7.95931, cy2: 0.79208, x: 7.57793, y: 1.4633 },
|
|
46
|
-
{ op: "C", cx1: 7.32192, cy1: 1.84491, cx2: 7.06593, cy2: 2.43897, x: 6.805, y: 3.24551 },
|
|
47
|
-
{ op: "L", x: 6.805, y: 3.24551 },
|
|
48
|
-
{ op: "L", x: 6.805, y: 3.24553 },
|
|
49
|
-
{ op: "Z" },
|
|
50
|
-
],
|
|
51
|
-
style: { fill: "#000" },
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
onTimeState: state => { state.velocity = FORTE_VELOCITY; },
|
|
55
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
const PIANO_VELOCITY = 48;
|
|
2
|
-
export const pSymbol = {
|
|
3
|
-
name: "p",
|
|
4
|
-
description: "弱",
|
|
5
|
-
shapes: [
|
|
6
|
-
{
|
|
7
|
-
path: [
|
|
8
|
-
{ op: "M", x: 8.93561, y: 0.90391 },
|
|
9
|
-
{ op: "C", cx1: 8.39321, cy1: 0.90391, cx2: 7.93492, cy2: 1.2075, x: 7.56045, y: 1.81442 },
|
|
10
|
-
{ op: "C", cx1: 7.19233, cy1: 2.42134, cx2: 6.91466, cy2: 3.11209, x: 6.72743, y: 3.88032 },
|
|
11
|
-
{ op: "C", cx1: 6.5402, cy1: 4.64856, cx2: 6.45002, cy2: 5.23617, x: 6.45002, y: 5.63655 },
|
|
12
|
-
{ op: "C", cx1: 6.45002, cy1: 6.32093, cx2: 6.66288, cy2: 6.66316, x: 7.0892, y: 6.66316 },
|
|
13
|
-
{ op: "C", cx1: 7.4959, cy1: 6.66316, cx2: 7.88333, cy2: 6.34661, x: 8.2578, y: 5.70743 },
|
|
14
|
-
{ op: "C", cx1: 8.63861, cy1: 5.06825, cx2: 8.94857, cy2: 4.35158, x: 9.18735, y: 3.54473 },
|
|
15
|
-
{ op: "C", cx1: 9.42639, cy1: 2.73762, cx2: 9.54885, cy2: 2.15001, x: 9.54885, y: 1.77554 },
|
|
16
|
-
{ op: "C", cx1: 9.54885, cy1: 1.19453, cx2: 9.34231, cy2: 0.9039, x: 8.93561, y: 0.9039 },
|
|
17
|
-
{ op: "L", x: 8.93561, y: 0.9039 },
|
|
18
|
-
{ op: "L", x: 8.93561, y: 0.9039 },
|
|
19
|
-
{ op: "L", x: 8.93561, y: 0.90391 },
|
|
20
|
-
{ op: "Z" },
|
|
21
|
-
{ op: "M", x: 2.53741, y: 3.99669 },
|
|
22
|
-
{ op: "L", x: 1.90457, y: 3.99669 },
|
|
23
|
-
{ op: "C", cx1: 2.49853, cy1: 2.80215, cx2: 3.08615, cy2: 1.83373, x: 3.66714, y: 1.1041 },
|
|
24
|
-
{ op: "C", cx1: 4.25476, cy1: 0.36813, cx2: 4.97777, cy2: 0.00001, x: 5.84306, y: 0.00001 },
|
|
25
|
-
{ op: "C", cx1: 6.03027, cy1: 0.00001, cx2: 6.21089, cy2: 0.11637, x: 6.39177, y: 0.34882 },
|
|
26
|
-
{ op: "C", cx1: 6.57271, cy1: 0.57466, cx2: 6.66284, cy2: 0.83938, x: 6.66284, y: 1.13636 },
|
|
27
|
-
{ op: "C", cx1: 7.12775, cy1: 0.87825, cx2: 7.5797, cy2: 0.60693, x: 8.08986, y: 0.36812 },
|
|
28
|
-
{ op: "C", cx1: 8.60631, cy1: 0.12932, cx2: 9.01941, cy2: 0, x: 9.49094, y: 0 },
|
|
29
|
-
{ op: "C", cx1: 10.28506, cy1: 0, cx2: 10.85948, cy2: 0.25202, x: 11.22125, y: 0.76189 },
|
|
30
|
-
{ op: "C", cx1: 11.58911, cy1: 1.26568, cx2: 11.76999, cy2: 1.93051, x: 11.76999, y: 2.75058 },
|
|
31
|
-
{ op: "C", cx1: 11.76999, cy1: 3.26045, cx2: 11.66024, cy2: 3.79649, x: 11.44707, y: 4.35819 },
|
|
32
|
-
{ op: "C", cx1: 11.23395, cy1: 4.91989, cx2: 10.93697, cy2: 5.43636, x: 10.55616, y: 5.91423 },
|
|
33
|
-
{ op: "C", cx1: 10.17535, cy1: 6.39186, cx2: 9.73609, cy2: 6.77925, x: 9.23261, y: 7.07623 },
|
|
34
|
-
{ op: "C", cx1: 8.72907, cy1: 7.36686, cx2: 8.19962, cy2: 7.51522, x: 7.64428, y: 7.51522 },
|
|
35
|
-
{ op: "C", cx1: 7.32797, cy1: 7.51522, cx2: 7.0117, cy2: 7.42504, x: 6.68878, y: 7.24416 },
|
|
36
|
-
{ op: "C", cx1: 6.36591, cy1: 7.06327, cx2: 6.10119, cy2: 6.83743, x: 5.89463, y: 6.55976 },
|
|
37
|
-
{ op: "L", x: 4.55177, y: 10.39486 },
|
|
38
|
-
{ op: "C", cx1: 4.59038, cy1: 10.39486, cx2: 4.57108, cy2: 10.42712, x: 4.49359, y: 10.49823 },
|
|
39
|
-
{ op: "C", cx1: 4.55177, cy1: 10.71115, cx2: 4.66151, cy2: 10.82087, x: 4.80987, y: 10.82087 },
|
|
40
|
-
{ op: "L", x: 6.13343, y: 10.82087 },
|
|
41
|
-
{ op: "L", x: 6.13343, y: 11.64096 },
|
|
42
|
-
{ op: "L", x: 0, y: 11.64096 },
|
|
43
|
-
{ op: "L", x: 0, y: 10.82089 },
|
|
44
|
-
{ op: "L", x: 1.3495, y: 10.82089 },
|
|
45
|
-
{ op: "C", cx1: 1.63987, cy1: 10.82089, cx2: 1.95616, cy2: 10.60139, x: 2.00799, y: 10.29146 },
|
|
46
|
-
{ op: "L", x: 5.15868, y: 1.45926 },
|
|
47
|
-
{ op: "L", x: 5.15868, y: 1.29795 },
|
|
48
|
-
{ op: "C", cx1: 5.15868, cy1: 1.05888, cx2: 5.01667, cy2: 0.90391, x: 4.91988, y: 0.90391 },
|
|
49
|
-
{ op: "C", cx1: 4.69378, cy1: 0.90391, cx2: 4.46132, cy2: 1.02662, x: 4.21591, y: 1.27203 },
|
|
50
|
-
{ op: "C", cx1: 3.97076, cy1: 1.51744, cx2: 3.7383, cy2: 1.81442, x: 3.51881, y: 2.16297 },
|
|
51
|
-
{ op: "C", cx1: 3.30566, cy1: 2.51152, cx2: 3.10547, cy2: 2.86033, x: 2.93119, y: 3.20888 },
|
|
52
|
-
{ op: "L", x: 2.53743, y: 3.99669 },
|
|
53
|
-
{ op: "L", x: 2.53743, y: 3.99669 },
|
|
54
|
-
{ op: "L", x: 2.53741, y: 3.99669 },
|
|
55
|
-
{ op: "Z" },
|
|
56
|
-
],
|
|
57
|
-
style: { fill: "#000" },
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
onTimeState: state => { state.velocity = PIANO_VELOCITY; },
|
|
61
|
-
};
|