jpfun 0.9.0 → 1.1.0

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.
Files changed (125) hide show
  1. package/README.md +11 -16
  2. package/dist/diagnostic.d.ts +29 -2
  3. package/dist/diagnostic.js +5 -4
  4. package/dist/functions/arpeggio/index.js +2 -3
  5. package/dist/functions/bar/index.d.ts +3 -0
  6. package/dist/functions/bar/index.js +21 -3
  7. package/dist/functions/beam/layout.js +3 -2
  8. package/dist/functions/box/index.js +1 -0
  9. package/dist/functions/dash/index.js +5 -2
  10. package/dist/functions/default.js +2 -1
  11. package/dist/functions/div/index.d.ts +1 -1
  12. package/dist/functions/div/index.js +4 -2
  13. package/dist/functions/dyn/index.js +1 -0
  14. package/dist/functions/gliss/index.js +85 -9
  15. package/dist/functions/grace/index.d.ts +1 -8
  16. package/dist/functions/grace/index.js +23 -53
  17. package/dist/functions/head/index.js +23 -30
  18. package/dist/functions/key/index.js +5 -7
  19. package/dist/functions/meter/index.d.ts +1 -0
  20. package/dist/functions/meter/index.js +3 -0
  21. package/dist/functions/meter/shape.d.ts +1 -1
  22. package/dist/functions/note/accidentals.d.ts +3 -3
  23. package/dist/functions/note/accidentals.js +29 -16
  24. package/dist/functions/note/index.d.ts +5 -2
  25. package/dist/functions/note/index.js +168 -25
  26. package/dist/functions/note/source-transform.d.ts +23 -2
  27. package/dist/functions/note/source-transform.js +95 -74
  28. package/dist/functions/ottava/index.js +1 -0
  29. package/dist/functions/page/index.d.ts +1 -36
  30. package/dist/functions/page/index.js +8 -7
  31. package/dist/functions/rest/index.js +8 -6
  32. package/dist/functions/set/index.js +2 -2
  33. package/dist/functions/slide/index.js +1 -0
  34. package/dist/functions/stack/index.js +6 -4
  35. package/dist/functions/temporal.d.ts +12 -3
  36. package/dist/functions/temporal.js +15 -2
  37. package/dist/functions/text/index.js +2 -2
  38. package/dist/functions/tie/index.js +28 -4
  39. package/dist/functions/tremolo/index.js +1 -0
  40. package/dist/functions/tuplet/index.js +1 -0
  41. package/dist/functions/up/index.js +12 -12
  42. package/dist/functions/voice/connections.d.ts +1 -1
  43. package/dist/functions/voice/connections.js +2 -2
  44. package/dist/functions/voice/lyrics.d.ts +11 -5
  45. package/dist/functions/voice/lyrics.js +151 -47
  46. package/dist/functions/voice/voice.d.ts +6 -2
  47. package/dist/functions/voice/voice.js +51 -19
  48. package/dist/functions/voice/voices.d.ts +2 -1
  49. package/dist/functions/voice/voices.js +4 -3
  50. package/dist/functions/volta/index.js +1 -0
  51. package/dist/index.d.ts +69 -3
  52. package/dist/index.js +69 -3
  53. package/dist/jpfun.min.js +47 -60
  54. package/dist/layout/engine.d.ts +4 -3
  55. package/dist/layout/engine.js +173 -27
  56. package/dist/layout/model.d.ts +13 -4
  57. package/dist/layout/model.js +15 -7
  58. package/dist/layout/page.js +2 -2
  59. package/dist/layout/path.js +1 -1
  60. package/dist/layout/types.d.ts +12 -3
  61. package/dist/lowering/accidentalMemory.d.ts +33 -0
  62. package/dist/lowering/accidentalMemory.js +84 -0
  63. package/dist/lowering/loweringContext.js +4 -0
  64. package/dist/parser/grammarType.d.ts +8 -3
  65. package/dist/parser/parse-utils/brace-utils.js +7 -17
  66. package/dist/parser/parse-utils/call-utils.d.ts +3 -1
  67. package/dist/parser/parse-utils/call-utils.js +17 -32
  68. package/dist/parser/parse-utils/note-utils.d.ts +4 -0
  69. package/dist/parser/parse-utils/note-utils.js +8 -12
  70. package/dist/parser/parse-utils/string-utils.d.ts +1 -1
  71. package/dist/parser/parse-utils/string-utils.js +1 -1
  72. package/dist/parser/parserContext.d.ts +32 -26
  73. package/dist/parser/parserContext.js +104 -194
  74. package/dist/parser/preprocess.d.ts +7 -0
  75. package/dist/parser/preprocess.js +31 -42
  76. package/dist/parser/syntax.d.ts +9 -0
  77. package/dist/parser/syntax.js +109 -0
  78. package/dist/pipeline.d.ts +1 -1
  79. package/dist/pipeline.js +3 -2
  80. package/dist/playback/compile.js +5 -7
  81. package/dist/playback/event.d.ts +1 -2
  82. package/dist/playback/event.js +2 -3
  83. package/dist/render/canvas.js +50 -35
  84. package/dist/render/index.d.ts +2 -1
  85. package/dist/render/index.js +2 -1
  86. package/dist/render/paint.d.ts +7 -0
  87. package/dist/render/paint.js +70 -20
  88. package/dist/render/recording.d.ts +8 -1
  89. package/dist/render/recording.js +12 -0
  90. package/dist/render/svg.d.ts +5 -1
  91. package/dist/render/svg.js +37 -17
  92. package/dist/render/text.d.ts +2 -2
  93. package/dist/render/text.js +7 -6
  94. package/dist/render/translate.d.ts +3 -1
  95. package/dist/render/translate.js +6 -0
  96. package/dist/render/types.d.ts +9 -0
  97. package/grammar.md +7 -5
  98. package/package.json +8 -18
  99. package/dist/converter/midi/convert.d.ts +0 -42
  100. package/dist/converter/midi/convert.js +0 -682
  101. package/dist/converter/midi/index.d.ts +0 -5
  102. package/dist/converter/midi/index.js +0 -11
  103. package/dist/converter/midi/json.d.ts +0 -38
  104. package/dist/converter/midi/json.js +0 -1
  105. package/dist/converter/midi/triplet.d.ts +0 -30
  106. package/dist/converter/midi/triplet.js +0 -75
  107. package/dist/converter/musicxml/dom.d.ts +0 -25
  108. package/dist/converter/musicxml/dom.js +0 -65
  109. package/dist/converter/musicxml/features.d.ts +0 -114
  110. package/dist/converter/musicxml/features.js +0 -501
  111. package/dist/converter/musicxml/index.d.ts +0 -14
  112. package/dist/converter/musicxml/index.js +0 -1285
  113. package/dist/converter/musicxml/model.d.ts +0 -176
  114. package/dist/converter/musicxml/model.js +0 -1
  115. package/dist/converter/musicxml/resolve.d.ts +0 -10
  116. package/dist/converter/musicxml/resolve.js +0 -152
  117. package/dist/converter/source.d.ts +0 -19
  118. package/dist/converter/source.js +0 -53
  119. package/dist/core.d.ts +0 -24
  120. package/dist/core.js +0 -24
  121. package/dist/functions/voice/index.d.ts +0 -2
  122. package/dist/functions/voice/index.js +0 -2
  123. package/dist/jpfun.core.min.js +0 -132
  124. package/dist/jpfun.from-midi.min.js +0 -9
  125. package/dist/jpfun.from-musicxml.min.js +0 -12
