jpfun 0.7.0 → 0.9.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.
- package/Bravura-LICENSE.txt +93 -0
- package/README.md +49 -146
- package/dist/Bravura-LICENSE.txt +93 -0
- package/dist/converter/midi/convert.d.ts +0 -10
- package/dist/converter/midi/convert.js +19 -56
- package/dist/converter/musicxml/features.d.ts +16 -8
- package/dist/converter/musicxml/features.js +88 -19
- package/dist/converter/musicxml/index.js +88 -50
- package/dist/converter/musicxml/model.d.ts +9 -0
- package/dist/converter/source.d.ts +4 -7
- package/dist/converter/source.js +11 -9
- package/dist/core.d.ts +1 -0
- package/dist/core.js +1 -0
- package/dist/diagnostic.d.ts +7 -1
- package/dist/diagnostic.js +40 -88
- package/dist/fraction.js +3 -2
- package/dist/functions/ASTtypes.d.ts +3 -32
- package/dist/functions/ASTtypes.js +5 -52
- package/dist/functions/adjust/index.js +45 -33
- package/dist/functions/arpeggio/index.js +50 -55
- package/dist/functions/arpeggio/shape.d.ts +2 -3
- package/dist/functions/arpeggio/shape.js +20 -50
- package/dist/functions/bar/index.d.ts +8 -0
- package/dist/functions/bar/index.js +105 -8
- package/dist/functions/beam/auto.d.ts +1 -2
- package/dist/functions/beam/auto.js +80 -135
- package/dist/functions/beam/index.js +6 -12
- package/dist/functions/beam/layout.d.ts +1 -1
- package/dist/functions/beam/layout.js +1 -1
- package/dist/functions/box/index.js +0 -6
- package/dist/functions/br/index.d.ts +34 -2
- package/dist/functions/br/index.js +5 -4
- package/dist/functions/dash/index.js +9 -10
- package/dist/functions/default.js +2 -1
- package/dist/functions/div/index.d.ts +3 -4
- package/dist/functions/div/index.js +18 -14
- package/dist/functions/dot/index.js +5 -11
- package/dist/functions/dyn/index.js +55 -57
- package/dist/functions/gliss/index.js +131 -103
- package/dist/functions/grace/index.d.ts +3 -12
- package/dist/functions/grace/index.js +52 -102
- package/dist/functions/head/index.js +10 -7
- package/dist/functions/key/index.js +13 -15
- package/dist/functions/meter/index.d.ts +56 -1
- package/dist/functions/meter/index.js +15 -10
- package/dist/functions/note/index.js +6 -6
- package/dist/functions/note/noteName.d.ts +16 -0
- package/dist/functions/note/noteName.js +88 -0
- package/dist/functions/note/source-transform.js +8 -10
- package/dist/functions/ottava/index.js +35 -40
- package/dist/functions/page/index.d.ts +1 -0
- package/dist/functions/page/index.js +27 -21
- package/dist/functions/pagebreak/index.js +2 -2
- package/dist/functions/rest/index.js +5 -5
- package/dist/functions/set/index.js +4 -4
- package/dist/functions/slide/index.js +0 -1
- package/dist/functions/stack/index.js +8 -57
- package/dist/functions/symbol/index.d.ts +21 -2
- package/dist/functions/symbol/index.js +69 -24
- package/dist/functions/symbol/ornament.d.ts +1 -2
- package/dist/functions/symbol/shape.d.ts +6 -0
- package/dist/functions/symbol/shape.js +16 -3
- package/dist/functions/symbol/symbols/coda.d.ts +4 -0
- package/dist/functions/symbol/symbols/coda.js +56 -0
- package/dist/functions/symbol/symbols/dynamics.d.ts +1 -1
- package/dist/functions/symbol/symbols/dynamics.js +18 -8
- package/dist/functions/symbol/symbols/harmonic.d.ts +2 -0
- package/dist/functions/symbol/symbols/harmonic.js +11 -0
- package/dist/functions/symbol/symbols/marcato.d.ts +2 -0
- package/dist/functions/symbol/symbols/marcato.js +22 -0
- package/dist/functions/symbol/symbols/staccato.d.ts +2 -0
- package/dist/functions/symbol/symbols/staccato.js +24 -0
- package/dist/functions/symbol/symbols/tenuto.d.ts +2 -0
- package/dist/functions/symbol/symbols/tenuto.js +11 -0
- package/dist/functions/symbol/symbols/tocoda.d.ts +2 -0
- package/dist/functions/symbol/symbols/tocoda.js +16 -0
- package/dist/functions/symbol/symbols/turn.d.ts +3 -0
- package/dist/functions/symbol/symbols/turn.js +50 -0
- package/dist/functions/symbol/symbols/wheel.d.ts +2 -0
- package/dist/functions/symbol/symbols/wheel.js +36 -0
- package/dist/functions/temporal.d.ts +3 -2
- package/dist/functions/temporal.js +8 -0
- package/dist/functions/text/index.js +38 -35
- package/dist/functions/tie/index.js +44 -43
- package/dist/functions/tremolo/index.d.ts +2 -0
- package/dist/functions/tremolo/index.js +318 -0
- package/dist/functions/tuplet/index.js +4 -14
- package/dist/functions/up/index.js +81 -85
- package/dist/functions/voice/connections.d.ts +2 -1
- package/dist/functions/voice/connections.js +48 -10
- package/dist/functions/voice/index.d.ts +2 -3
- package/dist/functions/voice/index.js +2 -963
- package/dist/functions/voice/lyrics.d.ts +30 -0
- package/dist/functions/voice/lyrics.js +289 -0
- package/dist/functions/voice/voice.d.ts +63 -0
- package/dist/functions/voice/voice.js +373 -0
- package/dist/functions/voice/voices.d.ts +106 -0
- package/dist/functions/voice/voices.js +423 -0
- package/dist/functions/volta/index.js +5 -23
- package/dist/jpfun.core.min.js +76 -59
- package/dist/jpfun.from-midi.min.js +5 -5
- package/dist/jpfun.from-musicxml.min.js +8 -8
- package/dist/jpfun.min.js +81 -64
- package/dist/layout/default.d.ts +0 -1
- package/dist/layout/default.js +0 -1
- package/dist/layout/engine.js +30 -18
- package/dist/layout/model.d.ts +0 -1
- package/dist/layout/model.js +1 -4
- package/dist/layout/page.d.ts +2 -1
- package/dist/layout/page.js +14 -14
- package/dist/layout/range.d.ts +7 -6
- package/dist/layout/range.js +23 -14
- package/dist/layout/types.d.ts +9 -28
- package/dist/lowering/loweringContext.d.ts +18 -23
- package/dist/lowering/loweringContext.js +33 -46
- package/dist/lowering/track.d.ts +8 -1
- package/dist/lowering/types.d.ts +13 -11
- package/dist/parser/parse-utils/call-utils.d.ts +1 -2
- package/dist/parser/parse-utils/call-utils.js +6 -34
- package/dist/parser/parse-utils/note-utils.d.ts +3 -3
- package/dist/parser/parse-utils/note-utils.js +21 -33
- package/dist/parser/parse-utils/string-utils.d.ts +3 -2
- package/dist/parser/parse-utils/string-utils.js +20 -5
- package/dist/parser/parserContext.d.ts +9 -9
- package/dist/parser/parserContext.js +62 -11
- package/dist/pipeline.js +2 -3
- package/dist/playback/compile.js +131 -82
- package/dist/playback/event.d.ts +6 -6
- package/dist/playback/event.js +13 -49
- package/dist/playback/time.js +42 -31
- package/dist/playback/types.d.ts +3 -1
- package/dist/render/canvas.js +4 -22
- package/dist/render/recording.js +1 -4
- package/dist/render/svg.d.ts +0 -1
- package/dist/render/svg.js +33 -31
- package/dist/render/text.d.ts +36 -1
- package/dist/render/text.js +134 -0
- package/dist/render/translate.d.ts +0 -1
- package/dist/render/translate.js +6 -23
- package/dist/render/types.d.ts +0 -2
- package/grammar.md +39 -30
- package/package.json +3 -3
- package/dist/functions/note/noteNameFSM.d.ts +0 -8
- package/dist/functions/note/noteNameFSM.js +0 -181
- package/dist/iife/core.d.ts +0 -1
- package/dist/iife/core.js +0 -3
- package/dist/iife/from-midi.d.ts +0 -1
- package/dist/iife/from-midi.js +0 -15
- package/dist/iife/from-musicxml.d.ts +0 -1
- package/dist/iife/from-musicxml.js +0 -3
- package/dist/iife/full.d.ts +0 -1
- package/dist/iife/full.js +0 -3
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright (c) 2026, Steinberg Media Technologies GmbH (http://www.steinberg.net/),
|
|
2
|
+
with Reserved Font Name "Bravura".
|
|
3
|
+
|
|
4
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
5
|
+
This license is copied below, and is also available with a FAQ at:
|
|
6
|
+
http://scripts.sil.org/OFL
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION AND CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
# jpFun
|
|
2
2
|
|
|
3
|
-
A TypeScript engine that compiles a
|
|
3
|
+
A zero-dependency TypeScript engine that compiles a functional numbered-notation (Jianpu) DSL into SVG, Canvas, and layout-independent playback plans.
|
|
4
4
|
|
|
5
|
-
[Documentation](https://madderscientist.github.io/jpFun/)
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- Extensible music DSL with exact rational timing
|
|
10
|
-
- Automatic spacing and pagination, shared by SVG and Canvas
|
|
11
|
-
- Structured diagnostics and source-aware editing
|
|
12
|
-
- Zero runtime dependencies; works in Node.js and modern browsers
|
|
5
|
+
[Documentation](https://madderscientist.github.io/jpFun/docs/) · [Playground](https://madderscientist.github.io/jpFun/playground) · [Grammar Reference](grammar.md)
|
|
13
6
|
|
|
14
7
|
## Installation
|
|
15
8
|
|
|
@@ -17,188 +10,98 @@ A TypeScript engine that compiles a compact numbered-notation DSL into SVG or Ca
|
|
|
17
10
|
npm install jpfun
|
|
18
11
|
```
|
|
19
12
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## Browser via CDN
|
|
13
|
+
The npm package is ESM-only and supports Node.js 18+ and modern browsers.
|
|
23
14
|
|
|
24
|
-
|
|
15
|
+
Or load via CDN (`globalThis.jpfun`):
|
|
25
16
|
|
|
26
17
|
```html
|
|
27
18
|
<script src="https://unpkg.com/jpfun"></script>
|
|
28
|
-
<script>
|
|
29
|
-
const { compileScore, renderLayoutPagesToSvg } = jpfun;
|
|
30
|
-
document.body.innerHTML = renderLayoutPagesToSvg(compileScore("1 2 3 | 4 -").layout)[0];
|
|
31
|
-
</script>
|
|
32
19
|
```
|
|
33
20
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```html
|
|
37
|
-
<script type="module">
|
|
38
|
-
import { compileScore } from "https://cdn.jsdelivr.net/npm/jpfun/+esm";
|
|
39
|
-
</script>
|
|
40
|
-
```
|
|
21
|
+
In production, pin all CDN bundles to the same `jpfun@x.y.z` version.
|
|
41
22
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Optional bundles under `https://unpkg.com/jpfun/dist/` share the same global:
|
|
23
|
+
IIFE bundles under `jpfun/dist/` share the `jpfun` global:
|
|
45
24
|
|
|
46
25
|
| Bundle | Capabilities |
|
|
47
26
|
| --- | --- |
|
|
48
|
-
| `jpfun.
|
|
27
|
+
| `jpfun.min.js` | Core and both converters |
|
|
28
|
+
| `jpfun.core.min.js` | Compilation, rendering, playback, and source editing; no converters |
|
|
29
|
+
| `jpfun.from-midi.min.js` | MIDI JSON import; automatic line breaking also requires core |
|
|
49
30
|
| `jpfun.from-musicxml.min.js` | Standalone MusicXML import |
|
|
50
|
-
| `jpfun.from-midi.min.js` | MIDI JSON import; automatic line breaking also requires the core bundle |
|
|
51
31
|
|
|
52
32
|
For standalone MIDI import, set a positive `barsPerLine`.
|
|
53
33
|
|
|
54
34
|
## Quick Start
|
|
55
35
|
|
|
56
36
|
```ts
|
|
57
|
-
import {
|
|
37
|
+
import {
|
|
38
|
+
compilePlayback,
|
|
39
|
+
compileScore,
|
|
40
|
+
renderLayoutPagesToSvg,
|
|
41
|
+
} from "jpfun";
|
|
58
42
|
|
|
59
43
|
const source = `
|
|
60
|
-
@1(C4)
|
|
61
|
-
@tempo(96)
|
|
62
|
-
|
|
44
|
+
@1(C4) @tempo(96)
|
|
63
45
|
1/ 2/ 3 4 | 5 -
|
|
64
46
|
`;
|
|
65
47
|
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
`renderLayoutPagesToSvg` returns one SVG string per page, ready to save or insert into a web page.
|
|
71
|
-
|
|
72
|
-
## Note Source Transformations
|
|
73
|
-
|
|
74
|
-
`transformNotes(source, lowering, operation, ranges?)` returns sorted `{ span, text }` edits for `to-absolute`, `to-relative`, `semitone-up`, or `semitone-down`. Use lowering from the same source and apply edits in one editor transaction or right to left.
|
|
75
|
-
|
|
76
|
-
Only notes fully covered by `ranges` are changed; omit it for the whole source, or pass `[]` for no changes. Conversion preserves pitch; semitone shifts preserve each note's representation. Key declarations, rests, spacers, percussion, and surrounding source are retained. Invalid note input throws a diagnostic.
|
|
77
|
-
|
|
78
|
-
## Browser Rendering
|
|
79
|
-
|
|
80
|
-
The default text measurer estimates glyph widths. For accurate browser layout, pass `CanvasTextMeasurer`, including when rendering SVG:
|
|
81
|
-
|
|
82
|
-
```ts
|
|
83
|
-
import { compileScore, CanvasTextMeasurer, renderLayoutPagesToCanvas } from "jpfun";
|
|
84
|
-
|
|
85
|
-
const context = document.createElement("canvas").getContext("2d")!;
|
|
86
|
-
const result = compileScore(source, { textMeasurer: new CanvasTextMeasurer(context) });
|
|
87
|
-
renderLayoutPagesToCanvas(result.layout, [context]);
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Canvas rendering takes one context per page. Measurement can use a separate canvas.
|
|
91
|
-
|
|
92
|
-
## Compilation Pipeline
|
|
93
|
-
|
|
94
|
-
```text
|
|
95
|
-
Source
|
|
96
|
-
-> Parser -> AST
|
|
97
|
-
-> Lowering -> timed events and relations
|
|
98
|
-
|-> Playback -> NoteOn / NoteOff / Tempo events
|
|
99
|
-
`-> Layout -> document geometry
|
|
100
|
-
-> Renderer -> SVG or Canvas
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
`compileScore` exposes `parser`, `ast`, `lowering`, and `layout`. Compile playback separately:
|
|
48
|
+
// Compile source, retaining diagnostics and intermediate results
|
|
49
|
+
const compiled = compileScore(source);
|
|
104
50
|
|
|
105
|
-
|
|
106
|
-
|
|
51
|
+
// Render to SVG strings (one per page)
|
|
52
|
+
const svgPages = renderLayoutPagesToSvg(compiled.layout);
|
|
107
53
|
|
|
108
|
-
|
|
54
|
+
// Generate timed events and score mappings; this does not play audio
|
|
55
|
+
const playback = compilePlayback(compiled.lowering);
|
|
109
56
|
```
|
|
110
57
|
|
|
111
|
-
|
|
58
|
+
Check returned `diagnostics` for recoverable problems and catch compilation errors when processing user input. The host handles audio/MIDI devices, real-time scheduling, and MIDI byte encoding.
|
|
112
59
|
|
|
113
|
-
|
|
60
|
+
For Canvas, create and size one canvas per layout page; see the [rendering example](https://madderscientist.github.io/jpFun/docs/developer/use/#渲染结果). The default text measurer estimates widths; `CanvasTextMeasurer` measures browser font widths for both SVG and Canvas layout.
|
|
114
61
|
|
|
115
|
-
|
|
62
|
+
## Core APIs
|
|
116
63
|
|
|
117
|
-
|
|
118
|
-
import { midiJsonToJpFun } from "jpfun";
|
|
119
|
-
|
|
120
|
-
const source = midiJsonToJpFun(parsedMidiJson, {
|
|
121
|
-
title: "My Score",
|
|
122
|
-
alignRate: 4,
|
|
123
|
-
barsPerLine: 0,
|
|
124
|
-
});
|
|
125
|
-
```
|
|
64
|
+
### Custom Symbols (`symbols`)
|
|
126
65
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
Preserves notes, tracks, tempo, time signatures, programs, and standard 3:2 quarter-, eighth-, and sixteenth-note triplets. Other tuplets are unsupported. Percussion channel 10, velocity, controllers, pitch bends, and lyrics are omitted; time-signature changes snap to measure boundaries.
|
|
130
|
-
|
|
131
|
-
## MusicXML Conversion
|
|
132
|
-
|
|
133
|
-
`musicXmlToJpFun` accepts a parsed MusicXML root element. Use `DOMParser` in browsers or a compatible DOM implementation in Node.js:
|
|
66
|
+
Register or override `@symbol` (`$name`) definitions for instrument-specific symbol packages:
|
|
134
67
|
|
|
135
68
|
```ts
|
|
136
|
-
import {
|
|
69
|
+
import { symbols, type SymbolDefinition } from "jpfun";
|
|
137
70
|
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
71
|
+
const dieyin: SymbolDefinition = {
|
|
72
|
+
name: "dizi.dy",
|
|
73
|
+
description: "Dieyin ornament",
|
|
74
|
+
text: { content: "又", fontFamily: "serif" },
|
|
75
|
+
emitPlayback: emitter => emitter.affectFollowing(symbols.ornament({ body: [1, 0] })),
|
|
76
|
+
};
|
|
141
77
|
|
|
142
|
-
|
|
143
|
-
barsPerLine: 4,
|
|
144
|
-
});
|
|
78
|
+
symbols.register(dieyin); // Register or override by lowercase name
|
|
145
79
|
```
|
|
146
80
|
|
|
147
|
-
The
|
|
148
|
-
|
|
149
|
-
| Code | Reported loss |
|
|
150
|
-
| --- | --- |
|
|
151
|
-
| `W_MUSICXML_PERCUSSION_SKIPPED` | Channel 10 notes omitted |
|
|
152
|
-
| `W_MUSICXML_APPROXIMATED` | Display pitches used for unpitched notes, after-grace fallback, or wedges mapped to note onsets with a fixed velocity change |
|
|
153
|
-
| `W_MUSICXML_UNSUPPORTED_ELEMENT` | Harmony and discarded children of supported notation or direction containers, including pedal, slur, unsupported articulations, ornaments, and dynamics |
|
|
154
|
-
| `W_MUSICXML_UNATTACHED_CONTENT` | Grace notes, text, or dynamics with no target |
|
|
155
|
-
| `W_MUSICXML_UNRESOLVED_RELATION` | Unmatched, replaced, unclosed, or unrenderable ties, wedges, and endings |
|
|
156
|
-
|
|
157
|
-
`location.element` is the XML tag name without its namespace prefix. Available context includes `partId`, `measureIndex` (1-based within the part), `measureNumber` (the original string), `staff`, and `voice`. These refer to the imported score, not offsets in `script`; XML line/column information is not available through the minimal DOM interface. Reports follow deterministic processing order, not necessarily XML document order.
|
|
158
|
-
|
|
159
|
-
Diagnostics cover the cases above, not the entire MusicXML specification. Empty diagnostics do not guarantee lossless conversion. Ordinary defaults and detailed engraving coordinates do not produce warnings. Diagnostic messages describe the loss; use `code` for programmatic classification.
|
|
160
|
-
|
|
161
|
-
Text, dynamics, and wedges target the matching part and staff. With no voice specified, dynamics and wedges apply to matching voices on that staff, while text is attached only once. Missing targets produce diagnostics instead of redirecting the marking to another staff or voice. Tuplet markers are confirmed only when the resulting event rhythm retains their boundaries, including equivalent declarations on chord members.
|
|
81
|
+
The registry is shared across compilations. Names are case-insensitive, and later registrations override existing definitions, including built-ins. When finished, use `symbols.reset()` to remove extensions and restore `symbols.core`; `symbols.clear()` removes everything, including built-ins.
|
|
162
82
|
|
|
163
|
-
|
|
83
|
+
### Note Transformations & Editor Analysis
|
|
164
84
|
|
|
165
|
-
|
|
85
|
+
- `transformNotes(source, lowering, operation, ranges?)`: Returns `{ span, text }[]` edits for `"to-absolute"`, `"to-relative"`, `"semitone-up"`, or `"semitone-down"`. Use lowering from the exact same source; apply edits in one editor transaction or from right to left.
|
|
86
|
+
- `analyzeScoreSyntax(source, functions?)`: Fault-tolerant lexical/call analysis for real-time editor highlighting and completion.
|
|
87
|
+
- `Diagnostic.format(code, message, params)`: Override to localize diagnostic messages.
|
|
166
88
|
|
|
167
|
-
|
|
89
|
+
### MIDI & MusicXML Import
|
|
168
90
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
```jpfun
|
|
172
|
-
@page(width=860px, left=38px, right=38px)
|
|
173
|
-
@1(C4)
|
|
174
|
-
@tempo(96)
|
|
175
|
-
|
|
176
|
-
N(Melody): 1/ 1/ 5/ 5/ 6/ 6/ 5 -
|
|
177
|
-
N: @div(C4 C4) G4/G4/ A4/ A/ G
|
|
178
|
-
L(Lyrics): do do so so la la so
|
|
179
|
-
```
|
|
91
|
+
Import from dedicated subpaths (or from `"jpfun"`):
|
|
180
92
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
jpFun is maintained in a pnpm workspace. From the repository root:
|
|
93
|
+
```ts
|
|
94
|
+
import { midiJsonToJpFun } from "jpfun/converter/midi";
|
|
95
|
+
import { musicXmlToJpFun } from "jpfun/converter/musicxml";
|
|
186
96
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
pnpm run build:core
|
|
190
|
-
pnpm test
|
|
191
|
-
pnpm run dev
|
|
97
|
+
const fromMidi = midiJsonToJpFun(parsedMidiJson, { pitchMode: "absolute", alignRate: 4, barsPerLine: 0 });
|
|
98
|
+
const { script, diagnostics } = musicXmlToJpFun(xmlDocument.documentElement, { pitchMode: "absolute", barsPerLine: 4 });
|
|
192
99
|
```
|
|
193
100
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
## Documentation
|
|
101
|
+
MIDI import expects [midi.js](https://madderscientist.github.io/noteDigger/lib/midi.js)-compatible JSON, not MIDI bytes. MusicXML import expects a parsed DOM root: provide a DOM implementation in Node.js and decompress `.mxl` first. Conversion can be lossy; inspect MusicXML diagnostics, and do not treat an empty array as a lossless guarantee.
|
|
197
102
|
|
|
198
|
-
|
|
199
|
-
- [Repository](https://github.com/madderscientist/jpFun)
|
|
200
|
-
- [Issue tracker](https://github.com/madderscientist/jpFun/issues)
|
|
103
|
+
See the [Developer Documentation](https://madderscientist.github.io/jpFun/docs/developer/use/) for full option and diagnostic details.
|
|
201
104
|
|
|
202
105
|
## License
|
|
203
106
|
|
|
204
|
-
[Apache
|
|
107
|
+
[Apache-2.0](LICENSE), except the `$turn` / `$iturn` / `$coda` glyphs derived from [Bravura](https://github.com/steinbergmedia/bravura), licensed under [SIL OFL 1.1](Bravura-LICENSE.txt). Include `Bravura-LICENSE.txt` when redistributing these glyphs or bundles containing them.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright (c) 2026, Steinberg Media Technologies GmbH (http://www.steinberg.net/),
|
|
2
|
+
with Reserved Font Name "Bravura".
|
|
3
|
+
|
|
4
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
5
|
+
This license is copied below, and is also available with a FAQ at:
|
|
6
|
+
http://scripts.sil.org/OFL
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION AND CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MIDI JSON -> jpFun 的转换流水线:
|
|
3
|
-
* 1. 校验输入,选择足以表达原时值的二进制精度;
|
|
4
|
-
* 2. 在原始 tick 上识别 3:2 三连音,再把其余音符量化到二进制网格;
|
|
5
|
-
* 3. 合并同起止音为和弦,把重叠内容拆到不同 lane;
|
|
6
|
-
* 4. 生成单行源码,以真实自然排版宽度选择换行点;
|
|
7
|
-
* 5. 重新生成最终源码,并用 tie 表达跨小节或不足一拍的持续音。
|
|
8
|
-
*
|
|
9
|
-
* MIDI 字节解析不属于 core;这里接收的是 midi.js 已解析好的 JSON。
|
|
10
|
-
*/
|
|
11
1
|
import type { MidiJson } from "./json.js";
|
|
12
2
|
import { type PitchMode } from "../source.js";
|
|
13
3
|
export type * from "./json.js";
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIDI JSON -> jpFun 的转换流水线:
|
|
3
|
+
* 1. 校验输入,选择足以表达原时值的二进制精度;
|
|
4
|
+
* 2. 在原始 tick 上识别 3:2 三连音,再把其余音符量化到二进制网格;
|
|
5
|
+
* 3. 合并同起止音为和弦,把重叠内容拆到不同 lane;
|
|
6
|
+
* 4. 生成单行源码,以真实自然排版宽度选择换行点;
|
|
7
|
+
* 5. 重新生成最终源码,并用 tie 表达跨小节或不足一拍的持续音。
|
|
8
|
+
*
|
|
9
|
+
* MIDI 字节解析不属于 core;这里接收的是 midi.js 已解析好的 JSON。
|
|
10
|
+
*/
|
|
11
|
+
import { DEFAULT_BPM } from "../../functions/temporal.js";
|
|
1
12
|
import { identifyTriplets } from "./triplet.js";
|
|
2
|
-
import { attachAbove, quote, renderHead,
|
|
13
|
+
import { attachAbove, quote, renderAbsolutePitch, renderHead, renderRelativePitch, renderSystems } from "../source.js";
|
|
3
14
|
import { SHARP_NOTE_NAMES as ABSOLUTE_NAMES } from "../../parser/parse-utils/note-utils.js";
|
|
4
|
-
const DEFAULT_BPM = 120;
|
|
5
15
|
const DEFAULT_TIME_SIGNATURE = [4, 4];
|
|
6
16
|
const AUTO_LINE_TARGET_RATIO = 1.03;
|
|
7
17
|
const AUTO_LINE_LIMIT_RATIO = 1.25;
|
|
8
18
|
const AUTO_LINE_UNDERFILL_PENALTY = 4;
|
|
9
19
|
const AUTO_LINE_MAX_BARS = 8;
|
|
10
|
-
const RELATIVE_NAMES = ["1", "1#", "2", "2#", "3", "4", "4#", "5", "5#", "6", "6#", "7"];
|
|
11
20
|
function expectSafeInteger(value, name, min = 0, max = Number.MAX_SAFE_INTEGER) {
|
|
12
21
|
if (!Number.isSafeInteger(value) || value < min || value > max) {
|
|
13
22
|
throw new RangeError(`${name} must be an integer in ${min}..${max}`);
|
|
@@ -29,47 +38,11 @@ function coalesceSorted(items) {
|
|
|
29
38
|
result.set(item.at, item);
|
|
30
39
|
return [...result.values()];
|
|
31
40
|
}
|
|
32
|
-
function heapPush(heap, value, compare) {
|
|
33
|
-
let index = heap.length;
|
|
34
|
-
heap.push(value);
|
|
35
|
-
while (index > 0) {
|
|
36
|
-
const parent = (index - 1) >> 1;
|
|
37
|
-
if (compare(heap[parent], value) <= 0)
|
|
38
|
-
break;
|
|
39
|
-
heap[index] = heap[parent];
|
|
40
|
-
index = parent;
|
|
41
|
-
}
|
|
42
|
-
heap[index] = value;
|
|
43
|
-
}
|
|
44
|
-
function heapPop(heap, compare) {
|
|
45
|
-
const result = heap[0];
|
|
46
|
-
const value = heap.pop();
|
|
47
|
-
if (heap.length === 0)
|
|
48
|
-
return result;
|
|
49
|
-
let index = 0;
|
|
50
|
-
while (true) {
|
|
51
|
-
const left = index * 2 + 1;
|
|
52
|
-
if (left >= heap.length)
|
|
53
|
-
break;
|
|
54
|
-
const right = left + 1;
|
|
55
|
-
const child = right < heap.length && compare(heap[right], heap[left]) < 0 ? right : left;
|
|
56
|
-
if (compare(heap[child], value) >= 0)
|
|
57
|
-
break;
|
|
58
|
-
heap[index] = heap[child];
|
|
59
|
-
index = child;
|
|
60
|
-
}
|
|
61
|
-
heap[index] = value;
|
|
62
|
-
return result;
|
|
63
|
-
}
|
|
64
41
|
function noteName(midi, mode) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const source =
|
|
68
|
-
return
|
|
69
|
-
name: source[0],
|
|
70
|
-
accidental: source.slice(1),
|
|
71
|
-
octave: mode === "absolute" ? octave : octave - 4,
|
|
72
|
-
}, mode);
|
|
42
|
+
if (mode === "relative")
|
|
43
|
+
return renderRelativePitch(midi - 60);
|
|
44
|
+
const source = ABSOLUTE_NAMES[midi % 12];
|
|
45
|
+
return renderAbsolutePitch(source[0], source.slice(1), Math.floor(midi / 12) - 1);
|
|
73
46
|
}
|
|
74
47
|
function meterDuration(point, scale) {
|
|
75
48
|
return point.numerator * 4 * scale / point.denominator;
|
|
@@ -179,21 +152,11 @@ function groupTriplets(chords) {
|
|
|
179
152
|
*/
|
|
180
153
|
function splitLanes(items) {
|
|
181
154
|
const lanes = [];
|
|
182
|
-
// active 按结束时间回收 lane,available 按原索引优先复用空闲 lane
|
|
183
|
-
const active = [];
|
|
184
|
-
const available = [];
|
|
185
|
-
const compareActive = (left, right) => left.end - right.end || left.laneIndex - right.laneIndex;
|
|
186
|
-
const compareLaneIndex = (left, right) => left - right;
|
|
187
155
|
for (const item of items) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const laneIndex = available.length > 0 ? heapPop(available, compareLaneIndex) : lanes.length;
|
|
192
|
-
const lane = lanes[laneIndex] ?? { items: [] };
|
|
193
|
-
if (laneIndex === lanes.length)
|
|
194
|
-
lanes.push(lane);
|
|
156
|
+
let lane = lanes.find(candidate => candidate.items.at(-1).end <= item.start);
|
|
157
|
+
if (!lane)
|
|
158
|
+
lanes.push(lane = { items: [] });
|
|
195
159
|
lane.items.push(item);
|
|
196
|
-
heapPush(active, { end: item.end, laneIndex }, compareActive);
|
|
197
160
|
}
|
|
198
161
|
// 低音 lane 排在前面,最高 lane 固定承载全谱状态以保持输出稳定
|
|
199
162
|
const averagePitch = (lane) => {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type MusicXmlElement } from "./dom.js";
|
|
2
|
-
import type { MusicXmlArpeggio, MusicXmlDiagnostic, MusicXmlEvent, MusicXmlPitch, ParsedMusicXmlScore } from "./model.js";
|
|
2
|
+
import type { MusicXmlArpeggio, MusicXmlDiagnostic, MusicXmlEvent, MusicXmlPitch, MusicXmlRepeatPoint, MusicXmlRepeatSymbol, ParsedMusicXmlScore } from "./model.js";
|
|
3
3
|
/** 统一两种 MusicXML 根结构中的小节内容与外层小节容器 */
|
|
4
4
|
export interface MusicXmlMeasureSource {
|
|
5
5
|
body: MusicXmlElement;
|
|
6
6
|
container: MusicXmlElement;
|
|
7
7
|
}
|
|
8
|
+
/** 识别 <words> 中的标准反复跳转与终止术语 */
|
|
9
|
+
export declare function repeatWordSymbol(value: string): MusicXmlRepeatSymbol | undefined;
|
|
8
10
|
declare const DIAGNOSTICS: {
|
|
9
11
|
readonly percussion: readonly ["PERCUSSION_SKIPPED", "MIDI channel 10 percussion note was omitted."];
|
|
10
12
|
readonly displayPitch: readonly ["APPROXIMATED", "Unpitched note was converted to a melodic note using its display pitch."];
|
|
@@ -33,8 +35,9 @@ declare const DIAGNOSTICS: {
|
|
|
33
35
|
readonly glissStart: readonly ["UNRESOLVED_RELATION", "Glissando stop has no matching start and was omitted."];
|
|
34
36
|
readonly glissStop: readonly ["UNRESOLVED_RELATION", "Glissando start has no matching stop and was omitted."];
|
|
35
37
|
readonly glissReplaced: readonly ["UNRESOLVED_RELATION", "Glissando start was replaced before a matching stop and was omitted."];
|
|
36
|
-
readonly glissEndpoints: readonly ["UNRESOLVED_RELATION", "Glissando endpoints are simultaneous
|
|
38
|
+
readonly glissEndpoints: readonly ["UNRESOLVED_RELATION", "Glissando endpoints are simultaneous and were omitted."];
|
|
37
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."];
|
|
38
41
|
};
|
|
39
42
|
export declare function reportDiagnostic(diagnostics: MusicXmlDiagnostic[], issue: keyof typeof DIAGNOSTICS, location: MusicXmlDiagnostic["location"], value?: string | number): void;
|
|
40
43
|
/** 查询不改变覆盖状态;解析结果写入语义模型后显式确认,未确认项按 XML 顺序报告 */
|
|
@@ -59,7 +62,7 @@ export declare function scoreMetadata(root: MusicXmlElement): Pick<ParsedMusicXm
|
|
|
59
62
|
/** 解析书面音高及该和弦成员自己的 tie 起止标记 */
|
|
60
63
|
export declare function parsePitch(note: MusicXmlElement, location: MusicXmlPitch["location"], notations?: MusicXmlReader): MusicXmlPitch | null;
|
|
61
64
|
export declare function transposePitch(pitch: MusicXmlPitch, chromatic: number, diatonic: number | undefined, octaves: number): void;
|
|
62
|
-
/**
|
|
65
|
+
/** 将支持的延长、奏法与装饰音记号转成 jpFun 修饰符 */
|
|
63
66
|
export declare function noteModifiers(notations: MusicXmlReader | undefined, diagnostics: MusicXmlDiagnostic[], location: MusicXmlDiagnostic["location"]): {
|
|
64
67
|
modifiers: {
|
|
65
68
|
name: string;
|
|
@@ -89,11 +92,16 @@ export declare function acceptTuplets(notations: MusicXmlReader | undefined, tup
|
|
|
89
92
|
export declare function noteLyrics(note: MusicXmlElement): Map<string, string>;
|
|
90
93
|
/** 返回 dynamics 中首个受支持的力度记号 */
|
|
91
94
|
export declare function directionDynamic(dynamics: MusicXmlElement | undefined, diagnostics: MusicXmlDiagnostic[], location: MusicXmlDiagnostic["location"]): string | undefined;
|
|
92
|
-
/**
|
|
93
|
-
export declare function directionTexts(direction: MusicXmlReader): {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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">[];
|
|
97
105
|
/** 将 metronome 的拍单位和附点折算成四分音符 BPM */
|
|
98
106
|
export declare function metronomeBpm(metronome: MusicXmlElement | undefined): number | undefined;
|
|
99
107
|
/** 将单一或复合拍号归一成一个等值分数 */
|