notula 0.0.0-stage → 0.7.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/CHANGELOG.md +75 -0
- package/LICENSE +21 -0
- package/README.md +214 -2
- package/README.zh-CN.md +216 -0
- package/THIRD_PARTY_NOTICES.md +50 -0
- package/assets/fonts/OFL.txt +94 -0
- package/dist-lib/analyze-DA8Fg8Gs.js +2 -0
- package/dist-lib/analyze-DA8Fg8Gs.js.map +1 -0
- package/dist-lib/audio/highlight.d.ts +14 -0
- package/dist-lib/audio/index.d.ts +3 -0
- package/dist-lib/audio/player.d.ts +58 -0
- package/dist-lib/audio/timeline.d.ts +45 -0
- package/dist-lib/audio.js +2 -0
- package/dist-lib/audio.js.map +1 -0
- package/dist-lib/core/color.d.ts +1 -0
- package/dist-lib/core/number.d.ts +2 -0
- package/dist-lib/core/rational.d.ts +20 -0
- package/dist-lib/core/text.d.ts +1 -0
- package/dist-lib/dsl/ast.d.ts +295 -0
- package/dist-lib/dsl/lexer.d.ts +115 -0
- package/dist-lib/dsl/parser.d.ts +7 -0
- package/dist-lib/index-B2NJU9Bz.js +2 -0
- package/dist-lib/index-B2NJU9Bz.js.map +1 -0
- package/dist-lib/index.d.ts +16 -0
- package/dist-lib/index.js +2 -0
- package/dist-lib/index.js.map +1 -0
- package/dist-lib/integrations/index.d.ts +1 -0
- package/dist-lib/integrations/markdown-dom.d.ts +8 -0
- package/dist-lib/integrations/markdown.d.ts +45 -0
- package/dist-lib/integrations/obsidian-child.d.ts +16 -0
- package/dist-lib/integrations/obsidian-playback.d.ts +19 -0
- package/dist-lib/integrations/obsidian.d.ts +86 -0
- package/dist-lib/integrations/panorama-scroll.d.ts +7 -0
- package/dist-lib/integrations/resize.d.ts +6 -0
- package/dist-lib/integrations.js +2 -0
- package/dist-lib/integrations.js.map +1 -0
- package/dist-lib/ir/analyze.d.ts +13 -0
- package/dist-lib/ir/types.d.ts +263 -0
- package/dist-lib/layout/accidentals.d.ts +20 -0
- package/dist-lib/layout/annotations.d.ts +163 -0
- package/dist-lib/layout/articulations.d.ts +93 -0
- package/dist-lib/layout/beaming.d.ts +92 -0
- package/dist-lib/layout/grace.d.ts +33 -0
- package/dist-lib/layout/layout.d.ts +3 -0
- package/dist-lib/layout/polyphony.d.ts +20 -0
- package/dist-lib/layout/spacing.d.ts +38 -0
- package/dist-lib/layout/staff.d.ts +60 -0
- package/dist-lib/layout/stems-chords.d.ts +59 -0
- package/dist-lib/layout/systems.d.ts +31 -0
- package/dist-lib/layout/ties-slurs.d.ts +59 -0
- package/dist-lib/layout/tuplets.d.ts +25 -0
- package/dist-lib/layout/types.d.ts +210 -0
- package/dist-lib/metrics/bravura-glyph-paths.d.ts +9 -0
- package/dist-lib/metrics/bravura-metrics.d.ts +52 -0
- package/dist-lib/micro/micro.d.ts +33 -0
- package/dist-lib/obsidian.js +2 -0
- package/dist-lib/obsidian.js.map +1 -0
- package/dist-lib/render.d.ts +20 -0
- package/dist-lib/shared.d.ts +8 -0
- package/dist-lib/svg/dom.d.ts +4 -0
- package/dist-lib/svg/emitter.d.ts +56 -0
- package/docs/INTEGRATIONS.md +200 -0
- package/docs/SYNTAX.md +74 -0
- package/docs/assets/cadenza-dark.svg +497 -0
- package/docs/assets/cadenza-light.svg +497 -0
- package/docs/assets/chords-dark.svg +695 -0
- package/docs/assets/chords-light.svg +695 -0
- package/docs/assets/hero-dark.svg +498 -0
- package/docs/assets/hero-light.svg +498 -0
- package/docs/assets/logo-dark.svg +12 -0
- package/docs/assets/logo-light.svg +12 -0
- package/docs/assets/wordmark-dark.svg +41 -0
- package/docs/assets/wordmark-light.svg +41 -0
- package/examples/obsidian-plugin/README.md +43 -0
- package/llms.txt +141 -0
- package/package.json +94 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Notable changes to Notula are recorded here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Version headings record development milestones from the repository history.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.7.0] - 2026-11-29
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Exported the `./obsidian` subpath (`notula/obsidian`) for the Obsidian plugin adapter, added `tests/docs-sync.test.ts` to keep version and documentation references aligned, and configured Release Please alongside monthly grouped `devDependencies` updates.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- **Breaking:** Defaulted score rendering to `standalone: true` (pass `{ standalone: false }` for Bravura font `<text>`), and removed unintended internal math, layout, parser, and integration helpers (`hasOwn`, `rational`, `cmp`, `makeGlyphBox`, `shiftItem*`, `parseFenceParams`, `MAX_PLAYBACK_OCCURRENCES`, etc.) from public `notula`, `notula/audio`, and `notula/integrations` entrypoints.
|
|
16
|
+
- Updated the Obsidian plugin for Community Plugins review requirements, replacing undocumented internal `vault.config` access with Obsidian's public `getAvailablePathForAttachment` API, applying sentence-case settings labels, stripping bundled `smplr` `console.warn`/`console.log` calls, adding scroll/download timer cleanup on unload, and documenting network sample playback disclosures.
|
|
17
|
+
- Synchronized `llms.txt`, `docs/SYNTAX.md`, `docs/INTEGRATIONS.md`, and `THIRD_PARTY_NOTICES.md` (`130` Bravura glyphs) with current package entrypoints and syntax; split CI timing suites into a serial pass with existing thresholds preserved.
|
|
18
|
+
|
|
19
|
+
*Note: `0.7.0` is the first public npm release of `notula` and also ships the `0.6.1` unbeamed tuplet bracket collision fix and Obsidian hover-toolbar PNG/SVG export.*
|
|
20
|
+
|
|
21
|
+
## [0.6.1] - 2026-11-28
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- Obsidian plugin image export menu (`Copy PNG`, `Save PNG (2x)`, `Save SVG`) in the hover toolbar, exporting the active `Wrap`/`Pano` score with padding, zero chrome, print-light white/ink defaults (plus theme/transparent options), playback highlight stripping, ultra-wide canvas downscaling safeguards, and mobile Vault attachment fallback.
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- Unbeamed tuplet brackets now probe real stem positions, reserve numeral half-height and hook-tip clearances, and avoid collisions with member stems, hooks, and neighbor accidentals across ascending, descending, and two-voice passages.
|
|
30
|
+
- Mitigated Obsidian Live Preview edit-button overlap with Notula's `</>` toggle and hardened export cleanup on block unload.
|
|
31
|
+
|
|
32
|
+
## [0.6.0] - 2026-11-28
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- Expressive and pedagogical engraving: Volta 1st/2nd endings, Baroque ornaments (`\trill`, `\prall`, `\mordent`, `\turn`), `8va`/`8vb` ottava brackets, piano sustain pedal (`Ped.`/`*`), rolled chord arpeggios, Bravura `cutOut` accidental interlocking, `\breathe`/`\caesura`, measured stem tremolos, `64th`/`128th` flags and rests, partial-chord ties, automatic `\acciaccatura` slurs, octave-transposing clefs (`treble_8`, `treble^8`, `bass_8`, `bass^8`), scale-degree carets (`\deg`), Display/Compact lead-sheet chord symbols (`\ch`), horizontal analysis brackets (`\bracket`), editorial parenthesized noteheads (`\parenthesize`), and cross-staff kneed beaming (`\staffUp`/`\staffDown`).
|
|
37
|
+
- Pluggable `AudioVoiceBackend` interface, subtle musical micro-expression, playback speed control, and optional lazy-loaded `smplr` (`SplendidGrandPiano`) playback in the Playground and Obsidian plugin (with 2.5s offline fallback and built-in offline synth toggle).
|
|
38
|
+
- Pre-bundled Obsidian Community Plugin release build (`npm run build:obsidian`) with `MarkdownRenderChild` lifecycle, zoom, speed, Panorama horizontal scroll view, `</>` score/source toggle, and `@media print` styling.
|
|
39
|
+
- Vectorized `[N]otula` wordmark & icon, theme-aware classical showcase SVGs (Beethoven Op. 13 *Pathétique*, Liszt *Liebestraum* No. 3, Rachmaninoff Op. 3 No. 2), blind-tested `llms.txt`, integration guides (`docs/INTEGRATIONS.md`), and Obsidian release checklist.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- Browser and Obsidian score mounts build SVG DOM nodes directly without `innerHTML`.
|
|
44
|
+
- Shared debounced `ResizeObserver`, document-level render budgets (`maxBlocks`/`maxInline`), chronological audio event caps, annotation length caps, and Unicode Bidi/control-char sanitization hardened against multi-block and pathological inputs.
|
|
45
|
+
|
|
46
|
+
## [0.5.0]
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
|
|
50
|
+
- Standalone SVG music glyph paths, Web Audio playback, and Markdown integrations.
|
|
51
|
+
- An Obsidian build for score rendering and playback in Reading view and Live Preview.
|
|
52
|
+
|
|
53
|
+
## [0.4.0]
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
- Two-voice notation, piano grand staff, and width-based system wrapping.
|
|
58
|
+
|
|
59
|
+
## [0.3.0]
|
|
60
|
+
|
|
61
|
+
### Added
|
|
62
|
+
|
|
63
|
+
- Inline and display embedding modes, passage highlights, and harmonic annotations.
|
|
64
|
+
|
|
65
|
+
## [0.2.0]
|
|
66
|
+
|
|
67
|
+
### Added
|
|
68
|
+
|
|
69
|
+
- Free-meter passages, tuplets, grace notes, and repeat barlines.
|
|
70
|
+
|
|
71
|
+
## [0.1.0]
|
|
72
|
+
|
|
73
|
+
### Added
|
|
74
|
+
|
|
75
|
+
- Staff engraving for short single-voice examples and a local Playground.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,215 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<p>
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/wordmark-dark.svg">
|
|
5
|
+
<img src="docs/assets/wordmark-light.svg" alt="Notula" width="220">
|
|
6
|
+
</picture>
|
|
7
|
+
</p>
|
|
8
|
+
<p>
|
|
9
|
+
<a href="https://github.com/ZenithRains/notula/actions/workflows/ci.yml"><img src="https://github.com/ZenithRains/notula/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
10
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-78716c?style=flat-square" alt="License: MIT"></a>
|
|
11
|
+
<img src="https://img.shields.io/badge/runtime_deps-0-78716c?style=flat-square" alt="0 runtime deps">
|
|
12
|
+
<img src="https://img.shields.io/badge/index-107%20kB%20gz-78716c?style=flat-square" alt="Index: about 107 kB gzip">
|
|
13
|
+
</p>
|
|
14
|
+
</div>
|
|
2
15
|
|
|
3
|
-
|
|
16
|
+
Notula renders short music examples to SVG for the web and Markdown.
|
|
17
|
+
|
|
18
|
+
[Local Playground](#local-playground) · [Syntax](docs/SYNTAX.md) · [Integrations](docs/INTEGRATIONS.md) · [llms.txt](llms.txt) · [中文](README.zh-CN.md)
|
|
19
|
+
|
|
20
|
+
<picture>
|
|
21
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/hero-dark.svg">
|
|
22
|
+
<img src="docs/assets/hero-light.svg" alt="The opening four bars of Beethoven’s Pathétique Sonata with dotted rhythms and a nine-note flourish" width="840">
|
|
23
|
+
</picture>
|
|
24
|
+
|
|
25
|
+
*Beethoven, Piano Sonata No. 8 in C minor, Op. 13 (Pathétique), I. Grave, mm. 1 to 4.* [Breitkopf & Härtel, Leipzig, 1862, p. 121](https://imslp.org/wiki/Special:ReverseLookup/243128)
|
|
26
|
+
|
|
27
|
+
<details>
|
|
28
|
+
<summary>Notula DSL source</summary>
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
\grandStaff {
|
|
32
|
+
\staff {
|
|
33
|
+
\clef treble \key c \minor \time C
|
|
34
|
+
<ees g c'>4\fp~ <ees g c'>16.[ <g c' g'>32 <g b d'>16. <g c' ees'>32]
|
|
35
|
+
<a! c' ees'>4( <b d'>8) r8 |
|
|
36
|
+
<b! d' f'>4\fp~ <b d' f'>16.[ <b d' f'>32 <b d' g'>16. <b d' aes'>32]
|
|
37
|
+
<b d' aes'>4( <c' ees' g'>8) r8 | \break
|
|
38
|
+
<fis' a'! c''>4\fp~ <fis' a' c''>16.[ <fis' a' c''>32
|
|
39
|
+
<fis' a' d''>16. <fis' a' ees''>32]
|
|
40
|
+
<fis' a' ees''>4\sf( <d' g' d''>16-.) r32
|
|
41
|
+
<fis' a' c''>32[ <fis' a' d''>16. <fis' a' ees''>32] |
|
|
42
|
+
<fis' a'! ees''>4\sf\>( <d' g' d''>8\p\<[-. <g' c'' e''!>8]
|
|
43
|
+
<aes' c'' f''!>8[)-. aes''8\sf]\!~
|
|
44
|
+
aes''32[ g''64( aes'' bes'' aes'' g'' f'']
|
|
45
|
+
ees''!64[ d'' c'' bes']
|
|
46
|
+
\tuplet 9/8 { aes'128[ g' f' ees' d' f' aes' f' d']) } |
|
|
47
|
+
}
|
|
48
|
+
\staff {
|
|
49
|
+
\clef bass \key c \minor \time C
|
|
50
|
+
<c, ees, g, c>4~ <c, ees, g, c>16.[ ees32 d16. c32]
|
|
51
|
+
fis4( g8) r16. aes,!32 |
|
|
52
|
+
aes4~ aes16.[ aes32 g16. f!32] ees4~ ees8 r16. ees32 | \break
|
|
53
|
+
ees'4~ ees'16.[ ees'32 d'16. c'32]
|
|
54
|
+
c'4( b16-.) r32 ees'32[ d'16. c'32] |
|
|
55
|
+
c'4( b8[ <bes c' e'!>8] <aes! c' f'!>8)-. r8 <bes,, bes,>4\sf |
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
</details>
|
|
61
|
+
|
|
62
|
+
## Quick start
|
|
63
|
+
|
|
64
|
+
Once Notula is published to npm, install it in your project.
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
npm install notula
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
For a checkout, see the [local tarball installation steps](docs/INTEGRATIONS.md).
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { renderToString } from 'notula';
|
|
74
|
+
import { playScore } from 'notula/audio';
|
|
75
|
+
|
|
76
|
+
const source = String.raw`\clef treble \time 3/4 c'4 e' g' | c''2. |.`;
|
|
77
|
+
const svg = renderToString(source);
|
|
78
|
+
|
|
79
|
+
// Call from a click or other user gesture in the browser.
|
|
80
|
+
playScore(source, { bpm: 96 });
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The npm entry `notula/audio` defaults to an offline Web Audio synth and has zero runtime dependencies. The npm package includes the `AudioVoiceBackend` interface for optional sampled instruments. [Integration guide](docs/INTEGRATIONS.md#optional-sampled-piano)
|
|
84
|
+
|
|
85
|
+
### Local Playground
|
|
86
|
+
|
|
87
|
+
Run these commands from a checkout and open the URL printed in the terminal.
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
npm ci && npm run dev
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The Playground defaults to **Grand Piano (smplr)**. Rendering and editing scores make zero sample requests. Pressing **Play** fetches public-domain Steinway samples from `smpldsnds.github.io` when needed. If loading fails or reaches the 2.5-second timeout, playback switches automatically to the built-in synth and shows **Offline fallback**. Select **Built-in Piano (Offline)** in the sound menu for immediate local playback.
|
|
94
|
+
|
|
95
|
+
With Node.js 22.18 or later, run `npm run docs:assets` after `npm run build:lib` to regenerate the logo and previews.
|
|
96
|
+
|
|
97
|
+
## Obsidian playback
|
|
98
|
+
|
|
99
|
+
The Obsidian plugin defaults to **Grand piano (smplr)**. It fetches samples only on **Play** and falls back to the offline synth if loading fails or reaches the 2.5-second timeout. Choose **Built-in synth (offline)** under **Sound source**, select **Synth** in a block toolbar, or add `% notula: sound=builtin` to a block for local playback. The toolbar’s **Export image** menu offers **Copy PNG**, **Save PNG (2×)**, and **Save SVG**. [Plugin guide and network disclosure](examples/obsidian-plugin/README.md)
|
|
100
|
+
|
|
101
|
+
## Dense chords
|
|
102
|
+
|
|
103
|
+
<picture>
|
|
104
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/chords-dark.svg">
|
|
105
|
+
<img src="docs/assets/chords-light.svg" alt="Rachmaninoff’s Tempo primo with dense chords, double sharps, and low bass octaves" width="840">
|
|
106
|
+
</picture>
|
|
107
|
+
|
|
108
|
+
*Rachmaninoff, Prelude in C-sharp minor, Op. 3 No. 2, first four bars of Tempo primo. 2-staff piano reduction of the four-staff original, with editorial pedal cues.* [A. Gutheil, Moscow, 1893 edition, later printing, pp. 4 and 5](https://sibleydigitalscores.lib.rochester.edu/files/original/413984/39087018824120piano.pdf#page=4)
|
|
109
|
+
|
|
110
|
+
<details>
|
|
111
|
+
<summary>Notula DSL source</summary>
|
|
112
|
+
|
|
113
|
+
```text
|
|
114
|
+
\grandStaff {
|
|
115
|
+
\staff {
|
|
116
|
+
\clef treble \key cis \minor \time C
|
|
117
|
+
<< {
|
|
118
|
+
r8 <cis'' e'' gis'' cis'''>8\fff[-> <e'' gis'' b'' e'''>->
|
|
119
|
+
<dis'' fisis'' ais'' dis'''>]-> r8 <d'' fis'' bis'' d'''>8-> r8 <bis' dis'' fis'' bis''!>8-> |
|
|
120
|
+
r8 <cis'' e'' gis'' cis'''>8\sffff[-> <e'' gis'' b'' e'''>->
|
|
121
|
+
<dis'' fisis'' ais'' dis'''>]-> r8 <d'' fis'' bis'' d'''>8-> r8 <bis' dis'' fis'' bis''!>8-> | \break
|
|
122
|
+
r8 <cis'' e'' gis'' cis'''>8[-> <gis'' cis''' gis'''>-> <fis'' cis''' fis'''>]->
|
|
123
|
+
r8 <e'' fis'' a'' e'''>8-> r8 <dis'' fis'' a'' dis'''>8-> |
|
|
124
|
+
r8 <e'' gis'' b'' e'''>8[-> <b'' e''' b'''>-> <a'' e''' a'''>]->
|
|
125
|
+
r8 <gis'' ais'' cis''' gis'''>8-> r8 <fisis'' ais'' cis''' fisis'''>8-> |
|
|
126
|
+
} \\ {
|
|
127
|
+
<cis e gis cis'>2-> <a! a'!>4-> <gis gis'>4-> |
|
|
128
|
+
<cis e gis cis'>2-> <a! a'!>4-> <gis gis'>4-> |
|
|
129
|
+
<cis e gis cis'>2-> <c' c''>4-> <b b'>4-> |
|
|
130
|
+
<e gis b e'>2-> <e' e''>4-> <dis' dis''>4-> |
|
|
131
|
+
} >>
|
|
132
|
+
}
|
|
133
|
+
\staff {
|
|
134
|
+
\clef bass \key cis \minor \time C
|
|
135
|
+
<< {
|
|
136
|
+
r8 <e gis cis' e'>8[-> <gis b e' gis'>-> <fisis ais dis' fisis'>]->\sustainOff
|
|
137
|
+
r8 <fis bis d' fis'>8-> r8 <dis fis bis! dis'>8-> |
|
|
138
|
+
r8 <e gis cis' e'>8[-> <gis b e' gis'>-> <fisis ais dis' fisis'>]->\sustainOff
|
|
139
|
+
r8 <fis bis d' fis'>8-> r8 <dis fis bis! dis'>8-> | \break
|
|
140
|
+
r8 <e gis cis' e'>8[-> <b cis' gis' b'>-> <a cis' fis' a'>]->\sustainOff
|
|
141
|
+
r8 <fis a e' fis'>8-> r8 <fis a dis' fis'>8-> |
|
|
142
|
+
r8 <gis b e' gis'>8[-> <dis'! e' b' dis''!>-> <cis' e' a' cis''>]->\sustainOff
|
|
143
|
+
r8 <ais cis' gis' ais'>8-> r8 <ais cis' fisis' ais'>8-> |
|
|
144
|
+
} \\ {
|
|
145
|
+
<cis,, e,, gis,, cis,>2->\sustainOn <a,,! a,!>4-> <gis,, gis,>4-> |
|
|
146
|
+
<cis,, e,, gis,, cis,>2->\sustainOn <a,,! a,!>4-> <gis,, gis,>4-> |
|
|
147
|
+
<cis,, e,, gis,, cis,>2->\sustainOn <c, c>4-> <b,, b,>4-> |
|
|
148
|
+
<e,, gis,, b,, e,>2->\sustainOn <e, e>4-> <dis, dis>4-> |
|
|
149
|
+
} >>
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
</details>
|
|
155
|
+
|
|
156
|
+
## Expressive cadenza
|
|
157
|
+
|
|
158
|
+
<picture>
|
|
159
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/cadenza-dark.svg">
|
|
160
|
+
<img src="docs/assets/cadenza-light.svg" alt="Liszt’s first Liebestraum cadenza with cross-staff beams, octave brackets, and editorial pedal cues" width="840">
|
|
161
|
+
</picture>
|
|
162
|
+
|
|
163
|
+
*Liszt, Liebestraum No. 3 in A-flat major, S. 541, first cadenza. Cross-staff engraving with editorial pedal cues.* [Fr. Kistner, Leipzig, 1850, p. 18](https://s9.imslp.org/files/imglnks/usimg/6/63/IMSLP13549-Liszt_-_S541_Liebestraume_%28kistner_1st_ed%29.pdf#page=17)
|
|
164
|
+
|
|
165
|
+
<details>
|
|
166
|
+
<summary>Notula DSL source</summary>
|
|
167
|
+
|
|
168
|
+
```text
|
|
169
|
+
\grandStaff {
|
|
170
|
+
\staff {
|
|
171
|
+
\clef treble \key aes \major \cadenzaOn
|
|
172
|
+
s2. | r16 s8.
|
|
173
|
+
<fes' aes'>8[ <ees' g'> <aes' des''> <g' bes'>
|
|
174
|
+
<des'' fes''>\< <bes' ees''> <fes'' aes''> <ees'' g''> <aes'' des'''> <g'' bes''>
|
|
175
|
+
\ottava 1 <des''' fes'''> <bes'' ees'''> <fes''' aes'''> <ees''' g'''>\!
|
|
176
|
+
<aes''' des''''> <g''' bes'''>
|
|
177
|
+
<des'''' fes''''>( <bes''' ees''''> <des'''' fes''''> <bes''' ees''''> <aes''' des''''> <g''' bes'''>)
|
|
178
|
+
<fes''' aes'''>( <ees''' g'''> <fes''' aes'''> <ees''' g'''> <des''' fes'''> <bes'' ees'''>)] \ottava 0
|
|
179
|
+
| \break
|
|
180
|
+
<aes'' des'''>8[( <g'' bes''> <aes'' des'''> <g'' bes''> <fes''! aes''> <ees'' g''>)
|
|
181
|
+
<des'' fes''>( <bes' ees''> <des'' fes''> <bes' ees''> <aes' des''> <g' bes'>)]
|
|
182
|
+
<aes' des''>8\<[ <g' bes'> <aes' des''> <g' bes'> <aes' des''> <g' bes'>
|
|
183
|
+
<aes' des''> <g' bes'> <aes' des''> <g' bes'> <aes' des''> <g' bes'>]\!
|
|
184
|
+
<aes' des''>8\>[ <g' bes'> <aes' des''> <g' bes'> <aes' des''> <g' bes'>
|
|
185
|
+
<aes' des''> <g' bes'> <aes' des''> <g' bes'> <aes' des''> <g' bes'>]\!
|
|
186
|
+
r16 r16\fermata d''!4 ||
|
|
187
|
+
}
|
|
188
|
+
\staff {
|
|
189
|
+
\clef bass \key aes \major \cadenzaOn
|
|
190
|
+
ees,8\p[( bes, des g \staffUp bes des'] \staffDown |
|
|
191
|
+
\clef treble fes'8[ ees')] r16 s8.
|
|
192
|
+
fes'8[ ees' aes' g' des'' bes' fes'' ees'' aes'' g'' des''' bes'' fes''' ees'''
|
|
193
|
+
\ottava 1 aes'''( g''' aes''' g''' fes''' ees''') des'''( bes'' des''' bes'' aes'' g'')] \ottava 0
|
|
194
|
+
| \break
|
|
195
|
+
fes''!8[( ees'' fes'' ees'' des'' bes') aes'( g' aes' g' fes' ees')]
|
|
196
|
+
fes'8\sustainOn[ ees' fes' ees' fes' ees' fes' ees' fes' ees' fes' ees'8\sustainOff]
|
|
197
|
+
fes'8\sustainOn[ ees' fes' ees' fes' ees' fes' ees' fes' ees' fes' ees']
|
|
198
|
+
r2.\sustainOff ||
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
</details>
|
|
204
|
+
|
|
205
|
+
## How It Works & Engraving Standards
|
|
206
|
+
|
|
207
|
+
Four pure stages parse the DSL into an AST, resolve it into Music IR, lay it out as a LayoutTree, and emit SVG or mount it in the DOM. Web Audio derives its playback timeline from Music IR. The layout uses staff spaces (`sp`), with positive coordinates pointing up from the middle staff line at `y = 0`. The same geometry supports standalone SVG music glyphs as `<path>` elements and DOM mounting with `createElementNS` without `innerHTML`.
|
|
208
|
+
|
|
209
|
+
Engraving references include Elaine Gould’s *Behind Bars*, Ted Ross’s *The Art of Music Engraving and Processing*, and Gardner Read’s *Music Notation*. Nonlinear duration spacing draws on John S. Gourlay’s *Spacing a Line of Music* (1987, OSU-CISRC-10/87-TR35). The scripts in `scripts/` reproduce the extraction of glyph metrics and outlines from the W3C Music Notation Community Group’s SMuFL data and Steinberg Bravura 1.482, licensed under SIL OFL 1.1. [SMuFL 1.4](https://www.w3.org/2021/03/smufl14/) · [Bravura 1.482](https://github.com/steinbergmedia/bravura/releases/tag/bravura-1.482) · [Third-party notices](THIRD_PARTY_NOTICES.md)
|
|
210
|
+
|
|
211
|
+
Notula is an independent, clean-room implementation released under MIT. The 16 Markdown files in `spec/` set out engraving rules and review criteria. Tests check geometric invariants and run deterministic fuzzing and a repertoire suite that includes an original Bach-style chorale.
|
|
212
|
+
|
|
213
|
+
Notula is designed for web, Markdown, and teaching examples, from one inline symbol to roughly 16 bars with responsive wrapping. Multi-page publishing and part extraction are outside its scope.
|
|
214
|
+
|
|
215
|
+
Source code is licensed under [MIT](LICENSE); bundled Bravura glyph metrics and outlines are licensed under SIL OFL 1.1 (see [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) and [assets/fonts/OFL.txt](assets/fonts/OFL.txt)). While in `0.x`, minor releases (`0.x.0`) may refine public API defaults or exports; the core music DSL remains backward-compatible unless noted in [CHANGELOG.md](CHANGELOG.md).
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<p>
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/wordmark-dark.svg">
|
|
5
|
+
<img src="docs/assets/wordmark-light.svg" alt="Notula" width="220">
|
|
6
|
+
</picture>
|
|
7
|
+
</p>
|
|
8
|
+
<p>
|
|
9
|
+
<a href="https://github.com/ZenithRains/notula/actions/workflows/ci.yml"><img src="https://github.com/ZenithRains/notula/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
10
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-78716c?style=flat-square" alt="License: MIT"></a>
|
|
11
|
+
<img src="https://img.shields.io/badge/runtime_deps-0-78716c?style=flat-square" alt="0 runtime deps">
|
|
12
|
+
<img src="https://img.shields.io/badge/index-107%20kB%20gz-78716c?style=flat-square" alt="Index: about 107 kB gzip">
|
|
13
|
+
</p>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
Notula 将短小的乐谱片段渲染为 SVG,可嵌入网页和 Markdown。
|
|
17
|
+
|
|
18
|
+
[本地 Playground](#local-playground) · [语法](docs/SYNTAX.md) · [集成](docs/INTEGRATIONS.md) · [llms.txt](llms.txt) · [English](README.md)
|
|
19
|
+
|
|
20
|
+
<picture>
|
|
21
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/hero-dark.svg">
|
|
22
|
+
<img src="docs/assets/hero-light.svg" alt="《悲怆》奏鸣曲开头四小节,含附点节奏和九连音" width="840">
|
|
23
|
+
</picture>
|
|
24
|
+
|
|
25
|
+
*贝多芬《C 小调第八钢琴奏鸣曲〈悲怆〉》,Op. 13,第一乐章 Grave,第 1 至 4 小节。* [布赖特科普夫与黑特尔,莱比锡,1862 年,第 121 页](https://imslp.org/wiki/Special:ReverseLookup/243128)
|
|
26
|
+
|
|
27
|
+
<details>
|
|
28
|
+
<summary>Notula DSL source</summary>
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
\grandStaff {
|
|
32
|
+
\staff {
|
|
33
|
+
\clef treble \key c \minor \time C
|
|
34
|
+
<ees g c'>4\fp~ <ees g c'>16.[ <g c' g'>32 <g b d'>16. <g c' ees'>32]
|
|
35
|
+
<a! c' ees'>4( <b d'>8) r8 |
|
|
36
|
+
<b! d' f'>4\fp~ <b d' f'>16.[ <b d' f'>32 <b d' g'>16. <b d' aes'>32]
|
|
37
|
+
<b d' aes'>4( <c' ees' g'>8) r8 | \break
|
|
38
|
+
<fis' a'! c''>4\fp~ <fis' a' c''>16.[ <fis' a' c''>32
|
|
39
|
+
<fis' a' d''>16. <fis' a' ees''>32]
|
|
40
|
+
<fis' a' ees''>4\sf( <d' g' d''>16-.) r32
|
|
41
|
+
<fis' a' c''>32[ <fis' a' d''>16. <fis' a' ees''>32] |
|
|
42
|
+
<fis' a'! ees''>4\sf\>( <d' g' d''>8\p\<[-. <g' c'' e''!>8]
|
|
43
|
+
<aes' c'' f''!>8[)-. aes''8\sf]\!~
|
|
44
|
+
aes''32[ g''64( aes'' bes'' aes'' g'' f'']
|
|
45
|
+
ees''!64[ d'' c'' bes']
|
|
46
|
+
\tuplet 9/8 { aes'128[ g' f' ees' d' f' aes' f' d']) } |
|
|
47
|
+
}
|
|
48
|
+
\staff {
|
|
49
|
+
\clef bass \key c \minor \time C
|
|
50
|
+
<c, ees, g, c>4~ <c, ees, g, c>16.[ ees32 d16. c32]
|
|
51
|
+
fis4( g8) r16. aes,!32 |
|
|
52
|
+
aes4~ aes16.[ aes32 g16. f!32] ees4~ ees8 r16. ees32 | \break
|
|
53
|
+
ees'4~ ees'16.[ ees'32 d'16. c'32]
|
|
54
|
+
c'4( b16-.) r32 ees'32[ d'16. c'32] |
|
|
55
|
+
c'4( b8[ <bes c' e'!>8] <aes! c' f'!>8)-. r8 <bes,, bes,>4\sf |
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
</details>
|
|
61
|
+
|
|
62
|
+
## 快速开始
|
|
63
|
+
|
|
64
|
+
Notula 发布到 npm 后,在项目中运行以下命令。
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
npm install notula
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
也可从仓库[打包并在本地安装](docs/INTEGRATIONS.md)。
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { renderToString } from 'notula';
|
|
74
|
+
import { playScore } from 'notula/audio';
|
|
75
|
+
|
|
76
|
+
const source = String.raw`\clef treble \time 3/4 c'4 e' g' | c''2. |.`;
|
|
77
|
+
const svg = renderToString(source);
|
|
78
|
+
|
|
79
|
+
// 在浏览器中由点击等用户操作触发播放。
|
|
80
|
+
playScore(source, { bpm: 96 });
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
npm 入口 `notula/audio` 默认使用 Web Audio 本地合成,可离线播放,运行时依赖为零。其他应用可通过 `AudioVoiceBackend` 接入采样钢琴。[集成指南](docs/INTEGRATIONS.md#optional-sampled-piano)
|
|
84
|
+
|
|
85
|
+
<a name="local-playground"></a>
|
|
86
|
+
### 本地 Playground
|
|
87
|
+
|
|
88
|
+
在仓库目录中运行以下命令,然后打开终端显示的地址。
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
npm ci && npm run dev
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Playground 默认使用 **Grand Piano (smplr)**。渲染和编辑乐谱时不会请求音频采样。点击 **Play** 后,才会按需从 `smpldsnds.github.io` 下载属于公有领域的施坦威钢琴采样。加载失败或达到 2.5 秒超时后,播放器自动使用内置音源并显示 **Offline fallback**。可在音源菜单中一键切换至 **Built-in Piano (Offline)**。
|
|
95
|
+
|
|
96
|
+
使用 Node.js 22.18 或更新版本时,可在 `npm run build:lib` 后运行 `npm run docs:assets`,重新生成预览和页首图标。
|
|
97
|
+
|
|
98
|
+
## Obsidian 播放
|
|
99
|
+
|
|
100
|
+
Obsidian 插件默认使用 **Grand piano (smplr)**,仅在点击 **Play** 时按需下载采样。加载失败或达到 2.5 秒超时后自动切换到离线音源。可在 **Sound source** 中选择 **Built-in synth (offline)**,在单个谱例的工具栏选择 **Synth**,或在代码块首行添加 `% notula: sound=builtin`。工具栏的 **Export image** 菜单提供 **Copy PNG**、**Save PNG (2×)** 和 **Save SVG**。[插件指南与联网说明](examples/obsidian-plugin/README.md)
|
|
101
|
+
|
|
102
|
+
## 密集和弦
|
|
103
|
+
|
|
104
|
+
<picture>
|
|
105
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/chords-dark.svg">
|
|
106
|
+
<img src="docs/assets/chords-light.svg" alt="拉赫玛尼诺夫 Tempo primo 段,含密集和弦、重升记号与低音八度" width="840">
|
|
107
|
+
</picture>
|
|
108
|
+
|
|
109
|
+
*拉赫玛尼诺夫《升 C 小调前奏曲》,Op. 3 No. 2,Tempo primo 开头四小节。原版为四谱表,此处为双谱表钢琴缩编谱,踏板标记由编者添加。* [古特海尔,莫斯科,1893 年版后印本,第 4 至 5 页](https://sibleydigitalscores.lib.rochester.edu/files/original/413984/39087018824120piano.pdf#page=4)
|
|
110
|
+
|
|
111
|
+
<details>
|
|
112
|
+
<summary>Notula DSL source</summary>
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
\grandStaff {
|
|
116
|
+
\staff {
|
|
117
|
+
\clef treble \key cis \minor \time C
|
|
118
|
+
<< {
|
|
119
|
+
r8 <cis'' e'' gis'' cis'''>8\fff[-> <e'' gis'' b'' e'''>->
|
|
120
|
+
<dis'' fisis'' ais'' dis'''>]-> r8 <d'' fis'' bis'' d'''>8-> r8 <bis' dis'' fis'' bis''!>8-> |
|
|
121
|
+
r8 <cis'' e'' gis'' cis'''>8\sffff[-> <e'' gis'' b'' e'''>->
|
|
122
|
+
<dis'' fisis'' ais'' dis'''>]-> r8 <d'' fis'' bis'' d'''>8-> r8 <bis' dis'' fis'' bis''!>8-> | \break
|
|
123
|
+
r8 <cis'' e'' gis'' cis'''>8[-> <gis'' cis''' gis'''>-> <fis'' cis''' fis'''>]->
|
|
124
|
+
r8 <e'' fis'' a'' e'''>8-> r8 <dis'' fis'' a'' dis'''>8-> |
|
|
125
|
+
r8 <e'' gis'' b'' e'''>8[-> <b'' e''' b'''>-> <a'' e''' a'''>]->
|
|
126
|
+
r8 <gis'' ais'' cis''' gis'''>8-> r8 <fisis'' ais'' cis''' fisis'''>8-> |
|
|
127
|
+
} \\ {
|
|
128
|
+
<cis e gis cis'>2-> <a! a'!>4-> <gis gis'>4-> |
|
|
129
|
+
<cis e gis cis'>2-> <a! a'!>4-> <gis gis'>4-> |
|
|
130
|
+
<cis e gis cis'>2-> <c' c''>4-> <b b'>4-> |
|
|
131
|
+
<e gis b e'>2-> <e' e''>4-> <dis' dis''>4-> |
|
|
132
|
+
} >>
|
|
133
|
+
}
|
|
134
|
+
\staff {
|
|
135
|
+
\clef bass \key cis \minor \time C
|
|
136
|
+
<< {
|
|
137
|
+
r8 <e gis cis' e'>8[-> <gis b e' gis'>-> <fisis ais dis' fisis'>]->\sustainOff
|
|
138
|
+
r8 <fis bis d' fis'>8-> r8 <dis fis bis! dis'>8-> |
|
|
139
|
+
r8 <e gis cis' e'>8[-> <gis b e' gis'>-> <fisis ais dis' fisis'>]->\sustainOff
|
|
140
|
+
r8 <fis bis d' fis'>8-> r8 <dis fis bis! dis'>8-> | \break
|
|
141
|
+
r8 <e gis cis' e'>8[-> <b cis' gis' b'>-> <a cis' fis' a'>]->\sustainOff
|
|
142
|
+
r8 <fis a e' fis'>8-> r8 <fis a dis' fis'>8-> |
|
|
143
|
+
r8 <gis b e' gis'>8[-> <dis'! e' b' dis''!>-> <cis' e' a' cis''>]->\sustainOff
|
|
144
|
+
r8 <ais cis' gis' ais'>8-> r8 <ais cis' fisis' ais'>8-> |
|
|
145
|
+
} \\ {
|
|
146
|
+
<cis,, e,, gis,, cis,>2->\sustainOn <a,,! a,!>4-> <gis,, gis,>4-> |
|
|
147
|
+
<cis,, e,, gis,, cis,>2->\sustainOn <a,,! a,!>4-> <gis,, gis,>4-> |
|
|
148
|
+
<cis,, e,, gis,, cis,>2->\sustainOn <c, c>4-> <b,, b,>4-> |
|
|
149
|
+
<e,, gis,, b,, e,>2->\sustainOn <e, e>4-> <dis, dis>4-> |
|
|
150
|
+
} >>
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
</details>
|
|
156
|
+
|
|
157
|
+
## 华彩段
|
|
158
|
+
|
|
159
|
+
<picture>
|
|
160
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/cadenza-dark.svg">
|
|
161
|
+
<img src="docs/assets/cadenza-light.svg" alt="《爱之梦》第三首的第一段华彩,含跨谱表符杠、八度线及编者添加的踏板标记" width="840">
|
|
162
|
+
</picture>
|
|
163
|
+
|
|
164
|
+
*李斯特《降 A 大调爱之梦》第三首,S. 541,第一段华彩。采用跨谱表排版,踏板标记由编者添加。* [基斯特纳,莱比锡,1850 年,第 18 页](https://s9.imslp.org/files/imglnks/usimg/6/63/IMSLP13549-Liszt_-_S541_Liebestraume_%28kistner_1st_ed%29.pdf#page=17)
|
|
165
|
+
|
|
166
|
+
<details>
|
|
167
|
+
<summary>Notula DSL source</summary>
|
|
168
|
+
|
|
169
|
+
```text
|
|
170
|
+
\grandStaff {
|
|
171
|
+
\staff {
|
|
172
|
+
\clef treble \key aes \major \cadenzaOn
|
|
173
|
+
s2. | r16 s8.
|
|
174
|
+
<fes' aes'>8[ <ees' g'> <aes' des''> <g' bes'>
|
|
175
|
+
<des'' fes''>\< <bes' ees''> <fes'' aes''> <ees'' g''> <aes'' des'''> <g'' bes''>
|
|
176
|
+
\ottava 1 <des''' fes'''> <bes'' ees'''> <fes''' aes'''> <ees''' g'''>\!
|
|
177
|
+
<aes''' des''''> <g''' bes'''>
|
|
178
|
+
<des'''' fes''''>( <bes''' ees''''> <des'''' fes''''> <bes''' ees''''> <aes''' des''''> <g''' bes'''>)
|
|
179
|
+
<fes''' aes'''>( <ees''' g'''> <fes''' aes'''> <ees''' g'''> <des''' fes'''> <bes'' ees'''>)] \ottava 0
|
|
180
|
+
| \break
|
|
181
|
+
<aes'' des'''>8[( <g'' bes''> <aes'' des'''> <g'' bes''> <fes''! aes''> <ees'' g''>)
|
|
182
|
+
<des'' fes''>( <bes' ees''> <des'' fes''> <bes' ees''> <aes' des''> <g' bes'>)]
|
|
183
|
+
<aes' des''>8\<[ <g' bes'> <aes' des''> <g' bes'> <aes' des''> <g' bes'>
|
|
184
|
+
<aes' des''> <g' bes'> <aes' des''> <g' bes'> <aes' des''> <g' bes'>]\!
|
|
185
|
+
<aes' des''>8\>[ <g' bes'> <aes' des''> <g' bes'> <aes' des''> <g' bes'>
|
|
186
|
+
<aes' des''> <g' bes'> <aes' des''> <g' bes'> <aes' des''> <g' bes'>]\!
|
|
187
|
+
r16 r16\fermata d''!4 ||
|
|
188
|
+
}
|
|
189
|
+
\staff {
|
|
190
|
+
\clef bass \key aes \major \cadenzaOn
|
|
191
|
+
ees,8\p[( bes, des g \staffUp bes des'] \staffDown |
|
|
192
|
+
\clef treble fes'8[ ees')] r16 s8.
|
|
193
|
+
fes'8[ ees' aes' g' des'' bes' fes'' ees'' aes'' g'' des''' bes'' fes''' ees'''
|
|
194
|
+
\ottava 1 aes'''( g''' aes''' g''' fes''' ees''') des'''( bes'' des''' bes'' aes'' g'')] \ottava 0
|
|
195
|
+
| \break
|
|
196
|
+
fes''!8[( ees'' fes'' ees'' des'' bes') aes'( g' aes' g' fes' ees')]
|
|
197
|
+
fes'8\sustainOn[ ees' fes' ees' fes' ees' fes' ees' fes' ees' fes' ees'8\sustainOff]
|
|
198
|
+
fes'8\sustainOn[ ees' fes' ees' fes' ees' fes' ees' fes' ees' fes' ees']
|
|
199
|
+
r2.\sustainOff ||
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
</details>
|
|
205
|
+
|
|
206
|
+
## 架构、规范与净室实现
|
|
207
|
+
|
|
208
|
+
四层纯函数流水线依次将 DSL 解析为 AST、转换为音乐中间表示(Music IR)、生成排版树(LayoutTree),最后输出 SVG 或挂载到 DOM。Web Audio 从 Music IR 生成播放时间线。排版树以谱线间距 `sp` 为单位,坐标向上为正,五线谱中线为 `y = 0`。同一套几何数据既可输出以 `<path>` 表示音乐字形的独立 SVG,也可通过 `createElementNS` 直接挂载到 DOM,无需 `innerHTML`。
|
|
209
|
+
|
|
210
|
+
记谱参考 Elaine Gould 的 *Behind Bars*、Ted Ross 的 *The Art of Music Engraving and Processing* 和 Gardner Read 的 *Music Notation*。时值间距采用非线性模型,参考 John S. Gourlay(1987)的 *Spacing a Line of Music*(OSU-CISRC-10/87-TR35)。`scripts/` 提供可重复运行的提取脚本,用于生成字形度量和轮廓,数据来自 W3C 音乐记谱社区组的 SMuFL 与 Steinberg 的 Bravura 1.482(SIL OFL 1.1)。[SMuFL 1.4](https://www.w3.org/2021/03/smufl14/) · [Bravura 1.482](https://github.com/steinbergmedia/bravura/releases/tag/bravura-1.482) · [第三方许可声明](THIRD_PARTY_NOTICES.md)
|
|
211
|
+
|
|
212
|
+
Notula 采用 MIT 许可,核心引擎以净室方式独立实现。`spec/` 下的 16 份 Markdown 文档记录排版规范和审查要求。测试检查其中的几何不变量,并运行确定性模糊测试及包含原创巴赫风格众赞歌的曲目语料测试。
|
|
213
|
+
|
|
214
|
+
Notula 面向网页、Markdown 与教学材料,支持从单个行内符号到约 16 小节的自适应谱例。多页桌面出版和分谱提取超出项目范围。
|
|
215
|
+
|
|
216
|
+
源码采用 [MIT](LICENSE) 许可;内嵌 Bravura 字形度量与矢量轮廓遵循 SIL OFL 1.1 许可(详见 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) 与 [assets/fonts/OFL.txt](assets/fonts/OFL.txt))。在 `0.x` 阶段,次版本(`0.x.0`)可能微调公开 API 默认项或导出面;核心乐谱 DSL 保持向后兼容,如有不兼容变更将在 [CHANGELOG.md](CHANGELOG.md) 中明确说明。
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
This repository is licensed under the **MIT License** (see `LICENSE`).
|
|
4
|
+
The following third-party standards, assets, and software are used in accordance with their respective licenses.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 1. Bravura Font & Metadata (Steinberg Media Technologies GmbH)
|
|
9
|
+
- **Source**: https://github.com/steinbergmedia/bravura
|
|
10
|
+
- **License**: SIL Open Font License (OFL) 1.1
|
|
11
|
+
- **Local License Text**: `assets/fonts/OFL.txt`
|
|
12
|
+
- **Usage**:
|
|
13
|
+
- Metric constants (`engravingDefaults`, `glyphBBoxes`, `glyphAdvanceWidths`, `glyphsWithAnchors`) extracted from official `redist/Bravura.json` into `spec/smufl-mvp-metrics.json`.
|
|
14
|
+
- Pre-extracted standalone SVG glyph outlines for the 130 Bravura SMuFL glyphs generated from official `redist/otf/Bravura.otf` into `src/metrics/bravura-glyph-paths.ts` under SIL OFL 1.1 terms.
|
|
15
|
+
- Font rendering via Bravura WOFF2 under SIL OFL 1.1 terms (preserving copyright notice and Reserved Font Name; font files are not sold individually).
|
|
16
|
+
|
|
17
|
+
## 2. SMuFL Specification & Glyph Names (W3C Music Notation Community Group)
|
|
18
|
+
- **Source**: https://github.com/w3c/smufl
|
|
19
|
+
- **Specification**: Standard Music Font Layout (SMuFL)
|
|
20
|
+
- **Usage**: Canonical glyph names and Unicode Private Use Area (PUA) codepoint mappings extracted from `metadata/glyphnames.json`.
|
|
21
|
+
|
|
22
|
+
## 3. smplr & SplendidGrandPiano (Playground and Obsidian Sound Engine)
|
|
23
|
+
|
|
24
|
+
- `smplr` 1.2.1 declares the MIT License. The notice below uses the package author, danigb, and the bundled release's 2026 date. [Tagged README](https://github.com/danigb/smplr/blob/v1.2.1/README.md#license) · [Tagged package metadata](https://github.com/danigb/smplr/blob/v1.2.1/package.json) · [Release](https://github.com/danigb/smplr/releases/tag/v1.2.1)
|
|
25
|
+
- `SplendidGrandPiano` uses Steinway samples with four velocity layers. AKAI released the samples into the public domain in early 2000. The upstream collection credits kinwie with fixing the samples, converting them to FLAC, and mapping them to SFZ with ARIA extensions. `smplr` fetches the Ogg or M4A versions from the `smpldsnds` mirror. [smplr piano documentation](https://github.com/danigb/smplr#splendidgrandpiano), [upstream sample credits](https://github.com/sfzinstruments/SplendidGrandPiano), [sample mirror](https://github.com/smpldsnds/sfzinstruments-splendid-grand-piano)
|
|
26
|
+
- The sampler is bundled with the Playground and Obsidian plugin as **Grand Piano (smplr)**, the default in both interfaces. Sample requests to `smpldsnds.github.io` start only on Play when samples are needed. Both interfaces fall back to the built-in synth if loading fails or reaches the 2.5-second timeout. The published `notula/audio` entry defaults to its built-in offline synth and ships without the sampler.
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
MIT License
|
|
30
|
+
|
|
31
|
+
Copyright (c) 2026 danigb
|
|
32
|
+
|
|
33
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
34
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
35
|
+
in the Software without restriction, including without limitation the rights
|
|
36
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
37
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
38
|
+
furnished to do so, subject to the following conditions:
|
|
39
|
+
|
|
40
|
+
The above copyright notice and this permission notice shall be included in all
|
|
41
|
+
copies or substantial portions of the Software.
|
|
42
|
+
|
|
43
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
44
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
45
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
46
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
47
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
48
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
49
|
+
SOFTWARE.
|
|
50
|
+
```
|