@@ -1,11 +0,0 @@
1
- import { ANCHOR_KEY } from "../../functions/temporal.js";
2
- import { DEFAULT_PAGE_CONFIG } from "../../layout/page.js";
3
- import { compileScore } from "../../pipeline.js";
4
- import { convertMidiJsonToJpFun, } from "./convert.js";
5
- export function midiJsonToJpFun(input, options = {}) {
6
- return convertMidiJsonToJpFun(input, options, {
7
- compileScore,
8
- anchorKey: ANCHOR_KEY,
9
- page: DEFAULT_PAGE_CONFIG,
10
- });
11
- }
@@ -1,38 +0,0 @@
1
- /** midi.js JSON() 返回值的输入契约,转换器只依赖这些字段 */
2
- export interface MidiJsonNote {
3
- ticks: number;
4
- durationTicks: number;
5
- midi: number;
6
- intensity: number;
7
- }
8
- export interface MidiJsonControlChange {
9
- ticks: number;
10
- controller: number;
11
- value: number;
12
- }
13
- export interface MidiJsonInstrument {
14
- ticks: number;
15
- number: number;
16
- }
17
- export interface MidiJsonTrack {
18
- channel: number;
19
- name: string;
20
- controlChanges: readonly MidiJsonControlChange[];
21
- instruments: readonly MidiJsonInstrument[];
22
- notes: readonly MidiJsonNote[];
23
- }
24
- export interface MidiJson {
25
- header: {
26
- name: string;
27
- tick: number;
28
- tempos: readonly {
29
- ticks: number;
30
- bpm: number;
31
- }[];
32
- timeSignatures: readonly {
33
- ticks: number;
34
- timeSignature: readonly [number, number];
35
- }[];
36
- };
37
- tracks: readonly MidiJsonTrack[];
38
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,30 +0,0 @@
1
- /**
2
- * MIDI 3:2 三连音识别器
3
- *
4
- * 本模块只在原始 tick 时间线上标记三连音,不负责二进制量化或 jpFun 输出。
5
- * 调用方随后把三个槽折叠成一个 QuantizedTriplet,并输出 @tuplet(..., 2)。
6
- */
7
- export interface TripletMark {
8
- group: number;
9
- slot: number;
10
- startTicks: number;
11
- spanTicks: number;
12
- }
13
- interface TripletNote {
14
- ticks: number;
15
- durationTicks: number;
16
- triplet?: TripletMark;
17
- }
18
- /**
19
- * 标记四分、八分和十六分的 3:2 三连音。
20
- *
21
- * 每个候选必须同时满足:三个槽都有音符、起点和时值都接近三分网格、
22
- * 三分网格明显优于四等分网格,并且整组不跨小节、拍号或速度变化。
23
- * 和弦按一个槽评分,不会因为某个槽音符更多而改变判断。
24
- *
25
- * 返回 true 表示至少命中一组;命中的 note 会原地写入 triplet 标记。
26
- */
27
- export declare function identifyTriplets<T extends TripletNote>(tracks: readonly {
28
- notes: T[];
29
- }[], ticksPerQuarter: number, blockers: readonly number[]): boolean;
30
- export {};
@@ -1,75 +0,0 @@
1
- function lowerBound(items, target, valueOf) {
2
- let left = 0;
3
- let right = items.length;
4
- while (left < right) {
5
- const middle = Math.floor((left + right) / 2);
6
- if (valueOf(items[middle]) < target)
7
- left = middle + 1;
8
- else
9
- right = middle;
10
- }
11
- return left;
12
- }
13
- /**
14
- * 标记四分、八分和十六分的 3:2 三连音。
15
- *
16
- * 每个候选必须同时满足:三个槽都有音符、起点和时值都接近三分网格、
17
- * 三分网格明显优于四等分网格,并且整组不跨小节、拍号或速度变化。
18
- * 和弦按一个槽评分,不会因为某个槽音符更多而改变判断。
19
- *
20
- * 返回 true 表示至少命中一组;命中的 note 会原地写入 triplet 标记。
21
- */
22
- export function identifyTriplets(tracks, ticksPerQuarter, blockers) {
23
- // 人工演奏容差随 PPQ 缩放,但不会超过单个三连槽宽的 1/8。
24
- const performanceTolerance = Math.max(1, Math.round(ticksPerQuarter / 48));
25
- const candidates = [];
26
- const orderedBlockers = [...blockers].sort((left, right) => left - right);
27
- for (const track of tracks) {
28
- const notes = [...track.notes].sort((left, right) => left.ticks - right.ticks);
29
- for (const span of [ticksPerQuarter / 2, ticksPerQuarter, ticksPerQuarter * 2]) {
30
- const unit = span / 3;
31
- const tolerance = Math.min(performanceTolerance, unit / 8);
32
- const startStep = span / 2;
33
- const starts = new Set(notes.map(note => Math.round(note.ticks / startStep) * startStep)
34
- .filter((start, index) => Math.abs(notes[index].ticks - start) <= tolerance));
35
- for (const start of starts) {
36
- const end = start + span;
37
- let blockerIndex = lowerBound(orderedBlockers, start, value => value);
38
- while (orderedBlockers[blockerIndex] === start)
39
- blockerIndex++;
40
- if (orderedBlockers[blockerIndex] < end)
41
- continue;
42
- const slots = [0, 1, 2].map(slot => {
43
- const target = start + slot * unit;
44
- const from = lowerBound(notes, target - tolerance, note => note.ticks);
45
- const to = lowerBound(notes, target + tolerance + 1, note => note.ticks);
46
- return notes.slice(from, to).filter(note => Math.abs(note.ticks - target) <= tolerance
47
- && Math.abs(note.durationTicks - unit) <= tolerance);
48
- });
49
- if (slots.some(slot => slot.length === 0))
50
- continue;
51
- const onsets = slots.map(slot => slot.reduce((sum, note) => sum + note.ticks, 0) / slot.length);
52
- const tripletError = onsets.reduce((sum, onset, slot) => sum + Math.abs(onset - (start + slot * unit)), 0) / 3;
53
- const binaryStep = span / 4;
54
- const binaryError = onsets.reduce((sum, onset) => sum + Math.abs(onset - (start + Math.round((onset - start) / binaryStep) * binaryStep)), 0) / 3;
55
- if (binaryError - tripletError >= tolerance) {
56
- candidates.push({ notes: slots, start, span, advantage: binaryError - tripletError });
57
- }
58
- }
59
- }
60
- }
61
- // 重叠候选先采用相对普通网格优势更大的那一组,每个 note 最多归属一组。
62
- candidates.sort((left, right) => right.advantage - left.advantage);
63
- let group = 0;
64
- for (const candidate of candidates) {
65
- if (candidate.notes.some(slot => slot.some(note => note.triplet)))
66
- continue;
67
- for (let slot = 0; slot < 3; slot++) {
68
- for (const note of candidate.notes[slot]) {
69
- note.triplet = { group, slot, startTicks: candidate.start, spanTicks: candidate.span };
70
- }
71
- }
72
- group++;
73
- }
74
- return group > 0;
75
- }
@@ -1,25 +0,0 @@
1
- export interface MusicXmlNode {
2
- readonly nodeType: number;
3
- }
4
- /** 浏览器 Element 与第三方 XML DOM 都能满足的最小读取接口 */
5
- export interface MusicXmlElement extends MusicXmlNode {
6
- readonly localName: string | null;
7
- readonly tagName: string;
8
- readonly childNodes: ArrayLike<MusicXmlNode>;
9
- readonly textContent: string | null;
10
- getAttribute(name: string): string | null;
11
- }
12
- /** 读取忽略命名空间前缀的元素名 */
13
- export declare function nameOf(element: MusicXmlElement): string;
14
- /** 返回全部直接子元素,可按元素名筛选 */
15
- export declare function children(parent: MusicXmlElement, name?: string): MusicXmlElement[];
16
- /** 返回第一个同名直接子元素 */
17
- export declare function child(parent: MusicXmlElement, name: string): MusicXmlElement | undefined;
18
- /** 按文档顺序深度优先查找第一个同名后代元素 */
19
- export declare function descendant(parent: MusicXmlElement, name: string): MusicXmlElement | undefined;
20
- /** 按文档顺序收集全部同名后代元素 */
21
- export declare function descendants(parent: MusicXmlElement, name: string): MusicXmlElement[];
22
- /** 读取自身或同名直接子元素的去空白文本 */
23
- export declare function text(parent: MusicXmlElement | undefined, name?: string): string;
24
- /** 读取有限数值,缺失时使用显式 fallback 或抛错 */
25
- export declare function number(parent: MusicXmlElement | undefined, name: string, fallback?: number): number;
@@ -1,65 +0,0 @@
1
- /** 读取忽略命名空间前缀的元素名 */
2
- export function nameOf(element) {
3
- return element.localName || element.tagName.split(":").at(-1);
4
- }
5
- /** 返回全部直接子元素,可按元素名筛选 */
6
- export function children(parent, name) {
7
- const result = [];
8
- for (let index = 0; index < parent.childNodes.length; index++) {
9
- const node = parent.childNodes[index];
10
- if (node.nodeType !== 1)
11
- continue;
12
- const element = node;
13
- if (name === undefined || nameOf(element) === name)
14
- result.push(element);
15
- }
16
- return result;
17
- }
18
- /** 返回第一个同名直接子元素 */
19
- export function child(parent, name) {
20
- for (let index = 0; index < parent.childNodes.length; index++) {
21
- const node = parent.childNodes[index];
22
- if (node.nodeType === 1 && nameOf(node) === name)
23
- return node;
24
- }
25
- return void 0;
26
- }
27
- /** 按文档顺序深度优先查找第一个同名后代元素 */
28
- export function descendant(parent, name) {
29
- for (const item of children(parent)) {
30
- if (nameOf(item) === name)
31
- return item;
32
- const nested = descendant(item, name);
33
- if (nested)
34
- return nested;
35
- }
36
- return void 0;
37
- }
38
- /** 按文档顺序收集全部同名后代元素 */
39
- export function descendants(parent, name) {
40
- const result = [];
41
- for (const item of children(parent)) {
42
- if (nameOf(item) === name)
43
- result.push(item);
44
- result.push(...descendants(item, name));
45
- }
46
- return result;
47
- }
48
- /** 读取自身或同名直接子元素的去空白文本 */
49
- export function text(parent, name) {
50
- const element = name === undefined ? parent : parent && child(parent, name);
51
- return element?.textContent?.trim() ?? "";
52
- }
53
- /** 读取有限数值,缺失时使用显式 fallback 或抛错 */
54
- export function number(parent, name, fallback) {
55
- const source = text(parent, name);
56
- if (source === "") {
57
- if (fallback !== undefined)
58
- return fallback;
59
- throw new RangeError(`MusicXML <${name}> must contain a finite number`);
60
- }
61
- const value = Number(source);
62
- if (Number.isFinite(value))
63
- return value;
64
- throw new RangeError(`MusicXML <${name}> must contain a finite number`);
65
- }
@@ -1,114 +0,0 @@
1
- import { type MusicXmlElement } from "./dom.js";
2
- import type { MusicXmlArpeggio, MusicXmlDiagnostic, MusicXmlEvent, MusicXmlPitch, MusicXmlRepeatPoint, MusicXmlRepeatSymbol, ParsedMusicXmlScore } from "./model.js";
3
- /** 统一两种 MusicXML 根结构中的小节内容与外层小节容器 */
4
- export interface MusicXmlMeasureSource {
5
- body: MusicXmlElement;
6
- container: MusicXmlElement;
7
- }
8
- /** 识别 <words> 中的标准反复跳转与终止术语 */
9
- export declare function repeatWordSymbol(value: string): MusicXmlRepeatSymbol | undefined;
10
- declare const DIAGNOSTICS: {
11
- readonly percussion: readonly ["PERCUSSION_SKIPPED", "MIDI channel 10 percussion note was omitted."];
12
- readonly displayPitch: readonly ["APPROXIMATED", "Unpitched note was converted to a melodic note using its display pitch."];
13
- readonly afterGrace: readonly ["APPROXIMATED", "After-grace note has no preceding event and was treated as a before-grace note."];
14
- readonly wedge: readonly ["APPROXIMATED", "Wedge was mapped to note onsets with a fixed velocity change of {value}."];
15
- readonly unsupported: readonly ["UNSUPPORTED_ELEMENT", "MusicXML <{value}> was omitted."];
16
- readonly gracePitch: readonly ["UNATTACHED_CONTENT", "Grace note without a pitch was omitted."];
17
- readonly graceHost: readonly ["UNATTACHED_CONTENT", "Before-grace note has no following event and was omitted."];
18
- readonly dynamicHost: readonly ["UNATTACHED_CONTENT", "Dynamic {value} has no target voice and was omitted."];
19
- readonly directionOutput: readonly ["UNATTACHED_CONTENT", "Direction mark has no generated output position and was omitted."];
20
- readonly tempoReplaced: readonly ["UNATTACHED_CONTENT", "Tempo {value} was replaced by a different tempo at the same time and was omitted."];
21
- readonly arpeggioOutput: readonly ["UNSUPPORTED_ELEMENT", "Arpeggiate mark requires at least two pitches in one event and was omitted."];
22
- readonly multipleRest: readonly ["APPROXIMATED", "Multiple-rest grouping could not be preserved without discarding musical content; individual rests were retained."];
23
- readonly textHost: readonly ["UNATTACHED_CONTENT", "Text {value} has no target event and was omitted."];
24
- readonly wedgeStart: readonly ["UNRESOLVED_RELATION", "Wedge stop has no matching start and was omitted."];
25
- readonly wedgeReplaced: readonly ["UNRESOLVED_RELATION", "Wedge start was replaced before a matching stop and was omitted."];
26
- readonly wedgeStop: readonly ["UNRESOLVED_RELATION", "Wedge start has no matching stop and was omitted."];
27
- readonly wedgeVoice: readonly ["UNRESOLVED_RELATION", "Wedge has no target voice and was omitted."];
28
- readonly wedgeEndpoints: readonly ["UNRESOLVED_RELATION", "Wedge has no two distinct note onsets to use as endpoints and was omitted."];
29
- readonly endingStart: readonly ["UNRESOLVED_RELATION", "Ending stop has no matching start and was omitted."];
30
- readonly endingReplaced: readonly ["UNRESOLVED_RELATION", "Ending start was replaced before a matching stop and was omitted."];
31
- readonly endingStop: readonly ["UNRESOLVED_RELATION", "Ending start has no matching stop and was omitted."];
32
- readonly endingEndpoints: readonly ["UNRESOLVED_RELATION", "Ending has no event endpoints in its interval and was omitted."];
33
- readonly tieStart: readonly ["UNRESOLVED_RELATION", "Tie stop has no matching start and was omitted."];
34
- readonly tieStop: readonly ["UNRESOLVED_RELATION", "Tie start has no matching stop in any ending branch and was omitted."];
35
- readonly glissStart: readonly ["UNRESOLVED_RELATION", "Glissando stop has no matching start and was omitted."];
36
- readonly glissStop: readonly ["UNRESOLVED_RELATION", "Glissando start has no matching stop and was omitted."];
37
- readonly glissReplaced: readonly ["UNRESOLVED_RELATION", "Glissando start was replaced before a matching stop and was omitted."];
38
- readonly glissEndpoints: readonly ["UNRESOLVED_RELATION", "Glissando endpoints are simultaneous and were omitted."];
39
- readonly glissStyle: readonly ["APPROXIMATED", "MusicXML <{value}> was converted to a straight glissando arrow."];
40
- readonly symbolStyle: readonly ["APPROXIMATED", "MusicXML <{value}> was mapped to the default symbol shape."];
41
- };
42
- export declare function reportDiagnostic(diagnostics: MusicXmlDiagnostic[], issue: keyof typeof DIAGNOSTICS, location: MusicXmlDiagnostic["location"], value?: string | number): void;
43
- /** 查询不改变覆盖状态;解析结果写入语义模型后显式确认,未确认项按 XML 顺序报告 */
44
- export declare class MusicXmlReader {
45
- private readonly roots;
46
- private readonly accepted;
47
- constructor(roots: readonly MusicXmlElement[]);
48
- read(name: string, deep?: boolean, parent?: MusicXmlElement): MusicXmlElement | undefined;
49
- readAll(name: string, deep?: boolean): MusicXmlElement[];
50
- accept(element: MusicXmlElement | undefined): void;
51
- report(diagnostics: MusicXmlDiagnostic[], location: MusicXmlDiagnostic["location"], parent?: MusicXmlElement): void;
52
- }
53
- /** 将 score-partwise 和 score-timewise 统一为每个 part 的小节序列 */
54
- export declare function partMeasures(root: MusicXmlElement): Map<string, MusicXmlMeasureSource[]>;
55
- /** 校验 MIDI 乐器字段,并将一基 program 转为内部零基编号 */
56
- export declare function readInstrument(midi: MusicXmlElement): {
57
- channel?: number;
58
- program?: number;
59
- };
60
- /** 文档元数据不参与时间推进;仅完整的页面声明覆盖默认页面 */
61
- export declare function scoreMetadata(root: MusicXmlElement): Pick<ParsedMusicXmlScore, "title" | "subtitle" | "creator" | "page">;
62
- /** 解析书面音高及该和弦成员自己的 tie 起止标记 */
63
- export declare function parsePitch(note: MusicXmlElement, location: MusicXmlPitch["location"], notations?: MusicXmlReader): MusicXmlPitch | null;
64
- export declare function transposePitch(pitch: MusicXmlPitch, chromatic: number, diatonic: number | undefined, octaves: number): void;
65
- /** 将支持的延长、奏法与装饰音记号转成 jpFun 修饰符 */
66
- export declare function noteModifiers(notations: MusicXmlReader | undefined, diagnostics: MusicXmlDiagnostic[], location: MusicXmlDiagnostic["location"]): {
67
- modifiers: {
68
- name: string;
69
- placement: "above" | "below";
70
- }[];
71
- slides: {
72
- side: "pre" | "post";
73
- direction: "up" | "down";
74
- }[];
75
- };
76
- /** 双音 slide 与 glissando 均是标签关系;与 articulations 下的单音滑音区别处理 */
77
- export declare function noteGlissandi(notations: MusicXmlReader | undefined, pitch: MusicXmlPitch | null, diagnostics: MusicXmlDiagnostic[]): void;
78
- /** 无箭头不覆盖显式方向,两个相反的显式方向不能属于同一和弦 */
79
- export declare function mergeArpeggio(current?: MusicXmlArpeggio, next?: MusicXmlArpeggio): MusicXmlArpeggio | undefined;
80
- /** 读取和弦成员上的琶音方向;none 表示无箭头但仍按自下而上演奏 */
81
- export declare function noteArpeggio(notations: MusicXmlReader | undefined, location: MusicXmlPitch["location"]): MusicXmlArpeggio | undefined;
82
- /** 解析 tuplet 的实际音数与正常音数,并保留显式组边界 */
83
- export declare function timeModification(note: MusicXmlElement, tuplets: readonly MusicXmlElement[] | undefined): {
84
- actual: number;
85
- normal: number;
86
- start: boolean;
87
- stop: boolean;
88
- } | undefined;
89
- /** 和弦成员可重复声明同一边界;仅确认最终事件确实持有的节奏标记 */
90
- export declare function acceptTuplets(notations: MusicXmlReader | undefined, tuplets: readonly MusicXmlElement[] | undefined, rhythm: MusicXmlEvent["timeModification"]): void;
91
- /** 按 verse 收集歌词并用尾部连字符保留音节延续 */
92
- export declare function noteLyrics(note: MusicXmlElement): Map<string, string>;
93
- /** 返回 dynamics 中首个受支持的力度记号 */
94
- export declare function directionDynamic(dynamics: MusicXmlElement | undefined, diagnostics: MusicXmlDiagnostic[], location: MusicXmlDiagnostic["location"]): string | undefined;
95
- /** 收集排练标记、反复记号与普通文字,排练标记保留方框语义;空白文字视为空内容 */
96
- export declare function directionTexts(direction: MusicXmlReader, defaultPlacement?: "above" | "below", location?: MusicXmlDiagnostic["location"]): {
97
- texts: {
98
- text: string;
99
- boxed: boolean;
100
- }[];
101
- repeats: Omit<MusicXmlRepeatPoint, "at">[];
102
- };
103
- /** 读取 <sound> 上的反复与跳转属性 */
104
- export declare function soundRepeats(sound: MusicXmlElement | undefined, placement: "above" | "below", location: MusicXmlDiagnostic["location"]): Omit<MusicXmlRepeatPoint, "at">[];
105
- /** 将 metronome 的拍单位和附点折算成四分音符 BPM */
106
- export declare function metronomeBpm(metronome: MusicXmlElement | undefined): number | undefined;
107
- /** 将单一或复合拍号归一成一个等值分数 */
108
- export declare function parseTimeSignature(time: MusicXmlElement): {
109
- numerator: number;
110
- denominator: number;
111
- };
112
- /** 展开逗号分隔的遍数与闭区间范围,并返回升序去重结果 */
113
- export declare function endingPasses(value: string): number[];
114
- export {};