@dsebastien/music-notation 0.22.1 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/blocks/renderers.d.ts +8 -1
- package/dist/chord/generate.d.ts +2 -0
- package/dist/chord/words.d.ts +4 -0
- package/dist/export/image.d.ts +2 -0
- package/dist/fretboard/exercise.d.ts +0 -16
- package/dist/fretboard/positions.d.ts +0 -17
- package/dist/i18n/en/diagrams.d.ts +139 -0
- package/dist/i18n/en/index.d.ts +532 -0
- package/dist/i18n/en/parse.d.ts +249 -0
- package/dist/i18n/en/play.d.ts +82 -0
- package/dist/i18n/en/timed.d.ts +75 -0
- package/dist/i18n/fr/diagrams.d.ts +139 -0
- package/dist/i18n/fr/index.d.ts +7 -0
- package/dist/i18n/fr/parse.d.ts +249 -0
- package/dist/i18n/fr/play.d.ts +82 -0
- package/dist/i18n/fr/timed.d.ts +72 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/language.d.ts +543 -0
- package/dist/i18n/messages.d.ts +11 -0
- package/dist/i18n/page.d.ts +7 -0
- package/dist/i18n/translate.d.ts +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2107 -525
- package/dist/index.js.map +66 -52
- package/dist/keyboard/scale-fingering.d.ts +1 -1
- package/dist/music-notation.css +21 -0
- package/dist/music-notation.publish.min.js +58 -37
- package/dist/music-notation.tab.min.js +28 -7
- package/dist/picking/pattern.d.ts +0 -7
- package/dist/playback/bar-parts.d.ts +4 -0
- package/dist/playback/controls.d.ts +23 -2
- package/dist/playback/copy-image.d.ts +6 -5
- package/dist/playback/engine.d.ts +34 -0
- package/dist/publish/auto.d.ts +2 -0
- package/dist/publish/index.js +2080 -527
- package/dist/publish/index.js.map +66 -52
- package/dist/tab/auto.d.ts +2 -0
- package/dist/tab/follow-scroll.d.ts +65 -0
- package/dist/tab/index.d.ts +54 -2
- package/dist/tab/index.js +1586 -76
- package/dist/tab/index.js.map +24 -9
- package/dist/tab/note-names.d.ts +50 -0
- package/dist/voicings/index.js +1323 -79
- package/dist/voicings/index.js.map +23 -10
- package/package.json +1 -1
package/dist/tab/auto.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ declare global {
|
|
|
12
12
|
alphaTab?: AlphaTabModule;
|
|
13
13
|
musicNotationTabLoaded?: boolean;
|
|
14
14
|
musicNotationSoundfontPlayer?: NotePlayer;
|
|
15
|
+
/** The whole soundfont (sonivox) for the diagrams, when a block or the page asks (#124). */
|
|
16
|
+
musicNotationSonivoxPlayer?: NotePlayer;
|
|
15
17
|
musicNotationOptions?: unknown;
|
|
16
18
|
/**
|
|
17
19
|
* The tab bundle's API for a page's own scripts (the guide's Sounds page): draw a tab or
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Follow the music (#97): while a tab or a score plays, keep the system that plays in view. Off
|
|
3
|
+
* by default: the page never moves unless the reader asks (#89). What scrolls is the nearest box
|
|
4
|
+
* that scrolls (a block with a height of its own, an app's reading pane), else the page, by the
|
|
5
|
+
* smallest move that shows the playing system and the one after it. A scroll by hand pauses it,
|
|
6
|
+
* until the next Play or a click on the button. Nothing here knows alphaTab.
|
|
7
|
+
*/
|
|
8
|
+
/** A vertical span on the screen, in pixels. */
|
|
9
|
+
export interface Span {
|
|
10
|
+
top: number;
|
|
11
|
+
bottom: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The smallest vertical move (pixels, down is positive) of a scroll area that shows `target` in
|
|
15
|
+
* `view`, with `margin` around it: 0 when it shows already. A target taller than the view has its
|
|
16
|
+
* top at the top.
|
|
17
|
+
*/
|
|
18
|
+
export declare function moveToShow(view: Span, target: Span, margin?: number): number;
|
|
19
|
+
/**
|
|
20
|
+
* What to show for a playing system: the system and the one after it (the reader looks ahead),
|
|
21
|
+
* or the system alone when both don't fit the view.
|
|
22
|
+
*/
|
|
23
|
+
export declare function spanToShow(system: Span, view: Span, margin?: number): Span;
|
|
24
|
+
/**
|
|
25
|
+
* The nearest element around `el` (itself included) that scrolls up and down and has more than
|
|
26
|
+
* it shows; null when that is the page.
|
|
27
|
+
*/
|
|
28
|
+
export declare function scrollerOf(el: Element): HTMLElement | null;
|
|
29
|
+
export interface Follow {
|
|
30
|
+
/** Whether the reader asked for it. */
|
|
31
|
+
on(): boolean;
|
|
32
|
+
/** Whether it follows now: asked for, and not paused by a scroll by hand. */
|
|
33
|
+
active(): boolean;
|
|
34
|
+
/** Asks for it or not. */
|
|
35
|
+
set(on: boolean): void;
|
|
36
|
+
/** The button's click: follows again when paused, else turns it on or off. */
|
|
37
|
+
press(): void;
|
|
38
|
+
/** The music plays (again): a pause ends. */
|
|
39
|
+
playing(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Shows a span of the screen (the playing system), when it follows: scrolls the nearest
|
|
42
|
+
* scroll area of the score, or the page. `covered` is the height hidden at the bottom of the
|
|
43
|
+
* view (a bar that stays there).
|
|
44
|
+
*/
|
|
45
|
+
show(system: Span, covered?: number): void;
|
|
46
|
+
/** Stops listening to the page. */
|
|
47
|
+
destroy(): void;
|
|
48
|
+
}
|
|
49
|
+
export interface FollowOptions {
|
|
50
|
+
/** Whether it starts on (default false). */
|
|
51
|
+
on?: boolean;
|
|
52
|
+
/** Called when `on` or `active` changes. */
|
|
53
|
+
changed?: (state: {
|
|
54
|
+
on: boolean;
|
|
55
|
+
active: boolean;
|
|
56
|
+
}) => void;
|
|
57
|
+
/** Room kept around the system (default 16). */
|
|
58
|
+
margin?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The follow state of the score `el`, and its scrolling. A wheel or a touch move on the score or
|
|
62
|
+
* on what holds it (its pane, the page), or a scroll key, pauses it: the reader's hand wins. A
|
|
63
|
+
* scroll somewhere else (another pane) doesn't.
|
|
64
|
+
*/
|
|
65
|
+
export declare function followScroll(el: Element, options?: FollowOptions): Follow;
|
package/dist/tab/index.d.ts
CHANGED
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
* exporters behind imports (#25), and a soundfont player for the diagrams' playback (#23).
|
|
7
7
|
*/
|
|
8
8
|
import type * as AT from '@coderline/alphatab';
|
|
9
|
+
import { type Language } from '../i18n/language.js';
|
|
9
10
|
import type { NotePlayer } from '../playback/player.js';
|
|
11
|
+
import { type Engine } from '../playback/engine.js';
|
|
12
|
+
import { type Naming } from '../theory/naming.js';
|
|
10
13
|
import { type TempoUnit } from './tempo.js';
|
|
11
14
|
import { type InstrumentSource } from './instruments.js';
|
|
12
15
|
export type AlphaTabModule = typeof AT;
|
|
@@ -33,15 +36,45 @@ export interface TabAssets {
|
|
|
33
36
|
*/
|
|
34
37
|
instruments?: InstrumentSource;
|
|
35
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* The engine a tab or a score plays through (#124): the instrument files (`generaluser`) or the
|
|
41
|
+
* whole soundfont (`sonivox`). The wish first, when the assets have it, then the fallback order.
|
|
42
|
+
* The light synthesizer can't play a score: that wish gets the best sound there is.
|
|
43
|
+
*/
|
|
44
|
+
export declare function tabEngine(assets: TabAssets, wish?: Engine | null): 'generaluser' | 'sonivox';
|
|
45
|
+
/** The assets a tab plays with for an engine: without the instrument files for `sonivox`. */
|
|
46
|
+
export declare function engineAssets(assets: TabAssets, wish?: Engine | null): TabAssets;
|
|
36
47
|
export interface TabOptions {
|
|
37
48
|
alphaTab: AlphaTabModule;
|
|
38
49
|
assets: TabAssets;
|
|
50
|
+
/**
|
|
51
|
+
* Note names on the notes (#112): whether a block without a `names:` line shows them (default
|
|
52
|
+
* false). The bar's Note names button turns them on and off while reading.
|
|
53
|
+
*/
|
|
54
|
+
names?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* How the note names are written: `letters` (C D E, the default), `solfege` (Do Ré Mi) or
|
|
57
|
+
* `german` (H for B). The library's naming, as for the diagrams.
|
|
58
|
+
*/
|
|
59
|
+
naming?: Naming;
|
|
60
|
+
/**
|
|
61
|
+
* The engine the page or the app chose (#124): `generaluser` (the instrument files of
|
|
62
|
+
* `assets.instruments`) or `sonivox` (`assets.soundFont`, whole). A block's `engine:` line
|
|
63
|
+
* comes first; what the assets don't have falls back (see `tabEngine`).
|
|
64
|
+
*/
|
|
65
|
+
engine?: Engine;
|
|
39
66
|
/** The bytes of a file a block names (`file: [[Song.gp]]`); null when it can't be found. */
|
|
40
67
|
resolveFile?: (link: string) => Promise<Uint8Array | null>;
|
|
41
68
|
/** The player bar (default true). The player itself starts at the first Play. */
|
|
42
69
|
player?: boolean;
|
|
43
70
|
/** Called once alphaTab's API exists (before the score is drawn). */
|
|
44
71
|
onApi?: (api: AT.AlphaTabApi) => void;
|
|
72
|
+
/**
|
|
73
|
+
* The language of the bar's texts and of the messages the block shows (#136): `'en'` (the
|
|
74
|
+
* default) or `'fr'`; `'fr-BE'` and the like read as French, anything else as English. Read
|
|
75
|
+
* when the block is drawn. The block's syntax and alphaTab's own messages stay as they are.
|
|
76
|
+
*/
|
|
77
|
+
language?: Language | (string & {});
|
|
45
78
|
/**
|
|
46
79
|
* The Tab / Score / Both control in the player bar (default true; Music Practice #83): a click
|
|
47
80
|
* draws the block again in that view, without changing its text. Shown when the score has a
|
|
@@ -83,6 +116,18 @@ export interface TabSource {
|
|
|
83
116
|
file: string | null;
|
|
84
117
|
/** Tracks to draw (1-based); all by default. */
|
|
85
118
|
tracks: number[] | null;
|
|
119
|
+
/** The block's wish for an engine (`engine:`, #124); null without one. */
|
|
120
|
+
engine: Engine | null;
|
|
121
|
+
/**
|
|
122
|
+
* `layout: line` draws the music on one line that scrolls sideways (#97); `page`, the
|
|
123
|
+
* default, in systems one under the other.
|
|
124
|
+
*/
|
|
125
|
+
layout: 'page' | 'line';
|
|
126
|
+
/**
|
|
127
|
+
* `names: on` writes the name of every note (#112), `names: off` doesn't; null without the
|
|
128
|
+
* line (the app's default then).
|
|
129
|
+
*/
|
|
130
|
+
names: boolean | null;
|
|
86
131
|
/** The alphaTex itself. */
|
|
87
132
|
tex: string;
|
|
88
133
|
/** Lines of the block before the alphaTex (settings, blank lines), for error positions. */
|
|
@@ -94,12 +139,19 @@ export interface TabSource {
|
|
|
94
139
|
fromText: boolean;
|
|
95
140
|
}
|
|
96
141
|
/**
|
|
97
|
-
* A tab block's own settings (lines `staves:`, `file:`, `tracks:` at the top, `//` comments
|
|
142
|
+
* A tab block's own settings (lines `staves:`, `file:`, `tracks:`, `engine:`, `layout:`, `names:` at the top, `//` comments
|
|
98
143
|
* allowed among them), then its alphaTex, or a plain-text tab, converted (#71). ```tab blocks show
|
|
99
144
|
* tablature, ```score blocks standard notation, unless `staves:` says otherwise. Throws a message
|
|
100
145
|
* for the user.
|
|
101
146
|
*/
|
|
102
147
|
export declare function parseTabSource(language: 'tab' | 'score', source: string): TabSource;
|
|
148
|
+
/** Where in the block a mistake is: the same numbers the message shows, whatever its language. */
|
|
149
|
+
export interface TabErrorPlace {
|
|
150
|
+
/** The block's line, from 1. */
|
|
151
|
+
line?: number;
|
|
152
|
+
/** The column, as the message shows it. */
|
|
153
|
+
column?: number;
|
|
154
|
+
}
|
|
103
155
|
/** The part of alphaTab's score read and set to hide its default dynamics. */
|
|
104
156
|
interface DynamicsView {
|
|
105
157
|
stylesheet: {
|
|
@@ -132,7 +184,7 @@ export interface TabResult {
|
|
|
132
184
|
ready: Promise<{
|
|
133
185
|
ok: boolean;
|
|
134
186
|
error: string | null;
|
|
135
|
-
}>;
|
|
187
|
+
} & TabErrorPlace>;
|
|
136
188
|
/** The alphaTab API, for exports and playback. */
|
|
137
189
|
api: AT.AlphaTabApi | null;
|
|
138
190
|
/**
|