@k-l-lambda/lilylet 0.1.49 → 0.1.50
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/lib/abc/abc.d.ts +102 -0
- package/lib/abc/abc.js +25 -0
- package/lib/abc/grammar.jison.js +1203 -0
- package/lib/abc/parser.d.ts +3 -0
- package/lib/abc/parser.js +6 -0
- package/lib/abcDecoder.d.ts +1 -0
- package/lib/abcDecoder.js +1 -0
- package/lib/grammar.jison.js +1 -1303
- package/lib/index.d.ts +1 -8
- package/lib/index.js +1 -10
- package/lib/lilylet/abcDecoder.d.ts +25 -0
- package/lib/lilylet/abcDecoder.js +1007 -0
- package/lib/lilylet/grammar.jison.js +1308 -0
- package/lib/lilylet/index.d.ts +10 -0
- package/lib/lilylet/index.js +10 -0
- package/lib/lilylet/lilypondDecoder.d.ts +29 -0
- package/lib/lilylet/lilypondDecoder.js +1053 -0
- package/lib/lilylet/lilypondEncoder.d.ts +34 -0
- package/lib/lilylet/lilypondEncoder.js +759 -0
- package/lib/lilylet/meiEncoder.d.ts +8 -0
- package/lib/lilylet/meiEncoder.js +1808 -0
- package/lib/lilylet/musicXmlDecoder.d.ts +20 -0
- package/lib/lilylet/musicXmlDecoder.js +1195 -0
- package/lib/lilylet/musicXmlEncoder.d.ts +15 -0
- package/lib/lilylet/musicXmlEncoder.js +701 -0
- package/lib/lilylet/musicXmlTypes.d.ts +199 -0
- package/lib/lilylet/musicXmlTypes.js +7 -0
- package/lib/lilylet/musicXmlUtils.d.ts +92 -0
- package/lib/lilylet/musicXmlUtils.js +469 -0
- package/lib/lilylet/parser.d.ts +3 -0
- package/lib/lilylet/parser.js +151 -0
- package/lib/lilylet/serializer.d.ts +11 -0
- package/lib/lilylet/serializer.js +653 -0
- package/lib/lilylet/types.d.ts +245 -0
- package/lib/lilylet/types.js +99 -0
- package/lib/lilypondDecoder.d.ts +1 -29
- package/lib/lilypondDecoder.js +1 -1006
- package/lib/lilypondEncoder.d.ts +1 -34
- package/lib/lilypondEncoder.js +1 -759
- package/lib/meiEncoder.d.ts +1 -8
- package/lib/meiEncoder.js +1 -1545
- package/lib/musicXmlDecoder.d.ts +1 -20
- package/lib/musicXmlDecoder.js +1 -1151
- package/lib/musicXmlEncoder.d.ts +1 -15
- package/lib/musicXmlEncoder.js +1 -666
- package/lib/musicXmlTypes.d.ts +1 -199
- package/lib/musicXmlTypes.js +1 -7
- package/lib/musicXmlUtils.d.ts +1 -81
- package/lib/musicXmlUtils.js +1 -435
- package/lib/parser.d.ts +1 -3
- package/lib/parser.js +1 -151
- package/lib/serializer.d.ts +1 -11
- package/lib/serializer.js +1 -650
- package/lib/types.d.ts +1 -244
- package/lib/types.js +1 -99
- package/package.json +2 -1
- package/source/abc/abc.jison +692 -0
- package/source/abc/abc.ts +176 -0
- package/source/abc/grammar.jison.js +1203 -0
- package/source/abc/parser.ts +12 -0
- package/source/lilylet/abcDecoder.ts +1121 -0
- package/source/lilylet/grammar.jison.js +170 -165
- package/source/lilylet/index.ts +4 -3
- package/source/lilylet/lilylet.jison +2 -0
- package/source/lilylet/lilypondDecoder.ts +91 -41
- package/source/lilylet/meiEncoder.ts +280 -0
- package/source/lilylet/musicXmlDecoder.ts +74 -27
- package/source/lilylet/musicXmlEncoder.ts +201 -146
- package/source/lilylet/musicXmlUtils.ts +46 -4
- package/source/lilylet/serializer.ts +3 -0
- package/source/lilylet/types.ts +1 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
export declare enum Phonet {
|
|
2
|
+
c = "c",
|
|
3
|
+
d = "d",
|
|
4
|
+
e = "e",
|
|
5
|
+
f = "f",
|
|
6
|
+
g = "g",
|
|
7
|
+
a = "a",
|
|
8
|
+
b = "b"
|
|
9
|
+
}
|
|
10
|
+
export declare enum Accidental {
|
|
11
|
+
natural = "natural",
|
|
12
|
+
sharp = "sharp",
|
|
13
|
+
flat = "flat",
|
|
14
|
+
doubleSharp = "doubleSharp",
|
|
15
|
+
doubleFlat = "doubleFlat"
|
|
16
|
+
}
|
|
17
|
+
export declare enum Clef {
|
|
18
|
+
treble = "treble",
|
|
19
|
+
bass = "bass",
|
|
20
|
+
alto = "alto"
|
|
21
|
+
}
|
|
22
|
+
export declare enum StemDirection {
|
|
23
|
+
up = "up",
|
|
24
|
+
down = "down",
|
|
25
|
+
auto = "auto"
|
|
26
|
+
}
|
|
27
|
+
export declare enum ArticulationType {
|
|
28
|
+
staccato = "staccato",
|
|
29
|
+
staccatissimo = "staccatissimo",
|
|
30
|
+
tenuto = "tenuto",
|
|
31
|
+
marcato = "marcato",
|
|
32
|
+
accent = "accent",
|
|
33
|
+
portato = "portato"
|
|
34
|
+
}
|
|
35
|
+
export declare enum OrnamentType {
|
|
36
|
+
trill = "trill",
|
|
37
|
+
turn = "turn",
|
|
38
|
+
mordent = "mordent",
|
|
39
|
+
prall = "prall",
|
|
40
|
+
fermata = "fermata",
|
|
41
|
+
shortFermata = "shortFermata",
|
|
42
|
+
arpeggio = "arpeggio"
|
|
43
|
+
}
|
|
44
|
+
export declare enum DynamicType {
|
|
45
|
+
ppp = "ppp",
|
|
46
|
+
pp = "pp",
|
|
47
|
+
p = "p",
|
|
48
|
+
mp = "mp",
|
|
49
|
+
mf = "mf",
|
|
50
|
+
f = "f",
|
|
51
|
+
ff = "ff",
|
|
52
|
+
fff = "fff",
|
|
53
|
+
sfz = "sfz",
|
|
54
|
+
rfz = "rfz"
|
|
55
|
+
}
|
|
56
|
+
export declare enum HairpinType {
|
|
57
|
+
crescendoStart = "crescendoStart",
|
|
58
|
+
crescendoEnd = "crescendoEnd",
|
|
59
|
+
diminuendoStart = "diminuendoStart",
|
|
60
|
+
diminuendoEnd = "diminuendoEnd"
|
|
61
|
+
}
|
|
62
|
+
export declare enum PedalType {
|
|
63
|
+
sustainOn = "sustainOn",
|
|
64
|
+
sustainOff = "sustainOff",
|
|
65
|
+
sostenutoOn = "sostenutoOn",
|
|
66
|
+
sostenutoOff = "sostenutoOff",
|
|
67
|
+
unaCordaOn = "unaCordaOn",
|
|
68
|
+
unaCordaOff = "unaCordaOff"
|
|
69
|
+
}
|
|
70
|
+
export declare enum BarlineType {
|
|
71
|
+
single = "|",
|
|
72
|
+
double = "||",
|
|
73
|
+
end = "|.",
|
|
74
|
+
repeatStart = ".|:",
|
|
75
|
+
repeatEnd = ":|.",
|
|
76
|
+
repeatBoth = ":..:"
|
|
77
|
+
}
|
|
78
|
+
export declare enum NavigationMarkType {
|
|
79
|
+
coda = "coda",
|
|
80
|
+
segno = "segno"
|
|
81
|
+
}
|
|
82
|
+
export interface Fraction {
|
|
83
|
+
numerator: number;
|
|
84
|
+
denominator: number;
|
|
85
|
+
}
|
|
86
|
+
export interface TimeSig extends Fraction {
|
|
87
|
+
symbol?: 'common' | 'cut';
|
|
88
|
+
}
|
|
89
|
+
export interface Pitch {
|
|
90
|
+
phonet: Phonet;
|
|
91
|
+
accidental?: Accidental;
|
|
92
|
+
octave: number;
|
|
93
|
+
}
|
|
94
|
+
export interface Duration {
|
|
95
|
+
division: number;
|
|
96
|
+
dots: number;
|
|
97
|
+
tuplet?: Fraction;
|
|
98
|
+
}
|
|
99
|
+
export declare enum Placement {
|
|
100
|
+
above = "above",
|
|
101
|
+
below = "below"
|
|
102
|
+
}
|
|
103
|
+
export interface Articulation {
|
|
104
|
+
markType: 'articulation';
|
|
105
|
+
type: ArticulationType;
|
|
106
|
+
placement?: Placement;
|
|
107
|
+
}
|
|
108
|
+
export interface Ornament {
|
|
109
|
+
markType: 'ornament';
|
|
110
|
+
type: OrnamentType;
|
|
111
|
+
}
|
|
112
|
+
export interface Dynamic {
|
|
113
|
+
markType: 'dynamic';
|
|
114
|
+
type: DynamicType;
|
|
115
|
+
}
|
|
116
|
+
export interface Hairpin {
|
|
117
|
+
markType: 'hairpin';
|
|
118
|
+
type: HairpinType;
|
|
119
|
+
}
|
|
120
|
+
export interface Tie {
|
|
121
|
+
markType: 'tie';
|
|
122
|
+
start: boolean;
|
|
123
|
+
}
|
|
124
|
+
export interface Slur {
|
|
125
|
+
markType: 'slur';
|
|
126
|
+
start: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface Beam {
|
|
129
|
+
markType: 'beam';
|
|
130
|
+
start: boolean;
|
|
131
|
+
}
|
|
132
|
+
export interface Pedal {
|
|
133
|
+
markType: 'pedal';
|
|
134
|
+
type: PedalType;
|
|
135
|
+
}
|
|
136
|
+
export interface Fingering {
|
|
137
|
+
markType: 'fingering';
|
|
138
|
+
finger: number;
|
|
139
|
+
placement?: Placement;
|
|
140
|
+
}
|
|
141
|
+
export interface NavigationMark {
|
|
142
|
+
markType: 'navigation';
|
|
143
|
+
type: NavigationMarkType;
|
|
144
|
+
}
|
|
145
|
+
export interface MarkupMark {
|
|
146
|
+
markType: 'markup';
|
|
147
|
+
content: string;
|
|
148
|
+
placement?: Placement;
|
|
149
|
+
}
|
|
150
|
+
export type Mark = Articulation | Ornament | Dynamic | Hairpin | Tie | Slur | Beam | Pedal | Fingering | NavigationMark | MarkupMark;
|
|
151
|
+
export interface KeySignature {
|
|
152
|
+
pitch: Phonet;
|
|
153
|
+
accidental?: Accidental;
|
|
154
|
+
mode: 'major' | 'minor';
|
|
155
|
+
}
|
|
156
|
+
export interface Tempo {
|
|
157
|
+
text?: string;
|
|
158
|
+
beat?: Duration;
|
|
159
|
+
bpm?: number;
|
|
160
|
+
}
|
|
161
|
+
export interface NoteEvent {
|
|
162
|
+
type: 'note';
|
|
163
|
+
pitches: Pitch[];
|
|
164
|
+
duration: Duration;
|
|
165
|
+
marks?: Mark[];
|
|
166
|
+
grace?: boolean;
|
|
167
|
+
tremolo?: number;
|
|
168
|
+
staff?: number;
|
|
169
|
+
stemDirection?: StemDirection;
|
|
170
|
+
}
|
|
171
|
+
export interface RestEvent {
|
|
172
|
+
type: 'rest';
|
|
173
|
+
duration: Duration;
|
|
174
|
+
invisible?: boolean;
|
|
175
|
+
fullMeasure?: boolean;
|
|
176
|
+
pitch?: Pitch;
|
|
177
|
+
}
|
|
178
|
+
export interface ContextChange {
|
|
179
|
+
type: 'context';
|
|
180
|
+
key?: KeySignature;
|
|
181
|
+
time?: Fraction;
|
|
182
|
+
clef?: Clef;
|
|
183
|
+
ottava?: number;
|
|
184
|
+
stemDirection?: StemDirection;
|
|
185
|
+
tempo?: Tempo;
|
|
186
|
+
staff?: number;
|
|
187
|
+
}
|
|
188
|
+
export interface TremoloEvent {
|
|
189
|
+
type: 'tremolo';
|
|
190
|
+
pitchA: Pitch[];
|
|
191
|
+
pitchB: Pitch[];
|
|
192
|
+
count: number;
|
|
193
|
+
division: number;
|
|
194
|
+
}
|
|
195
|
+
export interface TupletEvent {
|
|
196
|
+
type: 'tuplet';
|
|
197
|
+
ratio: Fraction;
|
|
198
|
+
events: (NoteEvent | RestEvent)[];
|
|
199
|
+
}
|
|
200
|
+
export interface PitchResetEvent {
|
|
201
|
+
type: 'pitchReset';
|
|
202
|
+
}
|
|
203
|
+
export interface BarlineEvent {
|
|
204
|
+
type: 'barline';
|
|
205
|
+
style: string;
|
|
206
|
+
}
|
|
207
|
+
export interface HarmonyEvent {
|
|
208
|
+
type: 'harmony';
|
|
209
|
+
text: string;
|
|
210
|
+
}
|
|
211
|
+
export interface MarkupEvent {
|
|
212
|
+
type: 'markup';
|
|
213
|
+
content: string;
|
|
214
|
+
placement?: Placement;
|
|
215
|
+
}
|
|
216
|
+
export type Event = NoteEvent | RestEvent | ContextChange | TremoloEvent | TupletEvent | PitchResetEvent | BarlineEvent | HarmonyEvent | MarkupEvent;
|
|
217
|
+
export interface Voice {
|
|
218
|
+
staff: number;
|
|
219
|
+
events: Event[];
|
|
220
|
+
}
|
|
221
|
+
export interface Metadata {
|
|
222
|
+
title?: string;
|
|
223
|
+
subtitle?: string;
|
|
224
|
+
composer?: string;
|
|
225
|
+
arranger?: string;
|
|
226
|
+
lyricist?: string;
|
|
227
|
+
opus?: string;
|
|
228
|
+
instrument?: string;
|
|
229
|
+
genre?: string;
|
|
230
|
+
autoBeam?: 'auto' | 'on' | 'off';
|
|
231
|
+
}
|
|
232
|
+
export interface Part {
|
|
233
|
+
name?: string;
|
|
234
|
+
voices: Voice[];
|
|
235
|
+
}
|
|
236
|
+
export interface Measure {
|
|
237
|
+
key?: KeySignature;
|
|
238
|
+
timeSig?: TimeSig;
|
|
239
|
+
parts: Part[];
|
|
240
|
+
partial?: boolean;
|
|
241
|
+
}
|
|
242
|
+
export interface LilyletDoc {
|
|
243
|
+
metadata?: Metadata;
|
|
244
|
+
measures: Measure[];
|
|
245
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// === Enums ===
|
|
2
|
+
export var Phonet;
|
|
3
|
+
(function (Phonet) {
|
|
4
|
+
Phonet["c"] = "c";
|
|
5
|
+
Phonet["d"] = "d";
|
|
6
|
+
Phonet["e"] = "e";
|
|
7
|
+
Phonet["f"] = "f";
|
|
8
|
+
Phonet["g"] = "g";
|
|
9
|
+
Phonet["a"] = "a";
|
|
10
|
+
Phonet["b"] = "b";
|
|
11
|
+
})(Phonet || (Phonet = {}));
|
|
12
|
+
export var Accidental;
|
|
13
|
+
(function (Accidental) {
|
|
14
|
+
Accidental["natural"] = "natural";
|
|
15
|
+
Accidental["sharp"] = "sharp";
|
|
16
|
+
Accidental["flat"] = "flat";
|
|
17
|
+
Accidental["doubleSharp"] = "doubleSharp";
|
|
18
|
+
Accidental["doubleFlat"] = "doubleFlat";
|
|
19
|
+
})(Accidental || (Accidental = {}));
|
|
20
|
+
export var Clef;
|
|
21
|
+
(function (Clef) {
|
|
22
|
+
Clef["treble"] = "treble";
|
|
23
|
+
Clef["bass"] = "bass";
|
|
24
|
+
Clef["alto"] = "alto";
|
|
25
|
+
})(Clef || (Clef = {}));
|
|
26
|
+
export var StemDirection;
|
|
27
|
+
(function (StemDirection) {
|
|
28
|
+
StemDirection["up"] = "up";
|
|
29
|
+
StemDirection["down"] = "down";
|
|
30
|
+
StemDirection["auto"] = "auto";
|
|
31
|
+
})(StemDirection || (StemDirection = {}));
|
|
32
|
+
export var ArticulationType;
|
|
33
|
+
(function (ArticulationType) {
|
|
34
|
+
ArticulationType["staccato"] = "staccato";
|
|
35
|
+
ArticulationType["staccatissimo"] = "staccatissimo";
|
|
36
|
+
ArticulationType["tenuto"] = "tenuto";
|
|
37
|
+
ArticulationType["marcato"] = "marcato";
|
|
38
|
+
ArticulationType["accent"] = "accent";
|
|
39
|
+
ArticulationType["portato"] = "portato";
|
|
40
|
+
})(ArticulationType || (ArticulationType = {}));
|
|
41
|
+
export var OrnamentType;
|
|
42
|
+
(function (OrnamentType) {
|
|
43
|
+
OrnamentType["trill"] = "trill";
|
|
44
|
+
OrnamentType["turn"] = "turn";
|
|
45
|
+
OrnamentType["mordent"] = "mordent";
|
|
46
|
+
OrnamentType["prall"] = "prall";
|
|
47
|
+
OrnamentType["fermata"] = "fermata";
|
|
48
|
+
OrnamentType["shortFermata"] = "shortFermata";
|
|
49
|
+
OrnamentType["arpeggio"] = "arpeggio";
|
|
50
|
+
})(OrnamentType || (OrnamentType = {}));
|
|
51
|
+
export var DynamicType;
|
|
52
|
+
(function (DynamicType) {
|
|
53
|
+
DynamicType["ppp"] = "ppp";
|
|
54
|
+
DynamicType["pp"] = "pp";
|
|
55
|
+
DynamicType["p"] = "p";
|
|
56
|
+
DynamicType["mp"] = "mp";
|
|
57
|
+
DynamicType["mf"] = "mf";
|
|
58
|
+
DynamicType["f"] = "f";
|
|
59
|
+
DynamicType["ff"] = "ff";
|
|
60
|
+
DynamicType["fff"] = "fff";
|
|
61
|
+
DynamicType["sfz"] = "sfz";
|
|
62
|
+
DynamicType["rfz"] = "rfz";
|
|
63
|
+
})(DynamicType || (DynamicType = {}));
|
|
64
|
+
export var HairpinType;
|
|
65
|
+
(function (HairpinType) {
|
|
66
|
+
HairpinType["crescendoStart"] = "crescendoStart";
|
|
67
|
+
HairpinType["crescendoEnd"] = "crescendoEnd";
|
|
68
|
+
HairpinType["diminuendoStart"] = "diminuendoStart";
|
|
69
|
+
HairpinType["diminuendoEnd"] = "diminuendoEnd";
|
|
70
|
+
})(HairpinType || (HairpinType = {}));
|
|
71
|
+
export var PedalType;
|
|
72
|
+
(function (PedalType) {
|
|
73
|
+
PedalType["sustainOn"] = "sustainOn";
|
|
74
|
+
PedalType["sustainOff"] = "sustainOff";
|
|
75
|
+
PedalType["sostenutoOn"] = "sostenutoOn";
|
|
76
|
+
PedalType["sostenutoOff"] = "sostenutoOff";
|
|
77
|
+
PedalType["unaCordaOn"] = "unaCordaOn";
|
|
78
|
+
PedalType["unaCordaOff"] = "unaCordaOff";
|
|
79
|
+
})(PedalType || (PedalType = {}));
|
|
80
|
+
export var BarlineType;
|
|
81
|
+
(function (BarlineType) {
|
|
82
|
+
BarlineType["single"] = "|";
|
|
83
|
+
BarlineType["double"] = "||";
|
|
84
|
+
BarlineType["end"] = "|.";
|
|
85
|
+
BarlineType["repeatStart"] = ".|:";
|
|
86
|
+
BarlineType["repeatEnd"] = ":|.";
|
|
87
|
+
BarlineType["repeatBoth"] = ":..:";
|
|
88
|
+
})(BarlineType || (BarlineType = {}));
|
|
89
|
+
export var NavigationMarkType;
|
|
90
|
+
(function (NavigationMarkType) {
|
|
91
|
+
NavigationMarkType["coda"] = "coda";
|
|
92
|
+
NavigationMarkType["segno"] = "segno";
|
|
93
|
+
})(NavigationMarkType || (NavigationMarkType = {}));
|
|
94
|
+
// === Placement Direction ===
|
|
95
|
+
export var Placement;
|
|
96
|
+
(function (Placement) {
|
|
97
|
+
Placement["above"] = "above";
|
|
98
|
+
Placement["below"] = "below";
|
|
99
|
+
})(Placement || (Placement = {}));
|
package/lib/lilypondDecoder.d.ts
CHANGED
|
@@ -1,29 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* LilyPond to Lilylet Decoder
|
|
3
|
-
*
|
|
4
|
-
* Converts LilyPond notation files to Lilylet document format using the lotus parser.
|
|
5
|
-
* This module is browser-compatible - it uses pre-compiled parser from lotus.
|
|
6
|
-
*/
|
|
7
|
-
import * as lilyParser from "@k-l-lambda/lotus/lib/inc/lilyParser/index.js";
|
|
8
|
-
import { LilyletDoc, Event, Fraction } from "./types";
|
|
9
|
-
interface ParsedMeasure {
|
|
10
|
-
key: number | null;
|
|
11
|
-
timeSig: Fraction | null;
|
|
12
|
-
voices: ParsedVoice[];
|
|
13
|
-
partial: boolean;
|
|
14
|
-
}
|
|
15
|
-
interface ParsedVoice {
|
|
16
|
-
staff: number;
|
|
17
|
-
partIndex: number;
|
|
18
|
-
events: Event[];
|
|
19
|
-
}
|
|
20
|
-
declare const parseLilyDocument: (lilyDocument: lilyParser.LilyDocument) => ParsedMeasure[];
|
|
21
|
-
/**
|
|
22
|
-
* Decode a LilyPond string to LilyletDoc (synchronous, browser-compatible)
|
|
23
|
-
*/
|
|
24
|
-
declare const decode: (lilypondSource: string) => LilyletDoc;
|
|
25
|
-
/**
|
|
26
|
-
* Decode from pre-parsed LilyDocument (synchronous, for when you already have parsed data)
|
|
27
|
-
*/
|
|
28
|
-
declare const decodeFromDocument: (lilyDocument: lilyParser.LilyDocument) => LilyletDoc;
|
|
29
|
-
export { decode, decodeFromDocument, parseLilyDocument, };
|
|
1
|
+
export * from "./lilylet/lilypondDecoder.js";
|