musicxml-io 0.5.0 → 0.5.2
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/dist/index.js
CHANGED
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
|
|
130
|
-
var
|
|
130
|
+
var _chunkTBGS7OISjs = require('./chunk-TBGS7OIS.js');
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
|
|
@@ -214,9 +214,14 @@ var _chunkVE2KCZMAjs = require('./chunk-VE2KCZMA.js');
|
|
|
214
214
|
|
|
215
215
|
// src/importers/musicxml.ts
|
|
216
216
|
var _txml = require('txml');
|
|
217
|
+
var _entityMap = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" };
|
|
218
|
+
var _entityRegex = /&(?:(amp|lt|gt|quot|apos)|#(\d+)|#x([0-9a-fA-F]+));/g;
|
|
217
219
|
function decodeXmlEntities(s) {
|
|
218
220
|
if (s.indexOf("&") === -1) return s;
|
|
219
|
-
return s.replace(
|
|
221
|
+
return s.replace(
|
|
222
|
+
_entityRegex,
|
|
223
|
+
(_, named, dec, hex) => named ? _entityMap[named] : dec ? String.fromCharCode(parseInt(dec, 10)) : String.fromCharCode(parseInt(hex, 16))
|
|
224
|
+
);
|
|
220
225
|
}
|
|
221
226
|
function decodeTree(nodes) {
|
|
222
227
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -237,8 +242,9 @@ function decodeTree(nodes) {
|
|
|
237
242
|
}
|
|
238
243
|
}
|
|
239
244
|
}
|
|
245
|
+
var TXML_OPTIONS = { noChildNodes: [] };
|
|
240
246
|
function parse(xmlString) {
|
|
241
|
-
const parsed = _txml.parse.call(void 0, xmlString);
|
|
247
|
+
const parsed = _txml.parse.call(void 0, xmlString, TXML_OPTIONS);
|
|
242
248
|
decodeTree(parsed);
|
|
243
249
|
let scorePartwiseVersion;
|
|
244
250
|
let scorePartwise;
|
|
@@ -259,7 +265,8 @@ function parse(xmlString) {
|
|
|
259
265
|
return score;
|
|
260
266
|
}
|
|
261
267
|
function findElement(elements, tagName) {
|
|
262
|
-
for (
|
|
268
|
+
for (let i = 0; i < elements.length; i++) {
|
|
269
|
+
const el = elements[i];
|
|
263
270
|
if (typeof el !== "string" && el.tagName === tagName) {
|
|
264
271
|
return el.children;
|
|
265
272
|
}
|
|
@@ -270,9 +277,12 @@ function getElementContent(elements, tagName) {
|
|
|
270
277
|
return findElement(elements, tagName);
|
|
271
278
|
}
|
|
272
279
|
function extractText(elements, preserveWhitespace = false) {
|
|
273
|
-
for (
|
|
280
|
+
for (let i = 0; i < elements.length; i++) {
|
|
281
|
+
const item = elements[i];
|
|
274
282
|
if (typeof item === "string") {
|
|
275
|
-
|
|
283
|
+
if (preserveWhitespace) return item;
|
|
284
|
+
const trimmed = item.trim();
|
|
285
|
+
if (trimmed.length > 0) return trimmed;
|
|
276
286
|
}
|
|
277
287
|
}
|
|
278
288
|
return "";
|
|
@@ -291,7 +301,8 @@ function getElementTextAsInt(elements, tagName, defaultValue) {
|
|
|
291
301
|
}
|
|
292
302
|
function collectElements(elements, tagName, parser) {
|
|
293
303
|
const results = [];
|
|
294
|
-
for (
|
|
304
|
+
for (let i = 0; i < elements.length; i++) {
|
|
305
|
+
const el = elements[i];
|
|
295
306
|
if (typeof el !== "string" && el.tagName === tagName) {
|
|
296
307
|
results.push(parser(el.children, el.attributes));
|
|
297
308
|
}
|
|
@@ -299,7 +310,8 @@ function collectElements(elements, tagName, parser) {
|
|
|
299
310
|
return results;
|
|
300
311
|
}
|
|
301
312
|
function parseFirstElement(elements, tagName, parser) {
|
|
302
|
-
for (
|
|
313
|
+
for (let i = 0; i < elements.length; i++) {
|
|
314
|
+
const el = elements[i];
|
|
303
315
|
if (typeof el !== "string" && el.tagName === tagName) {
|
|
304
316
|
return parser(el.children, el.attributes);
|
|
305
317
|
}
|
|
@@ -317,7 +329,7 @@ function parseScorePartwise(elements) {
|
|
|
317
329
|
const defaults = parseDefaults(elements);
|
|
318
330
|
const credits = parseCredits(elements);
|
|
319
331
|
return {
|
|
320
|
-
_id:
|
|
332
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
321
333
|
metadata,
|
|
322
334
|
partList,
|
|
323
335
|
parts,
|
|
@@ -574,7 +586,7 @@ function parseSystemLayout(elements) {
|
|
|
574
586
|
}
|
|
575
587
|
function parseCredits(elements) {
|
|
576
588
|
const credits = collectElements(elements, "credit", (content, attrs) => {
|
|
577
|
-
const credit = { _id:
|
|
589
|
+
const credit = { _id: _chunkTBGS7OISjs.generateId.call(void 0, ) };
|
|
578
590
|
if (attrs["page"]) credit.page = parseInt(attrs["page"], 10);
|
|
579
591
|
const types = collectElements(content, "credit-type", (c) => extractText(c));
|
|
580
592
|
const words = collectElements(content, "credit-words", (c, a) => {
|
|
@@ -618,7 +630,7 @@ function parsePartList(elements) {
|
|
|
618
630
|
const attrs = el.attributes;
|
|
619
631
|
const content = el.children;
|
|
620
632
|
const partInfo = {
|
|
621
|
-
_id:
|
|
633
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
622
634
|
type: "score-part",
|
|
623
635
|
id: attrs["id"] || ""
|
|
624
636
|
};
|
|
@@ -717,7 +729,7 @@ function parsePartList(elements) {
|
|
|
717
729
|
const attrs = el.attributes;
|
|
718
730
|
const content = el.children;
|
|
719
731
|
const group = {
|
|
720
|
-
_id:
|
|
732
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
721
733
|
type: "part-group",
|
|
722
734
|
groupType: attrs["type"] === "stop" ? "stop" : "start"
|
|
723
735
|
};
|
|
@@ -754,7 +766,7 @@ function parseParts(elements) {
|
|
|
754
766
|
const attrs = el.attributes;
|
|
755
767
|
const content = el.children;
|
|
756
768
|
const part = {
|
|
757
|
-
_id:
|
|
769
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
758
770
|
id: attrs["id"] || "",
|
|
759
771
|
measures: []
|
|
760
772
|
};
|
|
@@ -773,7 +785,7 @@ function parseParts(elements) {
|
|
|
773
785
|
}
|
|
774
786
|
function parseMeasure(elements, attrs) {
|
|
775
787
|
const measure = {
|
|
776
|
-
_id:
|
|
788
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
777
789
|
number: attrs["number"] || "0",
|
|
778
790
|
// Keep as string per MusicXML spec (token type)
|
|
779
791
|
entries: []
|
|
@@ -790,7 +802,7 @@ function parseMeasure(elements, attrs) {
|
|
|
790
802
|
measure.attributes = parsedAttrs;
|
|
791
803
|
} else {
|
|
792
804
|
const attrEntry = {
|
|
793
|
-
_id:
|
|
805
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
794
806
|
type: "attributes",
|
|
795
807
|
attributes: parsedAttrs
|
|
796
808
|
};
|
|
@@ -818,7 +830,7 @@ function parseMeasure(elements, attrs) {
|
|
|
818
830
|
} else if (el.tagName === "grouping") {
|
|
819
831
|
const grpAttrs = el.attributes;
|
|
820
832
|
const grouping = {
|
|
821
|
-
_id:
|
|
833
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
822
834
|
type: "grouping",
|
|
823
835
|
groupingType: grpAttrs["type"] || "start"
|
|
824
836
|
};
|
|
@@ -872,7 +884,7 @@ function parsePrint(elements, attrs) {
|
|
|
872
884
|
return print;
|
|
873
885
|
}
|
|
874
886
|
function parseAttributes(elements) {
|
|
875
|
-
const attrs = { _id:
|
|
887
|
+
const attrs = { _id: _chunkTBGS7OISjs.generateId.call(void 0, ) };
|
|
876
888
|
const divisions = getElementTextAsInt(elements, "divisions");
|
|
877
889
|
if (divisions !== void 0) attrs.divisions = divisions;
|
|
878
890
|
const staves = getElementTextAsInt(elements, "staves");
|
|
@@ -1038,14 +1050,10 @@ function parseTranspose(elements) {
|
|
|
1038
1050
|
}
|
|
1039
1051
|
function parseNote(elements, attrs) {
|
|
1040
1052
|
const note = {
|
|
1041
|
-
_id:
|
|
1053
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
1042
1054
|
type: "note",
|
|
1043
|
-
duration:
|
|
1055
|
+
duration: 0
|
|
1044
1056
|
};
|
|
1045
|
-
const voiceValue = getElementText(elements, "voice");
|
|
1046
|
-
if (voiceValue !== void 0 && voiceValue !== "") {
|
|
1047
|
-
note.voice = voiceValue;
|
|
1048
|
-
}
|
|
1049
1057
|
if (attrs["default-x"]) note.defaultX = parseFloat(attrs["default-x"]);
|
|
1050
1058
|
if (attrs["default-y"]) note.defaultY = parseFloat(attrs["default-y"]);
|
|
1051
1059
|
if (attrs["relative-x"]) note.relativeX = parseFloat(attrs["relative-x"]);
|
|
@@ -1056,149 +1064,183 @@ function parseNote(elements, attrs) {
|
|
|
1056
1064
|
if (attrs["print-dot"] === "yes") note.printDot = true;
|
|
1057
1065
|
if (attrs["print-spacing"] === "yes") note.printSpacing = true;
|
|
1058
1066
|
if (attrs["print-spacing"] === "no") note.printSpacing = false;
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
for (const el of elements) {
|
|
1067
|
+
let dotCount = 0;
|
|
1068
|
+
let notationsIndex = 0;
|
|
1069
|
+
let tieElements;
|
|
1070
|
+
let beams;
|
|
1071
|
+
let allNotations;
|
|
1072
|
+
let lyrics;
|
|
1073
|
+
let hasGrace = false;
|
|
1074
|
+
for (let i = 0; i < elements.length; i++) {
|
|
1075
|
+
const el = elements[i];
|
|
1069
1076
|
if (typeof el === "string") continue;
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1077
|
+
const tag = el.tagName;
|
|
1078
|
+
const elAttrs = el.attributes;
|
|
1079
|
+
const c = el.children;
|
|
1080
|
+
switch (tag) {
|
|
1081
|
+
case "duration": {
|
|
1082
|
+
const text = extractText(c);
|
|
1083
|
+
if (text) note.duration = parseInt(text, 10) || 0;
|
|
1084
|
+
break;
|
|
1085
|
+
}
|
|
1086
|
+
case "voice": {
|
|
1087
|
+
const text = extractText(c);
|
|
1088
|
+
if (text) note.voice = text;
|
|
1089
|
+
break;
|
|
1090
|
+
}
|
|
1091
|
+
case "cue":
|
|
1092
|
+
note.cue = true;
|
|
1093
|
+
break;
|
|
1094
|
+
case "chord":
|
|
1095
|
+
note.chord = true;
|
|
1096
|
+
break;
|
|
1097
|
+
case "dot":
|
|
1098
|
+
dotCount++;
|
|
1099
|
+
break;
|
|
1100
|
+
case "instrument":
|
|
1101
|
+
if (elAttrs["id"]) note.instrument = elAttrs["id"];
|
|
1102
|
+
break;
|
|
1103
|
+
case "pitch":
|
|
1104
|
+
note.pitch = parsePitch(c);
|
|
1105
|
+
break;
|
|
1106
|
+
case "rest": {
|
|
1107
|
+
const restInfo = {};
|
|
1108
|
+
if (elAttrs["measure"] === "yes") restInfo.measure = true;
|
|
1109
|
+
const displayStep = getElementText(c, "display-step");
|
|
1110
|
+
if (displayStep) restInfo.displayStep = displayStep;
|
|
1111
|
+
const displayOctave = getElementText(c, "display-octave");
|
|
1112
|
+
if (displayOctave) restInfo.displayOctave = parseInt(displayOctave, 10);
|
|
1113
|
+
note.rest = restInfo;
|
|
1114
|
+
break;
|
|
1115
|
+
}
|
|
1116
|
+
case "unpitched": {
|
|
1117
|
+
note.unpitched = {};
|
|
1118
|
+
const displayStep = getElementText(c, "display-step");
|
|
1119
|
+
if (displayStep) note.unpitched.displayStep = displayStep;
|
|
1120
|
+
const displayOctave = getElementText(c, "display-octave");
|
|
1121
|
+
if (displayOctave) note.unpitched.displayOctave = parseInt(displayOctave, 10);
|
|
1122
|
+
break;
|
|
1123
|
+
}
|
|
1124
|
+
case "staff": {
|
|
1125
|
+
const text = extractText(c);
|
|
1126
|
+
if (text) {
|
|
1127
|
+
const v = parseInt(text, 10);
|
|
1128
|
+
if (!isNaN(v)) note.staff = v;
|
|
1129
|
+
}
|
|
1130
|
+
break;
|
|
1131
|
+
}
|
|
1132
|
+
case "type": {
|
|
1133
|
+
const noteType = extractText(c);
|
|
1134
|
+
if (isValidNoteType(noteType)) note.noteType = noteType;
|
|
1135
|
+
if (elAttrs["size"]) note.noteTypeSize = elAttrs["size"];
|
|
1136
|
+
break;
|
|
1137
|
+
}
|
|
1138
|
+
case "accidental": {
|
|
1139
|
+
const accValue = extractText(c);
|
|
1140
|
+
if (isValidAccidental(accValue)) {
|
|
1141
|
+
const accInfo = { value: accValue };
|
|
1142
|
+
if (elAttrs["cautionary"] === "yes") accInfo.cautionary = true;
|
|
1143
|
+
if (elAttrs["editorial"] === "yes") accInfo.editorial = true;
|
|
1144
|
+
if (elAttrs["parentheses"] === "yes") accInfo.parentheses = true;
|
|
1145
|
+
if (elAttrs["bracket"] === "yes") accInfo.bracket = true;
|
|
1146
|
+
if (elAttrs["relative-x"]) accInfo.relativeX = parseFloat(elAttrs["relative-x"]);
|
|
1147
|
+
if (elAttrs["relative-y"]) accInfo.relativeY = parseFloat(elAttrs["relative-y"]);
|
|
1148
|
+
if (elAttrs["color"]) accInfo.color = elAttrs["color"];
|
|
1149
|
+
if (elAttrs["size"]) accInfo.size = elAttrs["size"];
|
|
1150
|
+
if (elAttrs["font-size"]) accInfo.fontSize = elAttrs["font-size"];
|
|
1151
|
+
note.accidental = accInfo;
|
|
1152
|
+
}
|
|
1153
|
+
break;
|
|
1154
|
+
}
|
|
1155
|
+
case "stem": {
|
|
1156
|
+
const stemValue = extractText(c);
|
|
1157
|
+
if (stemValue === "up" || stemValue === "down" || stemValue === "none" || stemValue === "double") {
|
|
1158
|
+
note.stem = { value: stemValue };
|
|
1159
|
+
if (elAttrs["default-x"]) note.stem.defaultX = parseFloat(elAttrs["default-x"]);
|
|
1160
|
+
if (elAttrs["default-y"]) note.stem.defaultY = parseFloat(elAttrs["default-y"]);
|
|
1161
|
+
}
|
|
1162
|
+
break;
|
|
1163
|
+
}
|
|
1164
|
+
case "notehead": {
|
|
1165
|
+
const nhValue = extractText(c);
|
|
1166
|
+
if (isValidNotehead(nhValue)) {
|
|
1167
|
+
const nhInfo = { value: nhValue };
|
|
1168
|
+
if (elAttrs["filled"] === "yes") nhInfo.filled = true;
|
|
1169
|
+
else if (elAttrs["filled"] === "no") nhInfo.filled = false;
|
|
1170
|
+
if (elAttrs["parentheses"] === "yes") nhInfo.parentheses = true;
|
|
1171
|
+
note.notehead = nhInfo;
|
|
1172
|
+
}
|
|
1173
|
+
break;
|
|
1174
|
+
}
|
|
1175
|
+
case "tie": {
|
|
1176
|
+
const t = elAttrs["type"];
|
|
1177
|
+
if (t === "start" || t === "stop" || t === "continue") {
|
|
1178
|
+
if (!tieElements) tieElements = [];
|
|
1179
|
+
tieElements.push({ type: t });
|
|
1180
|
+
}
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
case "beam": {
|
|
1184
|
+
if (!beams) beams = [];
|
|
1185
|
+
beams.push(parseBeam(c, elAttrs));
|
|
1186
|
+
break;
|
|
1187
|
+
}
|
|
1188
|
+
case "notations": {
|
|
1189
|
+
const parsedNotations = parseNotations(c, notationsIndex);
|
|
1190
|
+
if (parsedNotations.length > 0) {
|
|
1191
|
+
if (!allNotations) allNotations = [];
|
|
1192
|
+
for (let j = 0; j < parsedNotations.length; j++) allNotations.push(parsedNotations[j]);
|
|
1193
|
+
}
|
|
1194
|
+
notationsIndex++;
|
|
1195
|
+
break;
|
|
1196
|
+
}
|
|
1197
|
+
case "lyric": {
|
|
1198
|
+
if (!lyrics) lyrics = [];
|
|
1199
|
+
lyrics.push(parseLyric(c, elAttrs));
|
|
1200
|
+
break;
|
|
1201
|
+
}
|
|
1202
|
+
case "grace": {
|
|
1203
|
+
hasGrace = true;
|
|
1204
|
+
note.grace = {};
|
|
1205
|
+
if (elAttrs["slash"] === "yes") note.grace.slash = true;
|
|
1206
|
+
else if (elAttrs["slash"] === "no") note.grace.slash = false;
|
|
1207
|
+
if (elAttrs["steal-time-previous"]) {
|
|
1208
|
+
note.grace.stealTimePrevious = parseFloat(elAttrs["steal-time-previous"]);
|
|
1209
|
+
}
|
|
1210
|
+
if (elAttrs["steal-time-following"]) {
|
|
1211
|
+
note.grace.stealTimeFollowing = parseFloat(elAttrs["steal-time-following"]);
|
|
1212
|
+
}
|
|
1213
|
+
break;
|
|
1214
|
+
}
|
|
1215
|
+
case "time-modification": {
|
|
1216
|
+
const actualNotes = getElementText(c, "actual-notes");
|
|
1217
|
+
const normalNotes = getElementText(c, "normal-notes");
|
|
1218
|
+
const normalType = getElementText(c, "normal-type");
|
|
1219
|
+
note.timeModification = {
|
|
1220
|
+
actualNotes: parseInt(actualNotes || "3", 10),
|
|
1221
|
+
normalNotes: parseInt(normalNotes || "2", 10)
|
|
1222
|
+
};
|
|
1223
|
+
if (normalType && isValidNoteType(normalType)) {
|
|
1224
|
+
note.timeModification.normalType = normalType;
|
|
1225
|
+
}
|
|
1226
|
+
let ndCount = 0;
|
|
1227
|
+
for (const tm of c) {
|
|
1228
|
+
if (typeof tm !== "string" && tm.tagName === "normal-dot") ndCount++;
|
|
1229
|
+
}
|
|
1230
|
+
if (ndCount > 0) note.timeModification.normalDots = ndCount;
|
|
1231
|
+
break;
|
|
1232
|
+
}
|
|
1081
1233
|
}
|
|
1082
1234
|
}
|
|
1083
|
-
parseFirstElement(elements, "unpitched", (c) => {
|
|
1084
|
-
note.unpitched = {};
|
|
1085
|
-
const displayStep = getElementText(c, "display-step");
|
|
1086
|
-
if (displayStep) note.unpitched.displayStep = displayStep;
|
|
1087
|
-
const displayOctave = getElementText(c, "display-octave");
|
|
1088
|
-
if (displayOctave) note.unpitched.displayOctave = parseInt(displayOctave, 10);
|
|
1089
|
-
});
|
|
1090
|
-
const staff = getElementTextAsInt(elements, "staff");
|
|
1091
|
-
if (staff !== void 0) note.staff = staff;
|
|
1092
|
-
if (hasElement(elements, "chord")) {
|
|
1093
|
-
note.chord = true;
|
|
1094
|
-
}
|
|
1095
|
-
parseFirstElement(elements, "type", (c, a) => {
|
|
1096
|
-
const noteType = extractText(c);
|
|
1097
|
-
if (isValidNoteType(noteType)) note.noteType = noteType;
|
|
1098
|
-
if (a["size"]) note.noteTypeSize = a["size"];
|
|
1099
|
-
});
|
|
1100
|
-
const dotCount = elements.filter((el) => typeof el !== "string" && el.tagName === "dot").length;
|
|
1101
1235
|
if (dotCount > 0) note.dots = dotCount;
|
|
1102
|
-
|
|
1103
|
-
const accValue = extractText(c);
|
|
1104
|
-
if (isValidAccidental(accValue)) {
|
|
1105
|
-
const accInfo = { value: accValue };
|
|
1106
|
-
if (a["cautionary"] === "yes") accInfo.cautionary = true;
|
|
1107
|
-
if (a["editorial"] === "yes") accInfo.editorial = true;
|
|
1108
|
-
if (a["parentheses"] === "yes") accInfo.parentheses = true;
|
|
1109
|
-
if (a["bracket"] === "yes") accInfo.bracket = true;
|
|
1110
|
-
if (a["relative-x"]) accInfo.relativeX = parseFloat(a["relative-x"]);
|
|
1111
|
-
if (a["relative-y"]) accInfo.relativeY = parseFloat(a["relative-y"]);
|
|
1112
|
-
if (a["color"]) accInfo.color = a["color"];
|
|
1113
|
-
if (a["size"]) accInfo.size = a["size"];
|
|
1114
|
-
if (a["font-size"]) accInfo.fontSize = a["font-size"];
|
|
1115
|
-
note.accidental = accInfo;
|
|
1116
|
-
}
|
|
1117
|
-
});
|
|
1118
|
-
parseFirstElement(elements, "stem", (c, a) => {
|
|
1119
|
-
const stemValue = extractText(c);
|
|
1120
|
-
if (stemValue === "up" || stemValue === "down" || stemValue === "none" || stemValue === "double") {
|
|
1121
|
-
note.stem = { value: stemValue };
|
|
1122
|
-
if (a["default-x"]) note.stem.defaultX = parseFloat(a["default-x"]);
|
|
1123
|
-
if (a["default-y"]) note.stem.defaultY = parseFloat(a["default-y"]);
|
|
1124
|
-
}
|
|
1125
|
-
});
|
|
1126
|
-
parseFirstElement(elements, "notehead", (c, a) => {
|
|
1127
|
-
const nhValue = extractText(c);
|
|
1128
|
-
if (isValidNotehead(nhValue)) {
|
|
1129
|
-
const nhInfo = { value: nhValue };
|
|
1130
|
-
if (a["filled"] === "yes") nhInfo.filled = true;
|
|
1131
|
-
else if (a["filled"] === "no") nhInfo.filled = false;
|
|
1132
|
-
if (a["parentheses"] === "yes") nhInfo.parentheses = true;
|
|
1133
|
-
note.notehead = nhInfo;
|
|
1134
|
-
}
|
|
1135
|
-
});
|
|
1136
|
-
const tieElements = collectElements(elements, "tie", (_, a) => {
|
|
1137
|
-
const t = a["type"];
|
|
1138
|
-
return t === "start" || t === "stop" || t === "continue" ? { type: t } : null;
|
|
1139
|
-
}).filter((t) => t !== null);
|
|
1140
|
-
if (tieElements.length > 0) {
|
|
1236
|
+
if (tieElements) {
|
|
1141
1237
|
note.tie = tieElements[0];
|
|
1142
1238
|
if (tieElements.length > 1) note.ties = tieElements;
|
|
1143
1239
|
}
|
|
1144
|
-
|
|
1145
|
-
if (
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
for (const el of elements) {
|
|
1149
|
-
if (typeof el === "string") continue;
|
|
1150
|
-
if (el.tagName === "notations") {
|
|
1151
|
-
const parsedNotations = parseNotations(el.children, notationsIndex);
|
|
1152
|
-
allNotations.push(...parsedNotations);
|
|
1153
|
-
notationsIndex++;
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
if (allNotations.length > 0) {
|
|
1157
|
-
note.notations = allNotations;
|
|
1158
|
-
}
|
|
1159
|
-
const lyrics = [];
|
|
1160
|
-
for (const el of elements) {
|
|
1161
|
-
if (typeof el === "string") continue;
|
|
1162
|
-
if (el.tagName === "lyric") {
|
|
1163
|
-
lyrics.push(parseLyric(el.children, el.attributes));
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
if (lyrics.length > 0) note.lyrics = lyrics;
|
|
1167
|
-
for (const el of elements) {
|
|
1168
|
-
if (typeof el === "string") continue;
|
|
1169
|
-
if (el.tagName === "grace") {
|
|
1170
|
-
const graceAttrs = el.attributes;
|
|
1171
|
-
note.grace = {};
|
|
1172
|
-
if (graceAttrs["slash"] === "yes") note.grace.slash = true;
|
|
1173
|
-
else if (graceAttrs["slash"] === "no") note.grace.slash = false;
|
|
1174
|
-
if (graceAttrs["steal-time-previous"]) {
|
|
1175
|
-
note.grace.stealTimePrevious = parseFloat(graceAttrs["steal-time-previous"]);
|
|
1176
|
-
}
|
|
1177
|
-
if (graceAttrs["steal-time-following"]) {
|
|
1178
|
-
note.grace.stealTimeFollowing = parseFloat(graceAttrs["steal-time-following"]);
|
|
1179
|
-
}
|
|
1180
|
-
note.duration = 0;
|
|
1181
|
-
break;
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
const timeMod = getElementContent(elements, "time-modification");
|
|
1185
|
-
if (timeMod) {
|
|
1186
|
-
const actualNotes = getElementText(timeMod, "actual-notes");
|
|
1187
|
-
const normalNotes = getElementText(timeMod, "normal-notes");
|
|
1188
|
-
const normalType = getElementText(timeMod, "normal-type");
|
|
1189
|
-
note.timeModification = {
|
|
1190
|
-
actualNotes: parseInt(actualNotes || "3", 10),
|
|
1191
|
-
normalNotes: parseInt(normalNotes || "2", 10)
|
|
1192
|
-
};
|
|
1193
|
-
if (normalType && isValidNoteType(normalType)) {
|
|
1194
|
-
note.timeModification.normalType = normalType;
|
|
1195
|
-
}
|
|
1196
|
-
let dotCount2 = 0;
|
|
1197
|
-
for (const tm of timeMod) {
|
|
1198
|
-
if (typeof tm !== "string" && tm.tagName === "normal-dot") dotCount2++;
|
|
1199
|
-
}
|
|
1200
|
-
if (dotCount2 > 0) note.timeModification.normalDots = dotCount2;
|
|
1201
|
-
}
|
|
1240
|
+
if (beams) note.beam = beams;
|
|
1241
|
+
if (allNotations) note.notations = allNotations;
|
|
1242
|
+
if (lyrics) note.lyrics = lyrics;
|
|
1243
|
+
if (hasGrace) note.duration = 0;
|
|
1202
1244
|
return note;
|
|
1203
1245
|
}
|
|
1204
1246
|
function parsePitch(elements) {
|
|
@@ -1754,14 +1796,14 @@ function parseLyric(elements, attrs) {
|
|
|
1754
1796
|
}
|
|
1755
1797
|
function parseBackup(elements) {
|
|
1756
1798
|
return {
|
|
1757
|
-
_id:
|
|
1799
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
1758
1800
|
type: "backup",
|
|
1759
1801
|
duration: parseInt(getElementText(elements, "duration") || "0", 10)
|
|
1760
1802
|
};
|
|
1761
1803
|
}
|
|
1762
1804
|
function parseForward(elements) {
|
|
1763
1805
|
const forward = {
|
|
1764
|
-
_id:
|
|
1806
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
1765
1807
|
type: "forward",
|
|
1766
1808
|
duration: parseInt(getElementText(elements, "duration") || "0", 10)
|
|
1767
1809
|
};
|
|
@@ -1773,7 +1815,7 @@ function parseForward(elements) {
|
|
|
1773
1815
|
}
|
|
1774
1816
|
function parseDirection(elements, attrs) {
|
|
1775
1817
|
const direction = {
|
|
1776
|
-
_id:
|
|
1818
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
1777
1819
|
type: "direction",
|
|
1778
1820
|
directionTypes: []
|
|
1779
1821
|
};
|
|
@@ -2198,7 +2240,7 @@ function parseDirectionTypes(elements) {
|
|
|
2198
2240
|
}
|
|
2199
2241
|
function parseBarline(elements, attrs) {
|
|
2200
2242
|
const location = attrs["location"] || "right";
|
|
2201
|
-
const barline = { _id:
|
|
2243
|
+
const barline = { _id: _chunkTBGS7OISjs.generateId.call(void 0, ), location };
|
|
2202
2244
|
const barStyle = getElementText(elements, "bar-style");
|
|
2203
2245
|
if (barStyle && isValidBarStyle(barStyle)) {
|
|
2204
2246
|
barline.barStyle = barStyle;
|
|
@@ -2430,7 +2472,7 @@ function parseMeasureStyle(elements, attrs) {
|
|
|
2430
2472
|
}
|
|
2431
2473
|
function parseHarmony(elements, attrs) {
|
|
2432
2474
|
const harmony = {
|
|
2433
|
-
_id:
|
|
2475
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
2434
2476
|
type: "harmony",
|
|
2435
2477
|
root: { rootStep: "C" },
|
|
2436
2478
|
kind: "major"
|
|
@@ -2570,7 +2612,7 @@ function parseHarmony(elements, attrs) {
|
|
|
2570
2612
|
}
|
|
2571
2613
|
function parseFiguredBass(elements, attrs) {
|
|
2572
2614
|
const fb = {
|
|
2573
|
-
_id:
|
|
2615
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
2574
2616
|
type: "figured-bass",
|
|
2575
2617
|
figures: []
|
|
2576
2618
|
};
|
|
@@ -2619,7 +2661,7 @@ function parseFiguredBass(elements, attrs) {
|
|
|
2619
2661
|
}
|
|
2620
2662
|
function parseSound(elements, attrs) {
|
|
2621
2663
|
const sound = {
|
|
2622
|
-
_id:
|
|
2664
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
2623
2665
|
type: "sound"
|
|
2624
2666
|
};
|
|
2625
2667
|
if (attrs["tempo"]) sound.tempo = parseFloat(attrs["tempo"]);
|
|
@@ -3651,7 +3693,7 @@ function buildScore(header, voiceTokensList, voiceIds, headerFieldOrder, inlineV
|
|
|
3651
3693
|
const headerVoice = _optionalChain([header, 'access', _2 => _2.voices, 'optionalAccess', _3 => _3.find, 'call', _4 => _4((v) => v.id === voiceId)]) || header.voices && header.voices[voiceIndex];
|
|
3652
3694
|
const voiceName = headerVoice ? headerVoice.name || `Voice ${voiceIndex + 1}` : voiceTokensList.length > 1 ? `Voice ${voiceIndex + 1}` : "Music";
|
|
3653
3695
|
partListEntries.push({
|
|
3654
|
-
_id:
|
|
3696
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
3655
3697
|
type: "score-part",
|
|
3656
3698
|
id: partId,
|
|
3657
3699
|
name: voiceName
|
|
@@ -3659,7 +3701,7 @@ function buildScore(header, voiceTokensList, voiceIds, headerFieldOrder, inlineV
|
|
|
3659
3701
|
const voiceClef = headerVoice ? abcClefToMusicXml(headerVoice.clef) : void 0;
|
|
3660
3702
|
const buildResult = buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDuration, voiceClef);
|
|
3661
3703
|
parts.push({
|
|
3662
|
-
_id:
|
|
3704
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
3663
3705
|
id: partId,
|
|
3664
3706
|
measures: buildResult.measures
|
|
3665
3707
|
});
|
|
@@ -3712,7 +3754,7 @@ function buildScore(header, voiceTokensList, voiceIds, headerFieldOrder, inlineV
|
|
|
3712
3754
|
encoding.encoder = encoderValues;
|
|
3713
3755
|
}
|
|
3714
3756
|
return {
|
|
3715
|
-
_id:
|
|
3757
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
3716
3758
|
metadata: {
|
|
3717
3759
|
movementTitle: header.title,
|
|
3718
3760
|
creators: creators.length > 0 ? creators : void 0,
|
|
@@ -3738,7 +3780,7 @@ function parseTempoToDirection(tempoStr) {
|
|
|
3738
3780
|
if (found) beatUnit = found;
|
|
3739
3781
|
}
|
|
3740
3782
|
return {
|
|
3741
|
-
_id:
|
|
3783
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
3742
3784
|
type: "direction",
|
|
3743
3785
|
directionTypes: [{ kind: "metronome", beatUnit, perMinute }],
|
|
3744
3786
|
placement: "above",
|
|
@@ -3794,7 +3836,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
|
|
|
3794
3836
|
if (dynDir) currentEntries.push(dynDir);
|
|
3795
3837
|
} else if (item.kind === "decoration") {
|
|
3796
3838
|
const decoDir = {
|
|
3797
|
-
_id:
|
|
3839
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
3798
3840
|
type: "direction",
|
|
3799
3841
|
directionTypes: [{ kind: "words", text: item.value }]
|
|
3800
3842
|
};
|
|
@@ -3805,13 +3847,13 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
|
|
|
3805
3847
|
}
|
|
3806
3848
|
function finalizeMeasure(endBarType) {
|
|
3807
3849
|
const measure = {
|
|
3808
|
-
_id:
|
|
3850
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
3809
3851
|
number: String(measureNumber),
|
|
3810
3852
|
entries: currentEntries
|
|
3811
3853
|
};
|
|
3812
3854
|
if (isFirstMeasure) {
|
|
3813
3855
|
measure.attributes = {
|
|
3814
|
-
_id:
|
|
3856
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
3815
3857
|
divisions: DIVISIONS,
|
|
3816
3858
|
time: timeSignature,
|
|
3817
3859
|
key: keySignature,
|
|
@@ -3821,7 +3863,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
|
|
|
3821
3863
|
}
|
|
3822
3864
|
if (pendingKeyChange) {
|
|
3823
3865
|
if (!measure.attributes) {
|
|
3824
|
-
measure.attributes = { _id:
|
|
3866
|
+
measure.attributes = { _id: _chunkTBGS7OISjs.generateId.call(void 0, ) };
|
|
3825
3867
|
}
|
|
3826
3868
|
const kValue = pendingKeyChange.replace(/^K:\s*/, "");
|
|
3827
3869
|
measure.attributes.key = parseKeySignature2(kValue);
|
|
@@ -4024,7 +4066,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
|
|
|
4024
4066
|
const rightBl = _optionalChain([lastMeasure, 'access', _9 => _9.barlines, 'optionalAccess', _10 => _10.find, 'call', _11 => _11((b) => b.location === "right")]);
|
|
4025
4067
|
if (rightBl) {
|
|
4026
4068
|
const endingBarline2 = {
|
|
4027
|
-
_id:
|
|
4069
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
4028
4070
|
location: "left",
|
|
4029
4071
|
barStyle: rightBl.barStyle,
|
|
4030
4072
|
repeat: rightBl.repeat,
|
|
@@ -4036,7 +4078,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
|
|
|
4036
4078
|
}
|
|
4037
4079
|
}
|
|
4038
4080
|
const endingBarline = {
|
|
4039
|
-
_id:
|
|
4081
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
4040
4082
|
location: "left",
|
|
4041
4083
|
ending: {
|
|
4042
4084
|
number: token.value,
|
|
@@ -4139,7 +4181,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
|
|
|
4139
4181
|
case "overlay": {
|
|
4140
4182
|
if (currentPosition > 0) {
|
|
4141
4183
|
const backupEntry = {
|
|
4142
|
-
_id:
|
|
4184
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
4143
4185
|
type: "backup",
|
|
4144
4186
|
duration: currentPosition
|
|
4145
4187
|
};
|
|
@@ -4153,7 +4195,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
|
|
|
4153
4195
|
if (lMatch) {
|
|
4154
4196
|
currentUnitNote = { num: parseInt(lMatch[1], 10), den: parseInt(lMatch[2], 10) };
|
|
4155
4197
|
const inlineEntry = {
|
|
4156
|
-
_id:
|
|
4198
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
4157
4199
|
type: "direction",
|
|
4158
4200
|
directionTypes: [{ kind: "words", text: `[L:${lMatch[1]}/${lMatch[2]}]` }]
|
|
4159
4201
|
};
|
|
@@ -4172,7 +4214,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
|
|
|
4172
4214
|
if (currentEntries.length > 0) {
|
|
4173
4215
|
const breakText = token.value === "\\\n" ? "__abc_line_cont__" : "__abc_line_break__";
|
|
4174
4216
|
const lineBreakDir = {
|
|
4175
|
-
_id:
|
|
4217
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
4176
4218
|
type: "direction",
|
|
4177
4219
|
directionTypes: [{ kind: "words", text: breakText }]
|
|
4178
4220
|
};
|
|
@@ -4276,7 +4318,7 @@ function createNoteEntry(token, unitNote, _hasTieStop, isGrace, tupletState) {
|
|
|
4276
4318
|
}
|
|
4277
4319
|
const { noteType, dots } = durationToNoteType(isGrace ? lengthToDuration(num, den, unitNote) : duration);
|
|
4278
4320
|
const entry = {
|
|
4279
|
-
_id:
|
|
4321
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
4280
4322
|
type: "note",
|
|
4281
4323
|
pitch: token.pitch,
|
|
4282
4324
|
duration,
|
|
@@ -4330,7 +4372,7 @@ function createRestEntry(token, unitNote, tupletState, measureDuration) {
|
|
|
4330
4372
|
}
|
|
4331
4373
|
const { noteType, dots } = durationToNoteType(duration);
|
|
4332
4374
|
const entry = {
|
|
4333
|
-
_id:
|
|
4375
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
4334
4376
|
type: "note",
|
|
4335
4377
|
rest: isWholeMeasure ? { measure: true } : {},
|
|
4336
4378
|
duration,
|
|
@@ -4345,7 +4387,7 @@ function createRestEntry(token, unitNote, tupletState, measureDuration) {
|
|
|
4345
4387
|
}
|
|
4346
4388
|
function createBarline(barType, location, endingNumber) {
|
|
4347
4389
|
const barline = {
|
|
4348
|
-
_id:
|
|
4390
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
4349
4391
|
location
|
|
4350
4392
|
};
|
|
4351
4393
|
switch (barType) {
|
|
@@ -4436,7 +4478,7 @@ function createHarmonyEntry(chordStr) {
|
|
|
4436
4478
|
break;
|
|
4437
4479
|
}
|
|
4438
4480
|
const entry = {
|
|
4439
|
-
_id:
|
|
4481
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
4440
4482
|
type: "harmony",
|
|
4441
4483
|
root: { rootStep, rootAlter: rootAlter !== void 0 ? rootAlter : void 0 },
|
|
4442
4484
|
kind
|
|
@@ -4455,7 +4497,7 @@ function createHarmonyEntry(chordStr) {
|
|
|
4455
4497
|
function createDynamicsDirection(dynamic) {
|
|
4456
4498
|
if (!DYNAMICS_VALUES.has(dynamic)) return null;
|
|
4457
4499
|
return {
|
|
4458
|
-
_id:
|
|
4500
|
+
_id: _chunkTBGS7OISjs.generateId.call(void 0, ),
|
|
4459
4501
|
type: "direction",
|
|
4460
4502
|
directionTypes: [{
|
|
4461
4503
|
kind: "dynamics",
|
|
@@ -4484,13 +4526,13 @@ function serialize(score, options = {}) {
|
|
|
4484
4526
|
const version = options.version || score.version || "4.0";
|
|
4485
4527
|
const indent = _nullishCoalesce(options.indent, () => ( " "));
|
|
4486
4528
|
if (options.validate) {
|
|
4487
|
-
const result =
|
|
4529
|
+
const result = _chunkTBGS7OISjs.validate.call(void 0, score, options.validateOptions);
|
|
4488
4530
|
if (options.onValidation) {
|
|
4489
4531
|
options.onValidation(result);
|
|
4490
4532
|
}
|
|
4491
4533
|
if (!result.valid && options.throwOnValidationError) {
|
|
4492
4534
|
const errorMessages = result.errors.map((e) => `[${e.code}] ${e.message}`).join("\n");
|
|
4493
|
-
throw new (0,
|
|
4535
|
+
throw new (0, _chunkTBGS7OISjs.ValidationException)(result.errors, `Score validation failed:
|
|
4494
4536
|
${errorMessages}`);
|
|
4495
4537
|
}
|
|
4496
4538
|
}
|
|
@@ -4498,144 +4540,141 @@ ${errorMessages}`);
|
|
|
4498
4540
|
lines.push('<?xml version="1.0" encoding="UTF-8"?>');
|
|
4499
4541
|
lines.push(`<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML ${version} Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">`);
|
|
4500
4542
|
lines.push(`<score-partwise version="${version}">`);
|
|
4501
|
-
|
|
4543
|
+
serializeMetadata(score.metadata, indent, lines);
|
|
4502
4544
|
if (score.defaults) {
|
|
4503
|
-
|
|
4545
|
+
serializeDefaults(score.defaults, indent, lines);
|
|
4504
4546
|
}
|
|
4505
4547
|
if (score.credits) {
|
|
4506
4548
|
for (const credit of score.credits) {
|
|
4507
|
-
|
|
4549
|
+
serializeCredit(credit, indent, lines);
|
|
4508
4550
|
}
|
|
4509
4551
|
}
|
|
4510
|
-
|
|
4552
|
+
serializePartList(score.partList, indent, lines);
|
|
4511
4553
|
for (const part of score.parts) {
|
|
4512
|
-
|
|
4554
|
+
serializePart(part, indent, lines);
|
|
4513
4555
|
}
|
|
4514
4556
|
lines.push("</score-partwise>");
|
|
4515
4557
|
return lines.join("\n");
|
|
4516
4558
|
}
|
|
4517
|
-
function serializeMetadata(metadata, indent) {
|
|
4518
|
-
const lines = [];
|
|
4559
|
+
function serializeMetadata(metadata, indent, out) {
|
|
4519
4560
|
if (metadata.workTitle !== void 0 || metadata.workNumber !== void 0) {
|
|
4520
|
-
|
|
4561
|
+
out.push(`${indent}<work>`);
|
|
4521
4562
|
if (metadata.workNumber !== void 0) {
|
|
4522
|
-
|
|
4563
|
+
out.push(`${indent}${indent}<work-number>${escapeXml(metadata.workNumber)}</work-number>`);
|
|
4523
4564
|
}
|
|
4524
4565
|
if (metadata.workTitle !== void 0) {
|
|
4525
|
-
|
|
4566
|
+
out.push(`${indent}${indent}<work-title>${escapeXml(metadata.workTitle)}</work-title>`);
|
|
4526
4567
|
}
|
|
4527
|
-
|
|
4568
|
+
out.push(`${indent}</work>`);
|
|
4528
4569
|
}
|
|
4529
4570
|
if (metadata.movementNumber !== void 0) {
|
|
4530
|
-
|
|
4571
|
+
out.push(`${indent}<movement-number>${escapeXml(metadata.movementNumber)}</movement-number>`);
|
|
4531
4572
|
}
|
|
4532
4573
|
if (metadata.movementTitle !== void 0) {
|
|
4533
|
-
|
|
4574
|
+
out.push(`${indent}<movement-title>${escapeXml(metadata.movementTitle)}</movement-title>`);
|
|
4534
4575
|
}
|
|
4535
4576
|
if (metadata.creators || metadata.rights || metadata.encoding || metadata.source || metadata.miscellaneous) {
|
|
4536
|
-
|
|
4577
|
+
out.push(`${indent}<identification>`);
|
|
4537
4578
|
if (metadata.creators) {
|
|
4538
4579
|
for (const creator of metadata.creators) {
|
|
4539
4580
|
const typeAttr = creator.type ? ` type="${escapeXml(creator.type)}"` : "";
|
|
4540
|
-
|
|
4581
|
+
out.push(`${indent}${indent}<creator${typeAttr}>${escapeXml(creator.value)}</creator>`);
|
|
4541
4582
|
}
|
|
4542
4583
|
}
|
|
4543
4584
|
if (metadata.rights) {
|
|
4544
4585
|
for (const right of metadata.rights) {
|
|
4545
|
-
|
|
4586
|
+
out.push(`${indent}${indent}<rights>${escapeXml(right)}</rights>`);
|
|
4546
4587
|
}
|
|
4547
4588
|
}
|
|
4548
4589
|
if (metadata.encoding) {
|
|
4549
|
-
|
|
4590
|
+
out.push(`${indent}${indent}<encoding>`);
|
|
4550
4591
|
if (metadata.encoding.software) {
|
|
4551
4592
|
for (const sw of metadata.encoding.software) {
|
|
4552
|
-
|
|
4593
|
+
out.push(`${indent}${indent}${indent}<software>${escapeXml(sw)}</software>`);
|
|
4553
4594
|
}
|
|
4554
4595
|
}
|
|
4555
4596
|
if (metadata.encoding.encodingDate) {
|
|
4556
|
-
|
|
4597
|
+
out.push(`${indent}${indent}${indent}<encoding-date>${escapeXml(metadata.encoding.encodingDate)}</encoding-date>`);
|
|
4557
4598
|
}
|
|
4558
4599
|
if (metadata.encoding.encoder) {
|
|
4559
4600
|
for (const enc of metadata.encoding.encoder) {
|
|
4560
|
-
|
|
4601
|
+
out.push(`${indent}${indent}${indent}<encoder>${escapeXml(enc)}</encoder>`);
|
|
4561
4602
|
}
|
|
4562
4603
|
}
|
|
4563
4604
|
if (metadata.encoding.encodingDescription) {
|
|
4564
|
-
|
|
4605
|
+
out.push(`${indent}${indent}${indent}<encoding-description>${escapeXml(metadata.encoding.encodingDescription)}</encoding-description>`);
|
|
4565
4606
|
}
|
|
4566
4607
|
if (metadata.encoding.supports) {
|
|
4567
4608
|
for (const support of metadata.encoding.supports) {
|
|
4568
4609
|
let attrs = ` element="${escapeXml(support.element)}" type="${support.type}"`;
|
|
4569
4610
|
if (support.attribute) attrs += ` attribute="${escapeXml(support.attribute)}"`;
|
|
4570
4611
|
if (support.value) attrs += ` value="${escapeXml(support.value)}"`;
|
|
4571
|
-
|
|
4612
|
+
out.push(`${indent}${indent}${indent}<supports${attrs}/>`);
|
|
4572
4613
|
}
|
|
4573
4614
|
}
|
|
4574
|
-
|
|
4615
|
+
out.push(`${indent}${indent}</encoding>`);
|
|
4575
4616
|
}
|
|
4576
4617
|
if (metadata.source) {
|
|
4577
|
-
|
|
4618
|
+
out.push(`${indent}${indent}<source>${escapeXml(metadata.source)}</source>`);
|
|
4578
4619
|
}
|
|
4579
4620
|
if (metadata.miscellaneous) {
|
|
4580
|
-
|
|
4621
|
+
out.push(`${indent}${indent}<miscellaneous>`);
|
|
4581
4622
|
for (const field of metadata.miscellaneous) {
|
|
4582
|
-
|
|
4623
|
+
out.push(`${indent}${indent}${indent}<miscellaneous-field name="${escapeXml(field.name)}">${escapeXml(field.value)}</miscellaneous-field>`);
|
|
4583
4624
|
}
|
|
4584
|
-
|
|
4625
|
+
out.push(`${indent}${indent}</miscellaneous>`);
|
|
4585
4626
|
}
|
|
4586
|
-
|
|
4627
|
+
out.push(`${indent}</identification>`);
|
|
4587
4628
|
}
|
|
4588
|
-
return lines;
|
|
4589
4629
|
}
|
|
4590
|
-
function serializeDefaults(defaults, indent) {
|
|
4591
|
-
|
|
4592
|
-
lines.push(`${indent}<defaults>`);
|
|
4630
|
+
function serializeDefaults(defaults, indent, out) {
|
|
4631
|
+
out.push(`${indent}<defaults>`);
|
|
4593
4632
|
if (defaults.scaling) {
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4633
|
+
out.push(`${indent}${indent}<scaling>`);
|
|
4634
|
+
out.push(`${indent}${indent}${indent}<millimeters>${defaults.scaling.millimeters}</millimeters>`);
|
|
4635
|
+
out.push(`${indent}${indent}${indent}<tenths>${defaults.scaling.tenths}</tenths>`);
|
|
4636
|
+
out.push(`${indent}${indent}</scaling>`);
|
|
4598
4637
|
}
|
|
4599
4638
|
if (defaults.pageLayout) {
|
|
4600
|
-
|
|
4639
|
+
serializePageLayout(defaults.pageLayout, indent + indent, out);
|
|
4601
4640
|
}
|
|
4602
4641
|
if (defaults.systemLayout) {
|
|
4603
|
-
|
|
4642
|
+
serializeSystemLayout(defaults.systemLayout, indent + indent, out);
|
|
4604
4643
|
}
|
|
4605
4644
|
if (defaults.staffLayout) {
|
|
4606
4645
|
for (const sl of defaults.staffLayout) {
|
|
4607
4646
|
const numAttr = sl.number !== void 0 ? ` number="${sl.number}"` : "";
|
|
4608
|
-
|
|
4647
|
+
out.push(`${indent}${indent}<staff-layout${numAttr}>`);
|
|
4609
4648
|
if (sl.staffDistance !== void 0) {
|
|
4610
|
-
|
|
4649
|
+
out.push(`${indent}${indent}${indent}<staff-distance>${sl.staffDistance}</staff-distance>`);
|
|
4611
4650
|
}
|
|
4612
|
-
|
|
4651
|
+
out.push(`${indent}${indent}</staff-layout>`);
|
|
4613
4652
|
}
|
|
4614
4653
|
}
|
|
4615
4654
|
if (defaults.appearance) {
|
|
4616
|
-
|
|
4655
|
+
out.push(`${indent}${indent}<appearance>`);
|
|
4617
4656
|
const app = defaults.appearance;
|
|
4618
4657
|
if (app["line-widths"]) {
|
|
4619
4658
|
for (const lw of app["line-widths"]) {
|
|
4620
|
-
|
|
4659
|
+
out.push(`${indent}${indent}${indent}<line-width type="${escapeXml(lw.type)}">${lw.value}</line-width>`);
|
|
4621
4660
|
}
|
|
4622
4661
|
}
|
|
4623
4662
|
if (app["note-sizes"]) {
|
|
4624
4663
|
for (const ns of app["note-sizes"]) {
|
|
4625
|
-
|
|
4664
|
+
out.push(`${indent}${indent}${indent}<note-size type="${escapeXml(ns.type)}">${ns.value}</note-size>`);
|
|
4626
4665
|
}
|
|
4627
4666
|
}
|
|
4628
4667
|
if (app["distances"]) {
|
|
4629
4668
|
for (const d of app["distances"]) {
|
|
4630
|
-
|
|
4669
|
+
out.push(`${indent}${indent}${indent}<distance type="${escapeXml(d.type)}">${d.value}</distance>`);
|
|
4631
4670
|
}
|
|
4632
4671
|
}
|
|
4633
4672
|
if (app["glyphs"]) {
|
|
4634
4673
|
for (const g of app["glyphs"]) {
|
|
4635
|
-
|
|
4674
|
+
out.push(`${indent}${indent}${indent}<glyph type="${escapeXml(g.type)}">${escapeXml(g.value)}</glyph>`);
|
|
4636
4675
|
}
|
|
4637
4676
|
}
|
|
4638
|
-
|
|
4677
|
+
out.push(`${indent}${indent}</appearance>`);
|
|
4639
4678
|
}
|
|
4640
4679
|
if (defaults.musicFont) {
|
|
4641
4680
|
let attrs = "";
|
|
@@ -4643,7 +4682,7 @@ function serializeDefaults(defaults, indent) {
|
|
|
4643
4682
|
if (defaults.musicFont.fontSize) attrs += ` font-size="${escapeXml(defaults.musicFont.fontSize)}"`;
|
|
4644
4683
|
if (defaults.musicFont.fontStyle) attrs += ` font-style="${escapeXml(defaults.musicFont.fontStyle)}"`;
|
|
4645
4684
|
if (defaults.musicFont.fontWeight) attrs += ` font-weight="${escapeXml(defaults.musicFont.fontWeight)}"`;
|
|
4646
|
-
|
|
4685
|
+
out.push(`${indent}${indent}<music-font${attrs}/>`);
|
|
4647
4686
|
}
|
|
4648
4687
|
if (defaults.wordFont) {
|
|
4649
4688
|
let attrs = "";
|
|
@@ -4651,7 +4690,7 @@ function serializeDefaults(defaults, indent) {
|
|
|
4651
4690
|
if (defaults.wordFont.fontSize) attrs += ` font-size="${escapeXml(defaults.wordFont.fontSize)}"`;
|
|
4652
4691
|
if (defaults.wordFont.fontStyle) attrs += ` font-style="${escapeXml(defaults.wordFont.fontStyle)}"`;
|
|
4653
4692
|
if (defaults.wordFont.fontWeight) attrs += ` font-weight="${escapeXml(defaults.wordFont.fontWeight)}"`;
|
|
4654
|
-
|
|
4693
|
+
out.push(`${indent}${indent}<word-font${attrs}/>`);
|
|
4655
4694
|
}
|
|
4656
4695
|
if (defaults.lyricFont) {
|
|
4657
4696
|
for (const lf of defaults.lyricFont) {
|
|
@@ -4662,7 +4701,7 @@ function serializeDefaults(defaults, indent) {
|
|
|
4662
4701
|
if (lf.fontSize) attrs += ` font-size="${escapeXml(lf.fontSize)}"`;
|
|
4663
4702
|
if (lf.fontStyle) attrs += ` font-style="${escapeXml(lf.fontStyle)}"`;
|
|
4664
4703
|
if (lf.fontWeight) attrs += ` font-weight="${escapeXml(lf.fontWeight)}"`;
|
|
4665
|
-
|
|
4704
|
+
out.push(`${indent}${indent}<lyric-font${attrs}/>`);
|
|
4666
4705
|
}
|
|
4667
4706
|
}
|
|
4668
4707
|
if (defaults.lyricLanguage) {
|
|
@@ -4671,64 +4710,60 @@ function serializeDefaults(defaults, indent) {
|
|
|
4671
4710
|
if (ll.number !== void 0) attrs += ` number="${ll.number}"`;
|
|
4672
4711
|
if (ll.name) attrs += ` name="${escapeXml(ll.name)}"`;
|
|
4673
4712
|
attrs += ` xml:lang="${escapeXml(ll.xmlLang)}"`;
|
|
4674
|
-
|
|
4713
|
+
out.push(`${indent}${indent}<lyric-language${attrs}/>`);
|
|
4675
4714
|
}
|
|
4676
4715
|
}
|
|
4677
|
-
|
|
4678
|
-
return lines;
|
|
4716
|
+
out.push(`${indent}</defaults>`);
|
|
4679
4717
|
}
|
|
4680
|
-
function serializePageLayout(layout, indent) {
|
|
4681
|
-
|
|
4682
|
-
lines.push(`${indent}<page-layout>`);
|
|
4718
|
+
function serializePageLayout(layout, indent, out) {
|
|
4719
|
+
out.push(`${indent}<page-layout>`);
|
|
4683
4720
|
if (layout.pageHeight !== void 0) {
|
|
4684
|
-
|
|
4721
|
+
out.push(`${indent} <page-height>${layout.pageHeight}</page-height>`);
|
|
4685
4722
|
}
|
|
4686
4723
|
if (layout.pageWidth !== void 0) {
|
|
4687
|
-
|
|
4724
|
+
out.push(`${indent} <page-width>${layout.pageWidth}</page-width>`);
|
|
4688
4725
|
}
|
|
4689
4726
|
if (layout.pageMargins) {
|
|
4690
4727
|
for (const m of layout.pageMargins) {
|
|
4691
4728
|
const typeAttr = m.type ? ` type="${m.type}"` : "";
|
|
4692
|
-
|
|
4729
|
+
out.push(`${indent} <page-margins${typeAttr}>`);
|
|
4693
4730
|
if (m.leftMargin !== void 0) {
|
|
4694
|
-
|
|
4731
|
+
out.push(`${indent} <left-margin>${_nullishCoalesce(m.leftMarginRaw, () => ( m.leftMargin))}</left-margin>`);
|
|
4695
4732
|
}
|
|
4696
4733
|
if (m.rightMargin !== void 0) {
|
|
4697
|
-
|
|
4734
|
+
out.push(`${indent} <right-margin>${_nullishCoalesce(m.rightMarginRaw, () => ( m.rightMargin))}</right-margin>`);
|
|
4698
4735
|
}
|
|
4699
4736
|
if (m.topMargin !== void 0) {
|
|
4700
|
-
|
|
4737
|
+
out.push(`${indent} <top-margin>${_nullishCoalesce(m.topMarginRaw, () => ( m.topMargin))}</top-margin>`);
|
|
4701
4738
|
}
|
|
4702
4739
|
if (m.bottomMargin !== void 0) {
|
|
4703
|
-
|
|
4740
|
+
out.push(`${indent} <bottom-margin>${_nullishCoalesce(m.bottomMarginRaw, () => ( m.bottomMargin))}</bottom-margin>`);
|
|
4704
4741
|
}
|
|
4705
|
-
|
|
4742
|
+
out.push(`${indent} </page-margins>`);
|
|
4706
4743
|
}
|
|
4707
4744
|
}
|
|
4708
|
-
|
|
4709
|
-
return lines;
|
|
4745
|
+
out.push(`${indent}</page-layout>`);
|
|
4710
4746
|
}
|
|
4711
|
-
function serializeSystemLayout(layout, indent) {
|
|
4712
|
-
|
|
4713
|
-
lines.push(`${indent}<system-layout>`);
|
|
4747
|
+
function serializeSystemLayout(layout, indent, out) {
|
|
4748
|
+
out.push(`${indent}<system-layout>`);
|
|
4714
4749
|
if (layout.systemMargins) {
|
|
4715
|
-
|
|
4750
|
+
out.push(`${indent} <system-margins>`);
|
|
4716
4751
|
if (layout.systemMargins.leftMargin !== void 0) {
|
|
4717
|
-
|
|
4752
|
+
out.push(`${indent} <left-margin>${_nullishCoalesce(layout.systemMargins.leftMarginRaw, () => ( layout.systemMargins.leftMargin))}</left-margin>`);
|
|
4718
4753
|
}
|
|
4719
4754
|
if (layout.systemMargins.rightMargin !== void 0) {
|
|
4720
|
-
|
|
4755
|
+
out.push(`${indent} <right-margin>${_nullishCoalesce(layout.systemMargins.rightMarginRaw, () => ( layout.systemMargins.rightMargin))}</right-margin>`);
|
|
4721
4756
|
}
|
|
4722
|
-
|
|
4757
|
+
out.push(`${indent} </system-margins>`);
|
|
4723
4758
|
}
|
|
4724
4759
|
if (layout.systemDistance !== void 0) {
|
|
4725
|
-
|
|
4760
|
+
out.push(`${indent} <system-distance>${_nullishCoalesce(layout.systemDistanceRaw, () => ( layout.systemDistance))}</system-distance>`);
|
|
4726
4761
|
}
|
|
4727
4762
|
if (layout.topSystemDistance !== void 0) {
|
|
4728
|
-
|
|
4763
|
+
out.push(`${indent} <top-system-distance>${_nullishCoalesce(layout.topSystemDistanceRaw, () => ( layout.topSystemDistance))}</top-system-distance>`);
|
|
4729
4764
|
}
|
|
4730
4765
|
if (layout.systemDividers) {
|
|
4731
|
-
|
|
4766
|
+
out.push(`${indent} <system-dividers>`);
|
|
4732
4767
|
if (layout.systemDividers.leftDivider) {
|
|
4733
4768
|
let attrs = "";
|
|
4734
4769
|
if (layout.systemDividers.leftDivider.printObject !== void 0) {
|
|
@@ -4740,7 +4775,7 @@ function serializeSystemLayout(layout, indent) {
|
|
|
4740
4775
|
if (layout.systemDividers.leftDivider.valign) {
|
|
4741
4776
|
attrs += ` valign="${layout.systemDividers.leftDivider.valign}"`;
|
|
4742
4777
|
}
|
|
4743
|
-
|
|
4778
|
+
out.push(`${indent} <left-divider${attrs}/>`);
|
|
4744
4779
|
}
|
|
4745
4780
|
if (layout.systemDividers.rightDivider) {
|
|
4746
4781
|
let attrs = "";
|
|
@@ -4753,22 +4788,20 @@ function serializeSystemLayout(layout, indent) {
|
|
|
4753
4788
|
if (layout.systemDividers.rightDivider.valign) {
|
|
4754
4789
|
attrs += ` valign="${layout.systemDividers.rightDivider.valign}"`;
|
|
4755
4790
|
}
|
|
4756
|
-
|
|
4791
|
+
out.push(`${indent} <right-divider${attrs}/>`);
|
|
4757
4792
|
}
|
|
4758
|
-
|
|
4793
|
+
out.push(`${indent} </system-dividers>`);
|
|
4759
4794
|
}
|
|
4760
|
-
|
|
4761
|
-
return lines;
|
|
4795
|
+
out.push(`${indent}</system-layout>`);
|
|
4762
4796
|
}
|
|
4763
|
-
function serializeCredit(credit, indent) {
|
|
4764
|
-
const lines = [];
|
|
4797
|
+
function serializeCredit(credit, indent, out) {
|
|
4765
4798
|
let attrs = "";
|
|
4766
4799
|
if (credit._id) attrs += ` id="${escapeXml(credit._id)}"`;
|
|
4767
4800
|
if (credit.page !== void 0) attrs += ` page="${credit.page}"`;
|
|
4768
|
-
|
|
4801
|
+
out.push(`${indent}<credit${attrs}>`);
|
|
4769
4802
|
if (credit.creditType) {
|
|
4770
4803
|
for (const ct of credit.creditType) {
|
|
4771
|
-
|
|
4804
|
+
out.push(`${indent}${indent}<credit-type>${escapeXml(ct)}</credit-type>`);
|
|
4772
4805
|
}
|
|
4773
4806
|
}
|
|
4774
4807
|
if (credit.creditWords) {
|
|
@@ -4786,27 +4819,23 @@ function serializeCredit(credit, indent) {
|
|
|
4786
4819
|
if (cw.letterSpacing) attrs2 += ` letter-spacing="${escapeXml(cw.letterSpacing)}"`;
|
|
4787
4820
|
if (cw.xmlLang) attrs2 += ` xml:lang="${escapeXml(cw.xmlLang)}"`;
|
|
4788
4821
|
if (cw.xmlSpace) attrs2 += ` xml:space="${escapeXml(cw.xmlSpace)}"`;
|
|
4789
|
-
|
|
4822
|
+
out.push(`${indent}${indent}<credit-words${attrs2}>${escapeXml(cw.text)}</credit-words>`);
|
|
4790
4823
|
}
|
|
4791
4824
|
}
|
|
4792
|
-
|
|
4793
|
-
return lines;
|
|
4825
|
+
out.push(`${indent}</credit>`);
|
|
4794
4826
|
}
|
|
4795
|
-
function serializePartList(partList, indent) {
|
|
4796
|
-
|
|
4797
|
-
lines.push(`${indent}<part-list>`);
|
|
4827
|
+
function serializePartList(partList, indent, out) {
|
|
4828
|
+
out.push(`${indent}<part-list>`);
|
|
4798
4829
|
for (const entry of partList) {
|
|
4799
4830
|
if (entry.type === "score-part") {
|
|
4800
|
-
|
|
4831
|
+
serializeScorePart(entry, indent + indent, out);
|
|
4801
4832
|
} else if (entry.type === "part-group") {
|
|
4802
|
-
|
|
4833
|
+
serializePartGroup(entry, indent + indent, out);
|
|
4803
4834
|
}
|
|
4804
4835
|
}
|
|
4805
|
-
|
|
4806
|
-
return lines;
|
|
4836
|
+
out.push(`${indent}</part-list>`);
|
|
4807
4837
|
}
|
|
4808
|
-
function serializeDisplayTexts(texts, indent) {
|
|
4809
|
-
const lines = [];
|
|
4838
|
+
function serializeDisplayTexts(texts, indent, out) {
|
|
4810
4839
|
for (const dt of texts) {
|
|
4811
4840
|
let attrs = "";
|
|
4812
4841
|
if (dt.fontFamily) attrs += ` font-family="${escapeXml(dt.fontFamily)}"`;
|
|
@@ -4814,383 +4843,370 @@ function serializeDisplayTexts(texts, indent) {
|
|
|
4814
4843
|
if (dt.fontStyle) attrs += ` font-style="${escapeXml(dt.fontStyle)}"`;
|
|
4815
4844
|
if (dt.fontWeight) attrs += ` font-weight="${escapeXml(dt.fontWeight)}"`;
|
|
4816
4845
|
if (dt.xmlSpace) attrs += ` xml:space="${escapeXml(dt.xmlSpace)}"`;
|
|
4817
|
-
|
|
4846
|
+
out.push(`${indent}<display-text${attrs}>${escapeXml(dt.text)}</display-text>`);
|
|
4818
4847
|
}
|
|
4819
|
-
return lines;
|
|
4820
4848
|
}
|
|
4821
|
-
function serializeScorePart(part, indent) {
|
|
4822
|
-
|
|
4823
|
-
lines.push(`${indent}<score-part id="${escapeXml(part.id)}">`);
|
|
4849
|
+
function serializeScorePart(part, indent, out) {
|
|
4850
|
+
out.push(`${indent}<score-part id="${escapeXml(part.id)}">`);
|
|
4824
4851
|
if (part.name !== void 0) {
|
|
4825
4852
|
let pnAttrs = "";
|
|
4826
4853
|
if (part.namePrintObject === false) pnAttrs += ' print-object="no"';
|
|
4827
|
-
|
|
4854
|
+
out.push(`${indent} <part-name${pnAttrs}>${escapeXml(part.name)}</part-name>`);
|
|
4828
4855
|
}
|
|
4829
4856
|
if (part.partNameDisplay && part.partNameDisplay.length > 0) {
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4857
|
+
out.push(`${indent} <part-name-display>`);
|
|
4858
|
+
serializeDisplayTexts(part.partNameDisplay, indent + " ", out);
|
|
4859
|
+
out.push(`${indent} </part-name-display>`);
|
|
4833
4860
|
}
|
|
4834
4861
|
if (part.abbreviation !== void 0) {
|
|
4835
4862
|
let paAttrs = "";
|
|
4836
4863
|
if (part.abbreviationPrintObject === false) paAttrs += ' print-object="no"';
|
|
4837
|
-
|
|
4864
|
+
out.push(`${indent} <part-abbreviation${paAttrs}>${escapeXml(part.abbreviation)}</part-abbreviation>`);
|
|
4838
4865
|
}
|
|
4839
4866
|
if (part.partAbbreviationDisplay && part.partAbbreviationDisplay.length > 0) {
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4867
|
+
out.push(`${indent} <part-abbreviation-display>`);
|
|
4868
|
+
serializeDisplayTexts(part.partAbbreviationDisplay, indent + " ", out);
|
|
4869
|
+
out.push(`${indent} </part-abbreviation-display>`);
|
|
4843
4870
|
}
|
|
4844
4871
|
if (part.scoreInstruments) {
|
|
4845
4872
|
for (const inst of part.scoreInstruments) {
|
|
4846
|
-
|
|
4847
|
-
|
|
4873
|
+
out.push(`${indent} <score-instrument id="${escapeXml(inst.id)}">`);
|
|
4874
|
+
out.push(`${indent} <instrument-name>${escapeXml(inst.name)}</instrument-name>`);
|
|
4848
4875
|
if (inst.abbreviation) {
|
|
4849
|
-
|
|
4876
|
+
out.push(`${indent} <instrument-abbreviation>${escapeXml(inst.abbreviation)}</instrument-abbreviation>`);
|
|
4850
4877
|
}
|
|
4851
4878
|
if (inst.sound) {
|
|
4852
|
-
|
|
4879
|
+
out.push(`${indent} <instrument-sound>${escapeXml(inst.sound)}</instrument-sound>`);
|
|
4853
4880
|
}
|
|
4854
4881
|
if (inst.solo) {
|
|
4855
|
-
|
|
4882
|
+
out.push(`${indent} <solo/>`);
|
|
4856
4883
|
}
|
|
4857
4884
|
if (inst.ensemble !== void 0) {
|
|
4858
4885
|
if (inst.ensemble === 0) {
|
|
4859
|
-
|
|
4886
|
+
out.push(`${indent} <ensemble/>`);
|
|
4860
4887
|
} else {
|
|
4861
|
-
|
|
4888
|
+
out.push(`${indent} <ensemble>${inst.ensemble}</ensemble>`);
|
|
4862
4889
|
}
|
|
4863
4890
|
}
|
|
4864
|
-
|
|
4891
|
+
out.push(`${indent} </score-instrument>`);
|
|
4865
4892
|
}
|
|
4866
4893
|
}
|
|
4867
4894
|
if (part.groups) {
|
|
4868
4895
|
for (const group of part.groups) {
|
|
4869
|
-
|
|
4896
|
+
out.push(`${indent} <group>${escapeXml(group)}</group>`);
|
|
4870
4897
|
}
|
|
4871
4898
|
}
|
|
4872
4899
|
if (part.midiInstruments) {
|
|
4873
4900
|
for (const midi of part.midiInstruments) {
|
|
4874
|
-
|
|
4901
|
+
out.push(`${indent} <midi-instrument id="${escapeXml(midi.id)}">`);
|
|
4875
4902
|
if (midi.channel !== void 0) {
|
|
4876
|
-
|
|
4903
|
+
out.push(`${indent} <midi-channel>${midi.channel}</midi-channel>`);
|
|
4877
4904
|
}
|
|
4878
4905
|
if (midi.name) {
|
|
4879
|
-
|
|
4906
|
+
out.push(`${indent} <midi-name>${escapeXml(midi.name)}</midi-name>`);
|
|
4880
4907
|
}
|
|
4881
4908
|
if (midi.bank !== void 0) {
|
|
4882
|
-
|
|
4909
|
+
out.push(`${indent} <midi-bank>${midi.bank}</midi-bank>`);
|
|
4883
4910
|
}
|
|
4884
4911
|
if (midi.program !== void 0) {
|
|
4885
|
-
|
|
4912
|
+
out.push(`${indent} <midi-program>${midi.program}</midi-program>`);
|
|
4886
4913
|
}
|
|
4887
4914
|
if (midi.unpitched !== void 0) {
|
|
4888
|
-
|
|
4915
|
+
out.push(`${indent} <midi-unpitched>${midi.unpitched}</midi-unpitched>`);
|
|
4889
4916
|
}
|
|
4890
4917
|
if (midi.volume !== void 0) {
|
|
4891
|
-
|
|
4918
|
+
out.push(`${indent} <volume>${midi.volume}</volume>`);
|
|
4892
4919
|
}
|
|
4893
4920
|
if (midi.pan !== void 0) {
|
|
4894
|
-
|
|
4921
|
+
out.push(`${indent} <pan>${midi.pan}</pan>`);
|
|
4895
4922
|
}
|
|
4896
4923
|
if (midi.elevation !== void 0) {
|
|
4897
|
-
|
|
4924
|
+
out.push(`${indent} <elevation>${midi.elevation}</elevation>`);
|
|
4898
4925
|
}
|
|
4899
|
-
|
|
4926
|
+
out.push(`${indent} </midi-instrument>`);
|
|
4900
4927
|
}
|
|
4901
4928
|
}
|
|
4902
|
-
|
|
4903
|
-
return lines;
|
|
4929
|
+
out.push(`${indent}</score-part>`);
|
|
4904
4930
|
}
|
|
4905
|
-
function serializePartGroup(group, indent) {
|
|
4906
|
-
const lines = [];
|
|
4931
|
+
function serializePartGroup(group, indent, out) {
|
|
4907
4932
|
let attrs = ` type="${group.groupType}"`;
|
|
4908
4933
|
if (group.number !== void 0) attrs += ` number="${group.number}"`;
|
|
4909
4934
|
if (group._id) attrs += ` id="${escapeXml(group._id)}"`;
|
|
4910
|
-
|
|
4935
|
+
out.push(`${indent}<part-group${attrs}>`);
|
|
4911
4936
|
if (group.groupName) {
|
|
4912
|
-
|
|
4937
|
+
out.push(`${indent} <group-name>${escapeXml(group.groupName)}</group-name>`);
|
|
4913
4938
|
}
|
|
4914
4939
|
if (group.groupNameDisplay && group.groupNameDisplay.length > 0) {
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4940
|
+
out.push(`${indent} <group-name-display>`);
|
|
4941
|
+
serializeDisplayTexts(group.groupNameDisplay, indent + " ", out);
|
|
4942
|
+
out.push(`${indent} </group-name-display>`);
|
|
4918
4943
|
}
|
|
4919
4944
|
if (group.groupAbbreviation) {
|
|
4920
|
-
|
|
4945
|
+
out.push(`${indent} <group-abbreviation>${escapeXml(group.groupAbbreviation)}</group-abbreviation>`);
|
|
4921
4946
|
}
|
|
4922
4947
|
if (group.groupAbbreviationDisplay && group.groupAbbreviationDisplay.length > 0) {
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4948
|
+
out.push(`${indent} <group-abbreviation-display>`);
|
|
4949
|
+
serializeDisplayTexts(group.groupAbbreviationDisplay, indent + " ", out);
|
|
4950
|
+
out.push(`${indent} </group-abbreviation-display>`);
|
|
4926
4951
|
}
|
|
4927
4952
|
if (group.groupSymbol) {
|
|
4928
4953
|
const defaultXAttr = group.groupSymbolDefaultX !== void 0 ? ` default-x="${group.groupSymbolDefaultX}"` : "";
|
|
4929
|
-
|
|
4954
|
+
out.push(`${indent} <group-symbol${defaultXAttr}>${group.groupSymbol}</group-symbol>`);
|
|
4930
4955
|
}
|
|
4931
4956
|
if (group.groupBarline) {
|
|
4932
|
-
|
|
4957
|
+
out.push(`${indent} <group-barline>${group.groupBarline}</group-barline>`);
|
|
4933
4958
|
}
|
|
4934
|
-
|
|
4935
|
-
return lines;
|
|
4959
|
+
out.push(`${indent}</part-group>`);
|
|
4936
4960
|
}
|
|
4937
|
-
function serializePart(part, indent) {
|
|
4938
|
-
const lines = [];
|
|
4961
|
+
function serializePart(part, indent, out) {
|
|
4939
4962
|
const idAttr = part.id ? ` id="${escapeXml(part.id)}"` : "";
|
|
4940
|
-
|
|
4963
|
+
out.push(`${indent}<part${idAttr}>`);
|
|
4941
4964
|
for (const measure of part.measures) {
|
|
4942
|
-
|
|
4965
|
+
serializeMeasure(measure, indent + indent, out);
|
|
4943
4966
|
}
|
|
4944
|
-
|
|
4945
|
-
return lines;
|
|
4967
|
+
out.push(`${indent}</part>`);
|
|
4946
4968
|
}
|
|
4947
|
-
function serializeMeasure(measure, indent) {
|
|
4948
|
-
const lines = [];
|
|
4969
|
+
function serializeMeasure(measure, indent, out) {
|
|
4949
4970
|
let attrs = ` number="${measure.number}"`;
|
|
4950
4971
|
if (measure._id) attrs += ` id="${escapeXml(measure._id)}"`;
|
|
4951
4972
|
if (measure.width !== void 0) attrs += ` width="${measure.width}"`;
|
|
4952
4973
|
if (measure.implicit) attrs += ` implicit="yes"`;
|
|
4953
|
-
|
|
4974
|
+
out.push(`${indent}<measure${attrs}>`);
|
|
4954
4975
|
if (measure.print) {
|
|
4955
|
-
|
|
4976
|
+
serializePrint(measure.print, indent + " ", out);
|
|
4956
4977
|
}
|
|
4957
4978
|
if (measure.attributes) {
|
|
4958
|
-
|
|
4979
|
+
serializeAttributes(measure.attributes, indent + " ", out);
|
|
4959
4980
|
}
|
|
4960
4981
|
for (const entry of measure.entries) {
|
|
4961
|
-
|
|
4982
|
+
serializeEntry(entry, indent + " ", out);
|
|
4962
4983
|
}
|
|
4963
4984
|
if (measure.barlines) {
|
|
4964
4985
|
for (const barline of measure.barlines) {
|
|
4965
|
-
|
|
4986
|
+
serializeBarline(barline, indent + " ", out);
|
|
4966
4987
|
}
|
|
4967
4988
|
}
|
|
4968
|
-
|
|
4969
|
-
return lines;
|
|
4989
|
+
out.push(`${indent}</measure>`);
|
|
4970
4990
|
}
|
|
4971
|
-
function serializePrint(print, indent) {
|
|
4972
|
-
const lines = [];
|
|
4991
|
+
function serializePrint(print, indent, out) {
|
|
4973
4992
|
let attrs = "";
|
|
4974
4993
|
if (print.newSystem) attrs += ' new-system="yes"';
|
|
4975
4994
|
if (print.newPage) attrs += ' new-page="yes"';
|
|
4976
4995
|
if (print.blankPage !== void 0) attrs += ` blank-page="${print.blankPage}"`;
|
|
4977
4996
|
if (print.pageNumber) attrs += ` page-number="${escapeXml(print.pageNumber)}"`;
|
|
4978
|
-
|
|
4997
|
+
out.push(`${indent}<print${attrs}>`);
|
|
4979
4998
|
if (print.pageLayout) {
|
|
4980
|
-
|
|
4999
|
+
serializePageLayout(print.pageLayout, indent + " ", out);
|
|
4981
5000
|
}
|
|
4982
5001
|
if (print.systemLayout) {
|
|
4983
|
-
|
|
5002
|
+
serializeSystemLayout(print.systemLayout, indent + " ", out);
|
|
4984
5003
|
}
|
|
4985
5004
|
if (print.staffLayouts) {
|
|
4986
5005
|
for (const sl of print.staffLayouts) {
|
|
4987
5006
|
const numAttr = sl.number !== void 0 ? ` number="${sl.number}"` : "";
|
|
4988
|
-
|
|
5007
|
+
out.push(`${indent} <staff-layout${numAttr}>`);
|
|
4989
5008
|
if (sl.staffDistance !== void 0) {
|
|
4990
|
-
|
|
5009
|
+
out.push(`${indent} <staff-distance>${sl.staffDistance}</staff-distance>`);
|
|
4991
5010
|
}
|
|
4992
|
-
|
|
5011
|
+
out.push(`${indent} </staff-layout>`);
|
|
4993
5012
|
}
|
|
4994
5013
|
}
|
|
4995
5014
|
if (print.measureLayout) {
|
|
4996
|
-
|
|
5015
|
+
out.push(`${indent} <measure-layout>`);
|
|
4997
5016
|
if (print.measureLayout.measureDistance !== void 0) {
|
|
4998
|
-
|
|
5017
|
+
out.push(`${indent} <measure-distance>${print.measureLayout.measureDistance}</measure-distance>`);
|
|
4999
5018
|
}
|
|
5000
|
-
|
|
5019
|
+
out.push(`${indent} </measure-layout>`);
|
|
5001
5020
|
}
|
|
5002
5021
|
if (print.measureNumbering) {
|
|
5003
5022
|
const mn = print.measureNumbering;
|
|
5004
5023
|
if (typeof mn === "string") {
|
|
5005
|
-
|
|
5024
|
+
out.push(`${indent} <measure-numbering>${escapeXml(mn)}</measure-numbering>`);
|
|
5006
5025
|
} else {
|
|
5007
5026
|
let mnAttrs = "";
|
|
5008
5027
|
if (mn.system) mnAttrs += ` system="${mn.system}"`;
|
|
5009
|
-
|
|
5028
|
+
out.push(`${indent} <measure-numbering${mnAttrs}>${escapeXml(mn.value)}</measure-numbering>`);
|
|
5010
5029
|
}
|
|
5011
5030
|
}
|
|
5012
5031
|
if (print.partNameDisplay && print.partNameDisplay.length > 0) {
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5032
|
+
out.push(`${indent} <part-name-display>`);
|
|
5033
|
+
serializeDisplayTexts(print.partNameDisplay, indent + " ", out);
|
|
5034
|
+
out.push(`${indent} </part-name-display>`);
|
|
5016
5035
|
}
|
|
5017
5036
|
if (print.partAbbreviationDisplay && print.partAbbreviationDisplay.length > 0) {
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5037
|
+
out.push(`${indent} <part-abbreviation-display>`);
|
|
5038
|
+
serializeDisplayTexts(print.partAbbreviationDisplay, indent + " ", out);
|
|
5039
|
+
out.push(`${indent} </part-abbreviation-display>`);
|
|
5021
5040
|
}
|
|
5022
|
-
|
|
5023
|
-
return lines;
|
|
5041
|
+
out.push(`${indent}</print>`);
|
|
5024
5042
|
}
|
|
5025
|
-
function serializeAttributes(attrs, indent, id) {
|
|
5026
|
-
const lines = [];
|
|
5043
|
+
function serializeAttributes(attrs, indent, out, id) {
|
|
5027
5044
|
const idAttr = id ? ` id="${escapeXml(id)}"` : "";
|
|
5028
|
-
|
|
5045
|
+
out.push(`${indent}<attributes${idAttr}>`);
|
|
5029
5046
|
if (attrs.divisions !== void 0) {
|
|
5030
|
-
|
|
5047
|
+
out.push(`${indent} <divisions>${attrs.divisions}</divisions>`);
|
|
5031
5048
|
}
|
|
5032
5049
|
if (attrs.keys && attrs.keys.length > 0) {
|
|
5033
5050
|
for (const key of attrs.keys) {
|
|
5034
|
-
|
|
5051
|
+
serializeKey(key, indent + " ", out);
|
|
5035
5052
|
}
|
|
5036
5053
|
} else if (attrs.key) {
|
|
5037
|
-
|
|
5054
|
+
serializeKey(attrs.key, indent + " ", out);
|
|
5038
5055
|
}
|
|
5039
5056
|
if (attrs.time) {
|
|
5040
|
-
|
|
5057
|
+
serializeTime(attrs.time, indent + " ", out);
|
|
5041
5058
|
}
|
|
5042
5059
|
if (attrs.staves !== void 0) {
|
|
5043
|
-
|
|
5060
|
+
out.push(`${indent} <staves>${attrs.staves}</staves>`);
|
|
5044
5061
|
}
|
|
5045
5062
|
if (attrs.instruments !== void 0) {
|
|
5046
|
-
|
|
5063
|
+
out.push(`${indent} <instruments>${attrs.instruments}</instruments>`);
|
|
5047
5064
|
}
|
|
5048
5065
|
if (attrs.clef) {
|
|
5049
5066
|
for (const clef of attrs.clef) {
|
|
5050
|
-
|
|
5067
|
+
serializeClef(clef, indent + " ", out);
|
|
5051
5068
|
}
|
|
5052
5069
|
}
|
|
5053
5070
|
if (attrs.transpose) {
|
|
5054
|
-
|
|
5071
|
+
serializeTranspose(attrs.transpose, indent + " ", out);
|
|
5055
5072
|
}
|
|
5056
5073
|
if (attrs.staffDetails) {
|
|
5057
5074
|
for (const sd of attrs.staffDetails) {
|
|
5058
|
-
|
|
5075
|
+
serializeStaffDetails(sd, indent + " ", out);
|
|
5059
5076
|
}
|
|
5060
5077
|
}
|
|
5061
5078
|
if (attrs.measureStyle) {
|
|
5062
5079
|
for (const ms of attrs.measureStyle) {
|
|
5063
|
-
|
|
5080
|
+
serializeMeasureStyle(ms, indent + " ", out);
|
|
5064
5081
|
}
|
|
5065
5082
|
}
|
|
5066
|
-
|
|
5067
|
-
return lines;
|
|
5083
|
+
out.push(`${indent}</attributes>`);
|
|
5068
5084
|
}
|
|
5069
|
-
function serializeKey(key, indent) {
|
|
5070
|
-
const lines = [];
|
|
5085
|
+
function serializeKey(key, indent, out) {
|
|
5071
5086
|
let keyAttrs = "";
|
|
5072
5087
|
if (key.number !== void 0) keyAttrs += ` number="${key.number}"`;
|
|
5073
5088
|
if (key.printObject === false) keyAttrs += ' print-object="no"';
|
|
5074
5089
|
else if (key.printObject === true) keyAttrs += ' print-object="yes"';
|
|
5075
|
-
|
|
5090
|
+
out.push(`${indent}<key${keyAttrs}>`);
|
|
5076
5091
|
if (key.cancel !== void 0) {
|
|
5077
5092
|
const locationAttr = key.cancelLocation ? ` location="${key.cancelLocation}"` : "";
|
|
5078
|
-
|
|
5093
|
+
out.push(`${indent} <cancel${locationAttr}>${key.cancel}</cancel>`);
|
|
5079
5094
|
}
|
|
5080
5095
|
if (key.keySteps && key.keyAlters && key.keySteps.length > 0) {
|
|
5081
5096
|
for (let i = 0; i < key.keySteps.length; i++) {
|
|
5082
|
-
|
|
5097
|
+
out.push(`${indent} <key-step>${key.keySteps[i]}</key-step>`);
|
|
5083
5098
|
if (i < key.keyAlters.length) {
|
|
5084
|
-
|
|
5099
|
+
out.push(`${indent} <key-alter>${key.keyAlters[i]}</key-alter>`);
|
|
5085
5100
|
}
|
|
5086
5101
|
}
|
|
5087
5102
|
if (key.keyOctaves) {
|
|
5088
5103
|
for (const ko of key.keyOctaves) {
|
|
5089
5104
|
let koAttrs = ` number="${ko.number}"`;
|
|
5090
5105
|
if (ko.cancel !== void 0) koAttrs += ` cancel="${ko.cancel ? "yes" : "no"}"`;
|
|
5091
|
-
|
|
5106
|
+
out.push(`${indent} <key-octave${koAttrs}>${ko.octave}</key-octave>`);
|
|
5092
5107
|
}
|
|
5093
5108
|
}
|
|
5094
5109
|
} else {
|
|
5095
|
-
|
|
5110
|
+
out.push(`${indent} <fifths>${key.fifths}</fifths>`);
|
|
5096
5111
|
if (key.mode) {
|
|
5097
|
-
|
|
5112
|
+
out.push(`${indent} <mode>${key.mode}</mode>`);
|
|
5098
5113
|
}
|
|
5099
5114
|
if (key.keyOctaves) {
|
|
5100
5115
|
for (const ko of key.keyOctaves) {
|
|
5101
5116
|
let koAttrs = ` number="${ko.number}"`;
|
|
5102
5117
|
if (ko.cancel !== void 0) koAttrs += ` cancel="${ko.cancel ? "yes" : "no"}"`;
|
|
5103
|
-
|
|
5118
|
+
out.push(`${indent} <key-octave${koAttrs}>${ko.octave}</key-octave>`);
|
|
5104
5119
|
}
|
|
5105
5120
|
}
|
|
5106
5121
|
}
|
|
5107
|
-
|
|
5108
|
-
return lines;
|
|
5122
|
+
out.push(`${indent}</key>`);
|
|
5109
5123
|
}
|
|
5110
|
-
function serializeTime(time, indent) {
|
|
5111
|
-
const lines = [];
|
|
5124
|
+
function serializeTime(time, indent, out) {
|
|
5112
5125
|
let attrs = "";
|
|
5113
5126
|
if (time.symbol) attrs += ` symbol="${time.symbol}"`;
|
|
5114
5127
|
if (time.printObject === false) attrs += ' print-object="no"';
|
|
5115
|
-
|
|
5128
|
+
out.push(`${indent}<time${attrs}>`);
|
|
5116
5129
|
if (time.senzaMisura) {
|
|
5117
|
-
|
|
5130
|
+
out.push(`${indent} <senza-misura/>`);
|
|
5118
5131
|
} else if (time.beatsList && time.beatTypeList && time.beatsList.length > 1) {
|
|
5119
5132
|
const maxLen = Math.max(time.beatsList.length, time.beatTypeList.length);
|
|
5120
5133
|
for (let i = 0; i < maxLen; i++) {
|
|
5121
5134
|
if (i < time.beatsList.length) {
|
|
5122
5135
|
const beatsValue = time.beatsStrList && i < time.beatsStrList.length ? time.beatsStrList[i] : time.beatsList[i];
|
|
5123
|
-
|
|
5136
|
+
out.push(`${indent} <beats>${beatsValue}</beats>`);
|
|
5124
5137
|
}
|
|
5125
5138
|
if (i < time.beatTypeList.length) {
|
|
5126
|
-
|
|
5139
|
+
out.push(`${indent} <beat-type>${time.beatTypeList[i]}</beat-type>`);
|
|
5127
5140
|
}
|
|
5128
5141
|
}
|
|
5129
5142
|
} else {
|
|
5130
|
-
|
|
5131
|
-
|
|
5143
|
+
out.push(`${indent} <beats>${time.beats}</beats>`);
|
|
5144
|
+
out.push(`${indent} <beat-type>${time.beatType}</beat-type>`);
|
|
5132
5145
|
}
|
|
5133
|
-
|
|
5134
|
-
return lines;
|
|
5146
|
+
out.push(`${indent}</time>`);
|
|
5135
5147
|
}
|
|
5136
|
-
function serializeClef(clef, indent) {
|
|
5137
|
-
const lines = [];
|
|
5148
|
+
function serializeClef(clef, indent, out) {
|
|
5138
5149
|
let attrs = clef.staff ? ` number="${clef.staff}"` : "";
|
|
5139
5150
|
if (clef.printObject === false) attrs += ' print-object="no"';
|
|
5140
5151
|
else if (clef.printObject === true) attrs += ' print-object="yes"';
|
|
5141
5152
|
if (clef.afterBarline) attrs += ' after-barline="yes"';
|
|
5142
|
-
|
|
5143
|
-
|
|
5153
|
+
out.push(`${indent}<clef${attrs}>`);
|
|
5154
|
+
out.push(`${indent} <sign>${clef.sign}</sign>`);
|
|
5144
5155
|
if (clef.line !== void 0) {
|
|
5145
|
-
|
|
5156
|
+
out.push(`${indent} <line>${clef.line}</line>`);
|
|
5146
5157
|
}
|
|
5147
5158
|
if (clef.clefOctaveChange !== void 0) {
|
|
5148
|
-
|
|
5159
|
+
out.push(`${indent} <clef-octave-change>${clef.clefOctaveChange}</clef-octave-change>`);
|
|
5149
5160
|
}
|
|
5150
|
-
|
|
5151
|
-
return lines;
|
|
5161
|
+
out.push(`${indent}</clef>`);
|
|
5152
5162
|
}
|
|
5153
|
-
function serializeTranspose(transpose2, indent) {
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
lines.push(`${indent} <chromatic>${transpose2.chromatic}</chromatic>`);
|
|
5163
|
+
function serializeTranspose(transpose2, indent, out) {
|
|
5164
|
+
out.push(`${indent}<transpose>`);
|
|
5165
|
+
out.push(`${indent} <diatonic>${transpose2.diatonic}</diatonic>`);
|
|
5166
|
+
out.push(`${indent} <chromatic>${transpose2.chromatic}</chromatic>`);
|
|
5158
5167
|
if (transpose2.octaveChange !== void 0) {
|
|
5159
|
-
|
|
5168
|
+
out.push(`${indent} <octave-change>${transpose2.octaveChange}</octave-change>`);
|
|
5160
5169
|
}
|
|
5161
|
-
|
|
5162
|
-
return lines;
|
|
5170
|
+
out.push(`${indent}</transpose>`);
|
|
5163
5171
|
}
|
|
5164
|
-
function serializeEntry(entry, indent) {
|
|
5172
|
+
function serializeEntry(entry, indent, out) {
|
|
5165
5173
|
switch (entry.type) {
|
|
5166
5174
|
case "note":
|
|
5167
|
-
|
|
5175
|
+
serializeNote(entry, indent, out);
|
|
5176
|
+
break;
|
|
5168
5177
|
case "backup":
|
|
5169
|
-
|
|
5178
|
+
serializeBackup(entry, indent, out);
|
|
5179
|
+
break;
|
|
5170
5180
|
case "forward":
|
|
5171
|
-
|
|
5181
|
+
serializeForward(entry, indent, out);
|
|
5182
|
+
break;
|
|
5172
5183
|
case "direction":
|
|
5173
|
-
|
|
5184
|
+
serializeDirection(entry, indent, out);
|
|
5185
|
+
break;
|
|
5174
5186
|
case "harmony":
|
|
5175
|
-
|
|
5187
|
+
serializeHarmony(entry, indent, out);
|
|
5188
|
+
break;
|
|
5176
5189
|
case "figured-bass":
|
|
5177
|
-
|
|
5190
|
+
serializeFiguredBass(entry, indent, out);
|
|
5191
|
+
break;
|
|
5178
5192
|
case "sound":
|
|
5179
|
-
|
|
5193
|
+
serializeSound(entry, indent, out);
|
|
5194
|
+
break;
|
|
5180
5195
|
case "attributes":
|
|
5181
|
-
|
|
5196
|
+
serializeAttributes(entry.attributes, indent, out, entry._id);
|
|
5197
|
+
break;
|
|
5182
5198
|
case "grouping": {
|
|
5183
5199
|
const grp = entry;
|
|
5184
5200
|
let grpAttrs = ` type="${grp.groupingType}"`;
|
|
5185
5201
|
if (grp.number) grpAttrs += ` number="${grp.number}"`;
|
|
5186
|
-
|
|
5202
|
+
out.push(`${indent}<grouping${grpAttrs}/>`);
|
|
5203
|
+
break;
|
|
5187
5204
|
}
|
|
5188
5205
|
default:
|
|
5189
|
-
|
|
5206
|
+
break;
|
|
5190
5207
|
}
|
|
5191
5208
|
}
|
|
5192
|
-
function serializeNote(note, indent) {
|
|
5193
|
-
const lines = [];
|
|
5209
|
+
function serializeNote(note, indent, out) {
|
|
5194
5210
|
const noteAttrs = buildAttrs({
|
|
5195
5211
|
"id": note._id,
|
|
5196
5212
|
"default-x": note.defaultX,
|
|
@@ -5202,74 +5218,74 @@ function serializeNote(note, indent) {
|
|
|
5202
5218
|
"print-dot": note.printDot !== void 0 ? note.printDot : void 0,
|
|
5203
5219
|
"print-spacing": note.printSpacing
|
|
5204
5220
|
});
|
|
5205
|
-
|
|
5221
|
+
out.push(`${indent}<note${noteAttrs}>`);
|
|
5206
5222
|
if (note.grace) {
|
|
5207
5223
|
const graceAttrs = buildAttrs({
|
|
5208
5224
|
"slash": note.grace.slash !== void 0 ? note.grace.slash : void 0,
|
|
5209
5225
|
"steal-time-previous": note.grace.stealTimePrevious,
|
|
5210
5226
|
"steal-time-following": note.grace.stealTimeFollowing
|
|
5211
5227
|
});
|
|
5212
|
-
|
|
5228
|
+
out.push(`${indent} <grace${graceAttrs}/>`);
|
|
5213
5229
|
}
|
|
5214
5230
|
if (note.cue) {
|
|
5215
|
-
|
|
5231
|
+
out.push(`${indent} <cue/>`);
|
|
5216
5232
|
}
|
|
5217
5233
|
if (note.chord) {
|
|
5218
|
-
|
|
5234
|
+
out.push(`${indent} <chord/>`);
|
|
5219
5235
|
}
|
|
5220
5236
|
if (note.pitch) {
|
|
5221
|
-
|
|
5237
|
+
serializePitch(note.pitch, indent + " ", out);
|
|
5222
5238
|
} else if (note.rest) {
|
|
5223
5239
|
let restAttrs = "";
|
|
5224
5240
|
if (note.rest.measure) restAttrs += ' measure="yes"';
|
|
5225
5241
|
if (note.rest.displayStep || note.rest.displayOctave !== void 0) {
|
|
5226
|
-
|
|
5242
|
+
out.push(`${indent} <rest${restAttrs}>`);
|
|
5227
5243
|
if (note.rest.displayStep) {
|
|
5228
|
-
|
|
5244
|
+
out.push(`${indent} <display-step>${note.rest.displayStep}</display-step>`);
|
|
5229
5245
|
}
|
|
5230
5246
|
if (note.rest.displayOctave !== void 0) {
|
|
5231
|
-
|
|
5247
|
+
out.push(`${indent} <display-octave>${note.rest.displayOctave}</display-octave>`);
|
|
5232
5248
|
}
|
|
5233
|
-
|
|
5249
|
+
out.push(`${indent} </rest>`);
|
|
5234
5250
|
} else {
|
|
5235
|
-
|
|
5251
|
+
out.push(`${indent} <rest${restAttrs}/>`);
|
|
5236
5252
|
}
|
|
5237
5253
|
} else if (note.unpitched) {
|
|
5238
5254
|
if (note.unpitched.displayStep || note.unpitched.displayOctave !== void 0) {
|
|
5239
|
-
|
|
5255
|
+
out.push(`${indent} <unpitched>`);
|
|
5240
5256
|
if (note.unpitched.displayStep) {
|
|
5241
|
-
|
|
5257
|
+
out.push(`${indent} <display-step>${note.unpitched.displayStep}</display-step>`);
|
|
5242
5258
|
}
|
|
5243
5259
|
if (note.unpitched.displayOctave !== void 0) {
|
|
5244
|
-
|
|
5260
|
+
out.push(`${indent} <display-octave>${note.unpitched.displayOctave}</display-octave>`);
|
|
5245
5261
|
}
|
|
5246
|
-
|
|
5262
|
+
out.push(`${indent} </unpitched>`);
|
|
5247
5263
|
} else {
|
|
5248
|
-
|
|
5264
|
+
out.push(`${indent} <unpitched/>`);
|
|
5249
5265
|
}
|
|
5250
5266
|
} else {
|
|
5251
|
-
|
|
5267
|
+
out.push(`${indent} <rest/>`);
|
|
5252
5268
|
}
|
|
5253
5269
|
if (!note.grace) {
|
|
5254
|
-
|
|
5270
|
+
out.push(`${indent} <duration>${note.duration}</duration>`);
|
|
5255
5271
|
}
|
|
5256
5272
|
if (note.ties && note.ties.length > 0) {
|
|
5257
5273
|
for (const tie of note.ties) {
|
|
5258
|
-
|
|
5274
|
+
out.push(`${indent} <tie type="${tie.type}"/>`);
|
|
5259
5275
|
}
|
|
5260
5276
|
} else if (note.tie) {
|
|
5261
|
-
|
|
5277
|
+
out.push(`${indent} <tie type="${note.tie.type}"/>`);
|
|
5262
5278
|
}
|
|
5263
5279
|
if (note.voice !== void 0) {
|
|
5264
|
-
|
|
5280
|
+
out.push(`${indent} <voice>${note.voice}</voice>`);
|
|
5265
5281
|
}
|
|
5266
5282
|
if (note.noteType) {
|
|
5267
5283
|
const typeAttrs = note.noteTypeSize ? ` size="${escapeXml(note.noteTypeSize)}"` : "";
|
|
5268
|
-
|
|
5284
|
+
out.push(`${indent} <type${typeAttrs}>${note.noteType}</type>`);
|
|
5269
5285
|
}
|
|
5270
5286
|
if (note.dots) {
|
|
5271
5287
|
for (let i = 0; i < note.dots; i++) {
|
|
5272
|
-
|
|
5288
|
+
out.push(`${indent} <dot/>`);
|
|
5273
5289
|
}
|
|
5274
5290
|
}
|
|
5275
5291
|
if (note.accidental) {
|
|
@@ -5284,74 +5300,70 @@ function serializeNote(note, indent) {
|
|
|
5284
5300
|
"size": note.accidental.size,
|
|
5285
5301
|
"font-size": note.accidental.fontSize
|
|
5286
5302
|
});
|
|
5287
|
-
|
|
5303
|
+
out.push(`${indent} <accidental${accAttrs}>${note.accidental.value}</accidental>`);
|
|
5288
5304
|
}
|
|
5289
5305
|
if (note.timeModification) {
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5306
|
+
out.push(`${indent} <time-modification>`);
|
|
5307
|
+
out.push(`${indent} <actual-notes>${note.timeModification.actualNotes}</actual-notes>`);
|
|
5308
|
+
out.push(`${indent} <normal-notes>${note.timeModification.normalNotes}</normal-notes>`);
|
|
5293
5309
|
if (note.timeModification.normalType) {
|
|
5294
|
-
|
|
5310
|
+
out.push(`${indent} <normal-type>${note.timeModification.normalType}</normal-type>`);
|
|
5295
5311
|
}
|
|
5296
5312
|
if (note.timeModification.normalDots) {
|
|
5297
5313
|
for (let i = 0; i < note.timeModification.normalDots; i++) {
|
|
5298
|
-
|
|
5314
|
+
out.push(`${indent} <normal-dot/>`);
|
|
5299
5315
|
}
|
|
5300
5316
|
}
|
|
5301
|
-
|
|
5317
|
+
out.push(`${indent} </time-modification>`);
|
|
5302
5318
|
}
|
|
5303
5319
|
if (note.stem) {
|
|
5304
5320
|
const stemAttrs = buildAttrs({
|
|
5305
5321
|
"default-x": note.stem.defaultX,
|
|
5306
5322
|
"default-y": note.stem.defaultY
|
|
5307
5323
|
});
|
|
5308
|
-
|
|
5324
|
+
out.push(`${indent} <stem${stemAttrs}>${note.stem.value}</stem>`);
|
|
5309
5325
|
}
|
|
5310
5326
|
if (note.notehead) {
|
|
5311
5327
|
const nhAttrs = buildAttrs({
|
|
5312
5328
|
"filled": note.notehead.filled,
|
|
5313
5329
|
"parentheses": note.notehead.parentheses || void 0
|
|
5314
5330
|
});
|
|
5315
|
-
|
|
5331
|
+
out.push(`${indent} <notehead${nhAttrs}>${note.notehead.value}</notehead>`);
|
|
5316
5332
|
}
|
|
5317
5333
|
if (note.staff !== void 0) {
|
|
5318
|
-
|
|
5334
|
+
out.push(`${indent} <staff>${note.staff}</staff>`);
|
|
5319
5335
|
}
|
|
5320
5336
|
if (note.instrument) {
|
|
5321
|
-
|
|
5337
|
+
out.push(`${indent} <instrument id="${escapeXml(note.instrument)}"/>`);
|
|
5322
5338
|
}
|
|
5323
5339
|
if (note.beam) {
|
|
5324
5340
|
for (const beam of note.beam) {
|
|
5325
|
-
|
|
5341
|
+
serializeBeam(beam, indent + " ", out);
|
|
5326
5342
|
}
|
|
5327
5343
|
}
|
|
5328
5344
|
if (note.notations && note.notations.length > 0) {
|
|
5329
|
-
|
|
5345
|
+
serializeNotations(note.notations, indent + " ", out);
|
|
5330
5346
|
}
|
|
5331
5347
|
if (note.lyrics) {
|
|
5332
5348
|
for (const lyric of note.lyrics) {
|
|
5333
|
-
|
|
5349
|
+
serializeLyric(lyric, indent + " ", out);
|
|
5334
5350
|
}
|
|
5335
5351
|
}
|
|
5336
|
-
|
|
5337
|
-
return lines;
|
|
5352
|
+
out.push(`${indent}</note>`);
|
|
5338
5353
|
}
|
|
5339
|
-
function serializePitch(pitch, indent) {
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
lines.push(`${indent} <step>${pitch.step}</step>`);
|
|
5354
|
+
function serializePitch(pitch, indent, out) {
|
|
5355
|
+
out.push(`${indent}<pitch>`);
|
|
5356
|
+
out.push(`${indent} <step>${pitch.step}</step>`);
|
|
5343
5357
|
if (pitch.alter !== void 0 && pitch.alter !== 0) {
|
|
5344
|
-
|
|
5358
|
+
out.push(`${indent} <alter>${pitch.alter}</alter>`);
|
|
5345
5359
|
}
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
return lines;
|
|
5360
|
+
out.push(`${indent} <octave>${pitch.octave}</octave>`);
|
|
5361
|
+
out.push(`${indent}</pitch>`);
|
|
5349
5362
|
}
|
|
5350
|
-
function serializeBeam(beam, indent) {
|
|
5351
|
-
|
|
5363
|
+
function serializeBeam(beam, indent, out) {
|
|
5364
|
+
out.push(`${indent}<beam number="${beam.number}">${beam.type}</beam>`);
|
|
5352
5365
|
}
|
|
5353
|
-
function serializeNotations(notations, indent) {
|
|
5354
|
-
const lines = [];
|
|
5366
|
+
function serializeNotations(notations, indent, out) {
|
|
5355
5367
|
const notationsGroups = /* @__PURE__ */ new Map();
|
|
5356
5368
|
for (const notation of notations) {
|
|
5357
5369
|
const idx = _nullishCoalesce(notation.notationsIndex, () => ( 0));
|
|
@@ -5363,13 +5375,11 @@ function serializeNotations(notations, indent) {
|
|
|
5363
5375
|
const sortedIndices = Array.from(notationsGroups.keys()).sort((a, b) => a - b);
|
|
5364
5376
|
for (const notationsIdx of sortedIndices) {
|
|
5365
5377
|
const groupNotations = notationsGroups.get(notationsIdx);
|
|
5366
|
-
|
|
5378
|
+
serializeNotationsGroup(groupNotations, indent, out);
|
|
5367
5379
|
}
|
|
5368
|
-
return lines;
|
|
5369
5380
|
}
|
|
5370
|
-
function serializeNotationsGroup(notations, indent) {
|
|
5371
|
-
|
|
5372
|
-
lines.push(`${indent}<notations>`);
|
|
5381
|
+
function serializeNotationsGroup(notations, indent, out) {
|
|
5382
|
+
out.push(`${indent}<notations>`);
|
|
5373
5383
|
const chunks = [];
|
|
5374
5384
|
for (const notation of notations) {
|
|
5375
5385
|
if (notation.type === "articulation") {
|
|
@@ -5400,25 +5410,23 @@ function serializeNotationsGroup(notations, indent) {
|
|
|
5400
5410
|
}
|
|
5401
5411
|
for (const chunk of chunks) {
|
|
5402
5412
|
if (chunk.kind === "standalone") {
|
|
5403
|
-
|
|
5413
|
+
serializeStandaloneNotation(chunk.notation, indent, out);
|
|
5404
5414
|
} else if (chunk.kind === "articulations") {
|
|
5405
|
-
|
|
5415
|
+
serializeArticulationsGroup(chunk.items, indent, out);
|
|
5406
5416
|
} else if (chunk.kind === "ornaments") {
|
|
5407
|
-
|
|
5417
|
+
serializeOrnamentsGroup(chunk.items, indent, out);
|
|
5408
5418
|
} else if (chunk.kind === "technical") {
|
|
5409
|
-
|
|
5419
|
+
serializeTechnicalGroup(chunk.items, indent, out);
|
|
5410
5420
|
}
|
|
5411
5421
|
}
|
|
5412
|
-
|
|
5413
|
-
return lines;
|
|
5422
|
+
out.push(`${indent}</notations>`);
|
|
5414
5423
|
}
|
|
5415
|
-
function serializeStandaloneNotation(notation, indent) {
|
|
5416
|
-
const lines = [];
|
|
5424
|
+
function serializeStandaloneNotation(notation, indent, out) {
|
|
5417
5425
|
if (notation.type === "tied") {
|
|
5418
5426
|
let attrs = ` type="${notation.tiedType}"`;
|
|
5419
5427
|
if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
|
|
5420
5428
|
if (notation.orientation) attrs += ` orientation="${notation.orientation}"`;
|
|
5421
|
-
|
|
5429
|
+
out.push(`${indent} <tied${attrs}/>`);
|
|
5422
5430
|
} else if (notation.type === "slur") {
|
|
5423
5431
|
let attrs = "";
|
|
5424
5432
|
if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
|
|
@@ -5432,7 +5440,7 @@ function serializeStandaloneNotation(notation, indent) {
|
|
|
5432
5440
|
if (notation.bezierX2 !== void 0) attrs += ` bezier-x2="${notation.bezierX2}"`;
|
|
5433
5441
|
if (notation.bezierY2 !== void 0) attrs += ` bezier-y2="${notation.bezierY2}"`;
|
|
5434
5442
|
if (notation.placement) attrs += ` placement="${notation.placement}"`;
|
|
5435
|
-
|
|
5443
|
+
out.push(`${indent} <slur${attrs}/>`);
|
|
5436
5444
|
} else if (notation.type === "tuplet") {
|
|
5437
5445
|
let attrs = ` type="${notation.tupletType}"`;
|
|
5438
5446
|
if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
|
|
@@ -5443,51 +5451,51 @@ function serializeStandaloneNotation(notation, indent) {
|
|
|
5443
5451
|
if (notation.placement) attrs += ` placement="${notation.placement}"`;
|
|
5444
5452
|
const tup = notation;
|
|
5445
5453
|
if (tup.tupletActual || tup.tupletNormal) {
|
|
5446
|
-
|
|
5454
|
+
out.push(`${indent} <tuplet${attrs}>`);
|
|
5447
5455
|
if (tup.tupletActual) {
|
|
5448
|
-
|
|
5456
|
+
out.push(`${indent} <tuplet-actual>`);
|
|
5449
5457
|
if (tup.tupletActual.tupletNumber !== void 0) {
|
|
5450
|
-
|
|
5458
|
+
out.push(`${indent} <tuplet-number>${tup.tupletActual.tupletNumber}</tuplet-number>`);
|
|
5451
5459
|
}
|
|
5452
5460
|
if (tup.tupletActual.tupletType) {
|
|
5453
|
-
|
|
5461
|
+
out.push(`${indent} <tuplet-type>${tup.tupletActual.tupletType}</tuplet-type>`);
|
|
5454
5462
|
}
|
|
5455
5463
|
if (tup.tupletActual.tupletDots) {
|
|
5456
5464
|
for (let i = 0; i < tup.tupletActual.tupletDots; i++) {
|
|
5457
|
-
|
|
5465
|
+
out.push(`${indent} <tuplet-dot/>`);
|
|
5458
5466
|
}
|
|
5459
5467
|
}
|
|
5460
|
-
|
|
5468
|
+
out.push(`${indent} </tuplet-actual>`);
|
|
5461
5469
|
}
|
|
5462
5470
|
if (tup.tupletNormal) {
|
|
5463
|
-
|
|
5471
|
+
out.push(`${indent} <tuplet-normal>`);
|
|
5464
5472
|
if (tup.tupletNormal.tupletNumber !== void 0) {
|
|
5465
|
-
|
|
5473
|
+
out.push(`${indent} <tuplet-number>${tup.tupletNormal.tupletNumber}</tuplet-number>`);
|
|
5466
5474
|
}
|
|
5467
5475
|
if (tup.tupletNormal.tupletType) {
|
|
5468
|
-
|
|
5476
|
+
out.push(`${indent} <tuplet-type>${tup.tupletNormal.tupletType}</tuplet-type>`);
|
|
5469
5477
|
}
|
|
5470
5478
|
if (tup.tupletNormal.tupletDots) {
|
|
5471
5479
|
for (let i = 0; i < tup.tupletNormal.tupletDots; i++) {
|
|
5472
|
-
|
|
5480
|
+
out.push(`${indent} <tuplet-dot/>`);
|
|
5473
5481
|
}
|
|
5474
5482
|
}
|
|
5475
|
-
|
|
5483
|
+
out.push(`${indent} </tuplet-normal>`);
|
|
5476
5484
|
}
|
|
5477
|
-
|
|
5485
|
+
out.push(`${indent} </tuplet>`);
|
|
5478
5486
|
} else {
|
|
5479
|
-
|
|
5487
|
+
out.push(`${indent} <tuplet${attrs}/>`);
|
|
5480
5488
|
}
|
|
5481
5489
|
} else if (notation.type === "dynamics") {
|
|
5482
5490
|
const placementAttr = notation.placement ? ` placement="${notation.placement}"` : "";
|
|
5483
|
-
|
|
5491
|
+
out.push(`${indent} <dynamics${placementAttr}>`);
|
|
5484
5492
|
for (const dyn of notation.dynamics) {
|
|
5485
|
-
|
|
5493
|
+
out.push(`${indent} <${dyn}/>`);
|
|
5486
5494
|
}
|
|
5487
5495
|
if (notation.otherDynamics) {
|
|
5488
|
-
|
|
5496
|
+
out.push(`${indent} <other-dynamics>${escapeXml(notation.otherDynamics)}</other-dynamics>`);
|
|
5489
5497
|
}
|
|
5490
|
-
|
|
5498
|
+
out.push(`${indent} </dynamics>`);
|
|
5491
5499
|
} else if (notation.type === "fermata") {
|
|
5492
5500
|
let attrs = "";
|
|
5493
5501
|
if (notation.fermataType) attrs += ` type="${notation.fermataType}"`;
|
|
@@ -5495,9 +5503,9 @@ function serializeStandaloneNotation(notation, indent) {
|
|
|
5495
5503
|
if (notation.defaultX !== void 0) attrs += ` default-x="${notation.defaultX}"`;
|
|
5496
5504
|
if (notation.defaultY !== void 0) attrs += ` default-y="${notation.defaultY}"`;
|
|
5497
5505
|
if (notation.shape) {
|
|
5498
|
-
|
|
5506
|
+
out.push(`${indent} <fermata${attrs}>${notation.shape}</fermata>`);
|
|
5499
5507
|
} else {
|
|
5500
|
-
|
|
5508
|
+
out.push(`${indent} <fermata${attrs}/>`);
|
|
5501
5509
|
}
|
|
5502
5510
|
} else if (notation.type === "arpeggiate") {
|
|
5503
5511
|
let attrs = "";
|
|
@@ -5505,40 +5513,38 @@ function serializeStandaloneNotation(notation, indent) {
|
|
|
5505
5513
|
if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
|
|
5506
5514
|
if (notation.defaultX !== void 0) attrs += ` default-x="${notation.defaultX}"`;
|
|
5507
5515
|
if (notation.defaultY !== void 0) attrs += ` default-y="${notation.defaultY}"`;
|
|
5508
|
-
|
|
5516
|
+
out.push(`${indent} <arpeggiate${attrs}/>`);
|
|
5509
5517
|
} else if (notation.type === "non-arpeggiate") {
|
|
5510
5518
|
let attrs = ` type="${notation.nonArpeggiateType}"`;
|
|
5511
5519
|
if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
|
|
5512
5520
|
if (notation.placement) attrs += ` placement="${notation.placement}"`;
|
|
5513
|
-
|
|
5521
|
+
out.push(`${indent} <non-arpeggiate${attrs}/>`);
|
|
5514
5522
|
} else if (notation.type === "accidental-mark") {
|
|
5515
5523
|
let attrs = "";
|
|
5516
5524
|
if (notation.placement) attrs += ` placement="${notation.placement}"`;
|
|
5517
|
-
|
|
5525
|
+
out.push(`${indent} <accidental-mark${attrs}>${escapeXml(notation.value)}</accidental-mark>`);
|
|
5518
5526
|
} else if (notation.type === "glissando") {
|
|
5519
5527
|
let attrs = ` type="${notation.glissandoType}"`;
|
|
5520
5528
|
if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
|
|
5521
5529
|
if (notation.lineType) attrs += ` line-type="${notation.lineType}"`;
|
|
5522
5530
|
if (notation.text) {
|
|
5523
|
-
|
|
5531
|
+
out.push(`${indent} <glissando${attrs}>${escapeXml(notation.text)}</glissando>`);
|
|
5524
5532
|
} else {
|
|
5525
|
-
|
|
5533
|
+
out.push(`${indent} <glissando${attrs}/>`);
|
|
5526
5534
|
}
|
|
5527
5535
|
} else if (notation.type === "slide") {
|
|
5528
5536
|
let attrs = ` type="${notation.slideType}"`;
|
|
5529
5537
|
if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
|
|
5530
5538
|
if (notation.lineType) attrs += ` line-type="${notation.lineType}"`;
|
|
5531
5539
|
if (notation.text) {
|
|
5532
|
-
|
|
5540
|
+
out.push(`${indent} <slide${attrs}>${escapeXml(notation.text)}</slide>`);
|
|
5533
5541
|
} else {
|
|
5534
|
-
|
|
5542
|
+
out.push(`${indent} <slide${attrs}/>`);
|
|
5535
5543
|
}
|
|
5536
5544
|
}
|
|
5537
|
-
return lines;
|
|
5538
5545
|
}
|
|
5539
|
-
function serializeArticulationsGroup(artGroup, indent) {
|
|
5540
|
-
|
|
5541
|
-
lines.push(`${indent} <articulations>`);
|
|
5546
|
+
function serializeArticulationsGroup(artGroup, indent, out) {
|
|
5547
|
+
out.push(`${indent} <articulations>`);
|
|
5542
5548
|
for (const art of artGroup) {
|
|
5543
5549
|
if (art.type === "articulation") {
|
|
5544
5550
|
let artAttrs = art.placement ? ` placement="${art.placement}"` : "";
|
|
@@ -5547,19 +5553,17 @@ function serializeArticulationsGroup(artGroup, indent) {
|
|
|
5547
5553
|
}
|
|
5548
5554
|
if (art.defaultX !== void 0) artAttrs += ` default-x="${art.defaultX}"`;
|
|
5549
5555
|
if (art.defaultY !== void 0) artAttrs += ` default-y="${art.defaultY}"`;
|
|
5550
|
-
|
|
5556
|
+
out.push(`${indent} <${art.articulation}${artAttrs}/>`);
|
|
5551
5557
|
}
|
|
5552
5558
|
}
|
|
5553
|
-
|
|
5554
|
-
return lines;
|
|
5559
|
+
out.push(`${indent} </articulations>`);
|
|
5555
5560
|
}
|
|
5556
|
-
function serializeOrnamentsGroup(ornaments, indent) {
|
|
5557
|
-
const lines = [];
|
|
5561
|
+
function serializeOrnamentsGroup(ornaments, indent, out) {
|
|
5558
5562
|
const hasOnlyEmptyMarker = ornaments.length === 1 && ornaments[0].type === "ornament" && ornaments[0].ornament === "empty";
|
|
5559
5563
|
if (hasOnlyEmptyMarker) {
|
|
5560
|
-
|
|
5564
|
+
out.push(`${indent} <ornaments/>`);
|
|
5561
5565
|
} else {
|
|
5562
|
-
|
|
5566
|
+
out.push(`${indent} <ornaments>`);
|
|
5563
5567
|
const allAccidentalMarks = [];
|
|
5564
5568
|
for (const orn of ornaments) {
|
|
5565
5569
|
if (orn.type === "ornament") {
|
|
@@ -5571,7 +5575,7 @@ function serializeOrnamentsGroup(ornaments, indent) {
|
|
|
5571
5575
|
if (orn.number !== void 0) wlAttrs += ` number="${orn.number}"`;
|
|
5572
5576
|
wlAttrs += placementAttr;
|
|
5573
5577
|
if (orn.defaultY !== void 0) wlAttrs += ` default-y="${orn.defaultY}"`;
|
|
5574
|
-
|
|
5578
|
+
out.push(`${indent} <wavy-line${wlAttrs}/>`);
|
|
5575
5579
|
} else if (orn.ornament === "tremolo") {
|
|
5576
5580
|
let tremAttrs = "";
|
|
5577
5581
|
if (orn.tremoloType) tremAttrs += ` type="${orn.tremoloType}"`;
|
|
@@ -5579,14 +5583,14 @@ function serializeOrnamentsGroup(ornaments, indent) {
|
|
|
5579
5583
|
if (orn.defaultX !== void 0) tremAttrs += ` default-x="${orn.defaultX}"`;
|
|
5580
5584
|
if (orn.defaultY !== void 0) tremAttrs += ` default-y="${orn.defaultY}"`;
|
|
5581
5585
|
if (orn.tremoloMarks !== void 0) {
|
|
5582
|
-
|
|
5586
|
+
out.push(`${indent} <tremolo${tremAttrs}>${orn.tremoloMarks}</tremolo>`);
|
|
5583
5587
|
} else {
|
|
5584
|
-
|
|
5588
|
+
out.push(`${indent} <tremolo${tremAttrs}/>`);
|
|
5585
5589
|
}
|
|
5586
5590
|
} else {
|
|
5587
5591
|
let ornAttrs = placementAttr;
|
|
5588
5592
|
if (orn.defaultY !== void 0) ornAttrs += ` default-y="${orn.defaultY}"`;
|
|
5589
|
-
|
|
5593
|
+
out.push(`${indent} <${orn.ornament}${ornAttrs}/>`);
|
|
5590
5594
|
}
|
|
5591
5595
|
if (orn.accidentalMarks) {
|
|
5592
5596
|
allAccidentalMarks.push(...orn.accidentalMarks);
|
|
@@ -5595,15 +5599,13 @@ function serializeOrnamentsGroup(ornaments, indent) {
|
|
|
5595
5599
|
}
|
|
5596
5600
|
for (const am of allAccidentalMarks) {
|
|
5597
5601
|
const amPlacement = am.placement ? ` placement="${am.placement}"` : "";
|
|
5598
|
-
|
|
5602
|
+
out.push(`${indent} <accidental-mark${amPlacement}>${am.value}</accidental-mark>`);
|
|
5599
5603
|
}
|
|
5600
|
-
|
|
5604
|
+
out.push(`${indent} </ornaments>`);
|
|
5601
5605
|
}
|
|
5602
|
-
return lines;
|
|
5603
5606
|
}
|
|
5604
|
-
function serializeTechnicalGroup(technicals, indent) {
|
|
5605
|
-
|
|
5606
|
-
lines.push(`${indent} <technical>`);
|
|
5607
|
+
function serializeTechnicalGroup(technicals, indent, out) {
|
|
5608
|
+
out.push(`${indent} <technical>`);
|
|
5607
5609
|
for (const tech of technicals) {
|
|
5608
5610
|
if (tech.type === "technical") {
|
|
5609
5611
|
let placementAttr = tech.placement ? ` placement="${tech.placement}"` : "";
|
|
@@ -5611,32 +5613,32 @@ function serializeTechnicalGroup(technicals, indent) {
|
|
|
5611
5613
|
if (techNotation.defaultX !== void 0) placementAttr += ` default-x="${techNotation.defaultX}"`;
|
|
5612
5614
|
if (techNotation.defaultY !== void 0) placementAttr += ` default-y="${techNotation.defaultY}"`;
|
|
5613
5615
|
if (tech.technical === "bend" && (techNotation.bendAlter !== void 0 || techNotation.preBend || techNotation.release)) {
|
|
5614
|
-
|
|
5616
|
+
out.push(`${indent} <bend${placementAttr}>`);
|
|
5615
5617
|
if (techNotation.bendAlter !== void 0) {
|
|
5616
|
-
|
|
5618
|
+
out.push(`${indent} <bend-alter>${techNotation.bendAlter}</bend-alter>`);
|
|
5617
5619
|
}
|
|
5618
5620
|
if (techNotation.preBend) {
|
|
5619
|
-
|
|
5621
|
+
out.push(`${indent} <pre-bend/>`);
|
|
5620
5622
|
}
|
|
5621
5623
|
if (techNotation.release) {
|
|
5622
|
-
|
|
5624
|
+
out.push(`${indent} <release/>`);
|
|
5623
5625
|
}
|
|
5624
5626
|
if (techNotation.withBar) {
|
|
5625
|
-
|
|
5627
|
+
out.push(`${indent} <with-bar/>`);
|
|
5626
5628
|
}
|
|
5627
|
-
|
|
5629
|
+
out.push(`${indent} </bend>`);
|
|
5628
5630
|
} else if (tech.technical === "harmonic") {
|
|
5629
5631
|
const hasChildren = techNotation.harmonicNatural || techNotation.harmonicArtificial || techNotation.basePitch || techNotation.touchingPitch || techNotation.soundingPitch;
|
|
5630
5632
|
if (hasChildren) {
|
|
5631
|
-
|
|
5632
|
-
if (techNotation.harmonicNatural)
|
|
5633
|
-
if (techNotation.harmonicArtificial)
|
|
5634
|
-
if (techNotation.basePitch)
|
|
5635
|
-
if (techNotation.touchingPitch)
|
|
5636
|
-
if (techNotation.soundingPitch)
|
|
5637
|
-
|
|
5633
|
+
out.push(`${indent} <harmonic${placementAttr}>`);
|
|
5634
|
+
if (techNotation.harmonicNatural) out.push(`${indent} <natural/>`);
|
|
5635
|
+
if (techNotation.harmonicArtificial) out.push(`${indent} <artificial/>`);
|
|
5636
|
+
if (techNotation.basePitch) out.push(`${indent} <base-pitch/>`);
|
|
5637
|
+
if (techNotation.touchingPitch) out.push(`${indent} <touching-pitch/>`);
|
|
5638
|
+
if (techNotation.soundingPitch) out.push(`${indent} <sounding-pitch/>`);
|
|
5639
|
+
out.push(`${indent} </harmonic>`);
|
|
5638
5640
|
} else {
|
|
5639
|
-
|
|
5641
|
+
out.push(`${indent} <harmonic${placementAttr}/>`);
|
|
5640
5642
|
}
|
|
5641
5643
|
} else if (tech.technical === "hammer-on" || tech.technical === "pull-off") {
|
|
5642
5644
|
let attrs = "";
|
|
@@ -5644,39 +5646,37 @@ function serializeTechnicalGroup(technicals, indent) {
|
|
|
5644
5646
|
if (techNotation.startStop) attrs += ` type="${techNotation.startStop}"`;
|
|
5645
5647
|
attrs += placementAttr;
|
|
5646
5648
|
if (techNotation.text !== void 0) {
|
|
5647
|
-
|
|
5649
|
+
out.push(`${indent} <${tech.technical}${attrs}>${escapeXml(techNotation.text)}</${tech.technical}>`);
|
|
5648
5650
|
} else {
|
|
5649
|
-
|
|
5651
|
+
out.push(`${indent} <${tech.technical}${attrs}/>`);
|
|
5650
5652
|
}
|
|
5651
5653
|
} else if (tech.technical === "string" && techNotation.string !== void 0) {
|
|
5652
|
-
|
|
5654
|
+
out.push(`${indent} <string${placementAttr}>${techNotation.string}</string>`);
|
|
5653
5655
|
} else if (tech.technical === "fret" && techNotation.fret !== void 0) {
|
|
5654
|
-
|
|
5656
|
+
out.push(`${indent} <fret${placementAttr}>${techNotation.fret}</fret>`);
|
|
5655
5657
|
} else if (tech.technical === "fingering") {
|
|
5656
5658
|
let fAttrs = placementAttr;
|
|
5657
5659
|
if (techNotation.fingeringSubstitution) fAttrs += ' substitution="yes"';
|
|
5658
5660
|
if (techNotation.fingeringAlternate) fAttrs += ' alternate="yes"';
|
|
5659
5661
|
if (techNotation.text !== void 0) {
|
|
5660
|
-
|
|
5662
|
+
out.push(`${indent} <fingering${fAttrs}>${escapeXml(techNotation.text)}</fingering>`);
|
|
5661
5663
|
} else {
|
|
5662
|
-
|
|
5664
|
+
out.push(`${indent} <fingering${fAttrs}/>`);
|
|
5663
5665
|
}
|
|
5664
5666
|
} else if (tech.technical === "heel" || tech.technical === "toe") {
|
|
5665
5667
|
let htAttrs = placementAttr;
|
|
5666
5668
|
if (techNotation.substitution) htAttrs += ' substitution="yes"';
|
|
5667
|
-
|
|
5669
|
+
out.push(`${indent} <${tech.technical}${htAttrs}/>`);
|
|
5668
5670
|
} else if (techNotation.text !== void 0) {
|
|
5669
|
-
|
|
5671
|
+
out.push(`${indent} <${tech.technical}${placementAttr}>${escapeXml(techNotation.text)}</${tech.technical}>`);
|
|
5670
5672
|
} else {
|
|
5671
|
-
|
|
5673
|
+
out.push(`${indent} <${tech.technical}${placementAttr}/>`);
|
|
5672
5674
|
}
|
|
5673
5675
|
}
|
|
5674
5676
|
}
|
|
5675
|
-
|
|
5676
|
-
return lines;
|
|
5677
|
+
out.push(`${indent} </technical>`);
|
|
5677
5678
|
}
|
|
5678
|
-
function serializeLyric(lyric, indent) {
|
|
5679
|
-
const lines = [];
|
|
5679
|
+
function serializeLyric(lyric, indent, out) {
|
|
5680
5680
|
let attrs = "";
|
|
5681
5681
|
if (lyric.number) attrs += ` number="${lyric.number}"`;
|
|
5682
5682
|
if (lyric.name) attrs += ` name="${escapeXml(lyric.name)}"`;
|
|
@@ -5684,78 +5684,72 @@ function serializeLyric(lyric, indent) {
|
|
|
5684
5684
|
if (lyric.relativeX !== void 0) attrs += ` relative-x="${lyric.relativeX}"`;
|
|
5685
5685
|
if (lyric.justify) attrs += ` justify="${escapeXml(lyric.justify)}"`;
|
|
5686
5686
|
if (lyric.placement) attrs += ` placement="${lyric.placement}"`;
|
|
5687
|
-
|
|
5687
|
+
out.push(`${indent}<lyric${attrs}>`);
|
|
5688
5688
|
if (lyric.textElements && lyric.textElements.length > 1) {
|
|
5689
5689
|
for (let i = 0; i < lyric.textElements.length; i++) {
|
|
5690
5690
|
const te = lyric.textElements[i];
|
|
5691
5691
|
if (te.syllabic) {
|
|
5692
|
-
|
|
5692
|
+
out.push(`${indent} <syllabic>${te.syllabic}</syllabic>`);
|
|
5693
5693
|
}
|
|
5694
|
-
|
|
5694
|
+
out.push(`${indent} <text>${escapeXml(te.text)}</text>`);
|
|
5695
5695
|
if (i < lyric.textElements.length - 1) {
|
|
5696
|
-
|
|
5696
|
+
out.push(`${indent} <elision/>`);
|
|
5697
5697
|
}
|
|
5698
5698
|
}
|
|
5699
5699
|
} else if (lyric.syllabic || lyric.text) {
|
|
5700
5700
|
if (lyric.syllabic) {
|
|
5701
|
-
|
|
5701
|
+
out.push(`${indent} <syllabic>${lyric.syllabic}</syllabic>`);
|
|
5702
5702
|
}
|
|
5703
|
-
|
|
5703
|
+
out.push(`${indent} <text>${escapeXml(lyric.text)}</text>`);
|
|
5704
5704
|
}
|
|
5705
5705
|
if (lyric.extend) {
|
|
5706
5706
|
if (typeof lyric.extend === "object" && lyric.extend.type) {
|
|
5707
|
-
|
|
5707
|
+
out.push(`${indent} <extend type="${lyric.extend.type}"/>`);
|
|
5708
5708
|
} else {
|
|
5709
|
-
|
|
5709
|
+
out.push(`${indent} <extend/>`);
|
|
5710
5710
|
}
|
|
5711
5711
|
}
|
|
5712
5712
|
if (lyric.endLine) {
|
|
5713
|
-
|
|
5713
|
+
out.push(`${indent} <end-line/>`);
|
|
5714
5714
|
}
|
|
5715
5715
|
if (lyric.endParagraph) {
|
|
5716
|
-
|
|
5716
|
+
out.push(`${indent} <end-paragraph/>`);
|
|
5717
5717
|
}
|
|
5718
|
-
|
|
5719
|
-
return lines;
|
|
5718
|
+
out.push(`${indent}</lyric>`);
|
|
5720
5719
|
}
|
|
5721
|
-
function serializeBackup(backup, indent) {
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
`${indent}</backup>`
|
|
5726
|
-
];
|
|
5720
|
+
function serializeBackup(backup, indent, out) {
|
|
5721
|
+
out.push(`${indent}<backup>`);
|
|
5722
|
+
out.push(`${indent} <duration>${backup.duration}</duration>`);
|
|
5723
|
+
out.push(`${indent}</backup>`);
|
|
5727
5724
|
}
|
|
5728
|
-
function serializeForward(forward, indent) {
|
|
5729
|
-
const lines = [];
|
|
5725
|
+
function serializeForward(forward, indent, out) {
|
|
5730
5726
|
const idAttr = forward._id ? ` id="${escapeXml(forward._id)}"` : "";
|
|
5731
|
-
|
|
5732
|
-
|
|
5727
|
+
out.push(`${indent}<forward${idAttr}>`);
|
|
5728
|
+
out.push(`${indent} <duration>${forward.duration}</duration>`);
|
|
5733
5729
|
if (forward.voice !== void 0) {
|
|
5734
|
-
|
|
5730
|
+
out.push(`${indent} <voice>${forward.voice}</voice>`);
|
|
5735
5731
|
}
|
|
5736
5732
|
if (forward.staff !== void 0) {
|
|
5737
|
-
|
|
5733
|
+
out.push(`${indent} <staff>${forward.staff}</staff>`);
|
|
5738
5734
|
}
|
|
5739
|
-
|
|
5740
|
-
return lines;
|
|
5735
|
+
out.push(`${indent}</forward>`);
|
|
5741
5736
|
}
|
|
5742
|
-
function serializeDirection(direction, indent) {
|
|
5743
|
-
const lines = [];
|
|
5737
|
+
function serializeDirection(direction, indent, out) {
|
|
5744
5738
|
let attrs = "";
|
|
5745
5739
|
if (direction._id) attrs += ` id="${escapeXml(direction._id)}"`;
|
|
5746
5740
|
if (direction.placement) attrs += ` placement="${direction.placement}"`;
|
|
5747
5741
|
if (direction.directive) attrs += ' directive="yes"';
|
|
5748
5742
|
if (direction.system) attrs += ` system="${direction.system}"`;
|
|
5749
|
-
|
|
5743
|
+
out.push(`${indent}<direction${attrs}>`);
|
|
5750
5744
|
for (const dirType of direction.directionTypes) {
|
|
5751
|
-
|
|
5745
|
+
serializeDirectionType(dirType, indent + " ", out);
|
|
5752
5746
|
}
|
|
5753
5747
|
if (direction.offset !== void 0) {
|
|
5754
5748
|
const soundAttr = direction.offsetSound ? ' sound="yes"' : "";
|
|
5755
|
-
|
|
5749
|
+
out.push(`${indent} <offset${soundAttr}>${direction.offset}</offset>`);
|
|
5756
5750
|
}
|
|
5757
5751
|
if (direction.staff !== void 0) {
|
|
5758
|
-
|
|
5752
|
+
out.push(`${indent} <staff>${direction.staff}</staff>`);
|
|
5759
5753
|
}
|
|
5760
5754
|
if (direction.sound) {
|
|
5761
5755
|
const attrs2 = [];
|
|
@@ -5776,33 +5770,31 @@ function serializeDirection(direction, indent) {
|
|
|
5776
5770
|
}
|
|
5777
5771
|
const attrStr = attrs2.length > 0 ? ` ${attrs2.join(" ")}` : "";
|
|
5778
5772
|
if (direction.sound.midiInstrument) {
|
|
5779
|
-
|
|
5773
|
+
out.push(`${indent} <sound${attrStr}>`);
|
|
5780
5774
|
const midi = direction.sound.midiInstrument;
|
|
5781
|
-
|
|
5775
|
+
out.push(`${indent} <midi-instrument id="${escapeXml(midi.id)}">`);
|
|
5782
5776
|
if (midi.midiChannel !== void 0) {
|
|
5783
|
-
|
|
5777
|
+
out.push(`${indent} <midi-channel>${midi.midiChannel}</midi-channel>`);
|
|
5784
5778
|
}
|
|
5785
5779
|
if (midi.midiProgram !== void 0) {
|
|
5786
|
-
|
|
5780
|
+
out.push(`${indent} <midi-program>${midi.midiProgram}</midi-program>`);
|
|
5787
5781
|
}
|
|
5788
5782
|
if (midi.volume !== void 0) {
|
|
5789
|
-
|
|
5783
|
+
out.push(`${indent} <volume>${midi.volume}</volume>`);
|
|
5790
5784
|
}
|
|
5791
5785
|
if (midi.pan !== void 0) {
|
|
5792
|
-
|
|
5786
|
+
out.push(`${indent} <pan>${midi.pan}</pan>`);
|
|
5793
5787
|
}
|
|
5794
|
-
|
|
5795
|
-
|
|
5788
|
+
out.push(`${indent} </midi-instrument>`);
|
|
5789
|
+
out.push(`${indent} </sound>`);
|
|
5796
5790
|
} else if (attrs2.length > 0) {
|
|
5797
|
-
|
|
5791
|
+
out.push(`${indent} <sound${attrStr}/>`);
|
|
5798
5792
|
}
|
|
5799
5793
|
}
|
|
5800
|
-
|
|
5801
|
-
return lines;
|
|
5794
|
+
out.push(`${indent}</direction>`);
|
|
5802
5795
|
}
|
|
5803
|
-
function serializeDirectionType(dirType, indent) {
|
|
5804
|
-
|
|
5805
|
-
lines.push(`${indent}<direction-type>`);
|
|
5796
|
+
function serializeDirectionType(dirType, indent, out) {
|
|
5797
|
+
out.push(`${indent}<direction-type>`);
|
|
5806
5798
|
switch (dirType.kind) {
|
|
5807
5799
|
case "dynamics": {
|
|
5808
5800
|
let dynAttrs = "";
|
|
@@ -5810,14 +5802,14 @@ function serializeDirectionType(dirType, indent) {
|
|
|
5810
5802
|
if (dirType.defaultY !== void 0) dynAttrs += ` default-y="${dirType.defaultY}"`;
|
|
5811
5803
|
if (dirType.relativeX !== void 0) dynAttrs += ` relative-x="${dirType.relativeX}"`;
|
|
5812
5804
|
if (dirType.halign) dynAttrs += ` halign="${dirType.halign}"`;
|
|
5813
|
-
|
|
5805
|
+
out.push(`${indent} <dynamics${dynAttrs}>`);
|
|
5814
5806
|
if (dirType.value) {
|
|
5815
|
-
|
|
5807
|
+
out.push(`${indent} <${dirType.value}/>`);
|
|
5816
5808
|
}
|
|
5817
5809
|
if (dirType.otherDynamics) {
|
|
5818
|
-
|
|
5810
|
+
out.push(`${indent} <other-dynamics>${escapeXml(dirType.otherDynamics)}</other-dynamics>`);
|
|
5819
5811
|
}
|
|
5820
|
-
|
|
5812
|
+
out.push(`${indent} </dynamics>`);
|
|
5821
5813
|
break;
|
|
5822
5814
|
}
|
|
5823
5815
|
case "wedge": {
|
|
@@ -5825,7 +5817,7 @@ function serializeDirectionType(dirType, indent) {
|
|
|
5825
5817
|
if (dirType.spread !== void 0) wedgeAttrs += ` spread="${dirType.spread}"`;
|
|
5826
5818
|
if (dirType.defaultY !== void 0) wedgeAttrs += ` default-y="${dirType.defaultY}"`;
|
|
5827
5819
|
if (dirType.relativeX !== void 0) wedgeAttrs += ` relative-x="${dirType.relativeX}"`;
|
|
5828
|
-
|
|
5820
|
+
out.push(`${indent} <wedge${wedgeAttrs}/>`);
|
|
5829
5821
|
break;
|
|
5830
5822
|
}
|
|
5831
5823
|
case "metronome": {
|
|
@@ -5835,21 +5827,21 @@ function serializeDirectionType(dirType, indent) {
|
|
|
5835
5827
|
if (dirType.defaultY !== void 0) metAttrs += ` default-y="${dirType.defaultY}"`;
|
|
5836
5828
|
if (dirType.fontFamily) metAttrs += ` font-family="${escapeXml(dirType.fontFamily)}"`;
|
|
5837
5829
|
if (dirType.fontSize) metAttrs += ` font-size="${escapeXml(dirType.fontSize)}"`;
|
|
5838
|
-
|
|
5839
|
-
|
|
5830
|
+
out.push(`${indent} <metronome${metAttrs}>`);
|
|
5831
|
+
out.push(`${indent} <beat-unit>${dirType.beatUnit}</beat-unit>`);
|
|
5840
5832
|
if (dirType.beatUnitDot) {
|
|
5841
|
-
|
|
5833
|
+
out.push(`${indent} <beat-unit-dot/>`);
|
|
5842
5834
|
}
|
|
5843
5835
|
if (dirType.beatUnit2) {
|
|
5844
|
-
|
|
5836
|
+
out.push(`${indent} <beat-unit>${dirType.beatUnit2}</beat-unit>`);
|
|
5845
5837
|
if (dirType.beatUnitDot2) {
|
|
5846
|
-
|
|
5838
|
+
out.push(`${indent} <beat-unit-dot/>`);
|
|
5847
5839
|
}
|
|
5848
5840
|
}
|
|
5849
5841
|
if (dirType.perMinute !== void 0) {
|
|
5850
|
-
|
|
5842
|
+
out.push(`${indent} <per-minute>${dirType.perMinute}</per-minute>`);
|
|
5851
5843
|
}
|
|
5852
|
-
|
|
5844
|
+
out.push(`${indent} </metronome>`);
|
|
5853
5845
|
break;
|
|
5854
5846
|
}
|
|
5855
5847
|
case "words": {
|
|
@@ -5867,7 +5859,7 @@ function serializeDirectionType(dirType, indent) {
|
|
|
5867
5859
|
if (dirType.color) wordAttrs += ` color="${escapeXml(dirType.color)}"`;
|
|
5868
5860
|
if (dirType.xmlSpace) wordAttrs += ` xml:space="${escapeXml(dirType.xmlSpace)}"`;
|
|
5869
5861
|
if (dirType.halign) wordAttrs += ` halign="${escapeXml(dirType.halign)}"`;
|
|
5870
|
-
|
|
5862
|
+
out.push(`${indent} <words${wordAttrs}>${escapeXml(dirType.text)}</words>`);
|
|
5871
5863
|
break;
|
|
5872
5864
|
}
|
|
5873
5865
|
case "rehearsal": {
|
|
@@ -5877,7 +5869,7 @@ function serializeDirectionType(dirType, indent) {
|
|
|
5877
5869
|
if (dirType.defaultY !== void 0) rehAttrs += ` default-y="${dirType.defaultY}"`;
|
|
5878
5870
|
if (dirType.fontSize) rehAttrs += ` font-size="${escapeXml(dirType.fontSize)}"`;
|
|
5879
5871
|
if (dirType.fontWeight) rehAttrs += ` font-weight="${escapeXml(dirType.fontWeight)}"`;
|
|
5880
|
-
|
|
5872
|
+
out.push(`${indent} <rehearsal${rehAttrs}>${escapeXml(dirType.text)}</rehearsal>`);
|
|
5881
5873
|
break;
|
|
5882
5874
|
}
|
|
5883
5875
|
case "bracket": {
|
|
@@ -5887,7 +5879,7 @@ function serializeDirectionType(dirType, indent) {
|
|
|
5887
5879
|
if (dirType.lineType) bracketAttrs += ` line-type="${dirType.lineType}"`;
|
|
5888
5880
|
if (dirType.defaultY !== void 0) bracketAttrs += ` default-y="${dirType.defaultY}"`;
|
|
5889
5881
|
if (dirType.relativeX !== void 0) bracketAttrs += ` relative-x="${dirType.relativeX}"`;
|
|
5890
|
-
|
|
5882
|
+
out.push(`${indent} <bracket${bracketAttrs}/>`);
|
|
5891
5883
|
break;
|
|
5892
5884
|
}
|
|
5893
5885
|
case "dashes": {
|
|
@@ -5896,25 +5888,25 @@ function serializeDirectionType(dirType, indent) {
|
|
|
5896
5888
|
if (dirType.dashLength !== void 0) dashAttrs += ` dash-length="${dirType.dashLength}"`;
|
|
5897
5889
|
if (dirType.defaultY !== void 0) dashAttrs += ` default-y="${dirType.defaultY}"`;
|
|
5898
5890
|
if (dirType.spaceLength !== void 0) dashAttrs += ` space-length="${dirType.spaceLength}"`;
|
|
5899
|
-
|
|
5891
|
+
out.push(`${indent} <dashes${dashAttrs}/>`);
|
|
5900
5892
|
break;
|
|
5901
5893
|
}
|
|
5902
5894
|
case "accordion-registration":
|
|
5903
|
-
|
|
5895
|
+
out.push(`${indent} <accordion-registration>`);
|
|
5904
5896
|
if (dirType.high) {
|
|
5905
|
-
|
|
5897
|
+
out.push(`${indent} <accordion-high/>`);
|
|
5906
5898
|
}
|
|
5907
5899
|
if (dirType.middlePresent || dirType.middle !== void 0) {
|
|
5908
5900
|
if (dirType.middle !== void 0) {
|
|
5909
|
-
|
|
5901
|
+
out.push(`${indent} <accordion-middle>${dirType.middle}</accordion-middle>`);
|
|
5910
5902
|
} else {
|
|
5911
|
-
|
|
5903
|
+
out.push(`${indent} <accordion-middle/>`);
|
|
5912
5904
|
}
|
|
5913
5905
|
}
|
|
5914
5906
|
if (dirType.low) {
|
|
5915
|
-
|
|
5907
|
+
out.push(`${indent} <accordion-low/>`);
|
|
5916
5908
|
}
|
|
5917
|
-
|
|
5909
|
+
out.push(`${indent} </accordion-registration>`);
|
|
5918
5910
|
break;
|
|
5919
5911
|
case "other-direction":
|
|
5920
5912
|
{
|
|
@@ -5923,60 +5915,60 @@ function serializeDirectionType(dirType, indent) {
|
|
|
5923
5915
|
if (dirType.defaultY !== void 0) otherAttrs += ` default-y="${dirType.defaultY}"`;
|
|
5924
5916
|
if (dirType.halign) otherAttrs += ` halign="${escapeXml(dirType.halign)}"`;
|
|
5925
5917
|
if (dirType.printObject === false) otherAttrs += ' print-object="no"';
|
|
5926
|
-
|
|
5918
|
+
out.push(`${indent} <other-direction${otherAttrs}>${escapeXml(dirType.text)}</other-direction>`);
|
|
5927
5919
|
}
|
|
5928
5920
|
break;
|
|
5929
5921
|
case "segno":
|
|
5930
|
-
|
|
5922
|
+
out.push(`${indent} <segno/>`);
|
|
5931
5923
|
break;
|
|
5932
5924
|
case "coda":
|
|
5933
|
-
|
|
5925
|
+
out.push(`${indent} <coda/>`);
|
|
5934
5926
|
break;
|
|
5935
5927
|
case "eyeglasses":
|
|
5936
|
-
|
|
5928
|
+
out.push(`${indent} <eyeglasses/>`);
|
|
5937
5929
|
break;
|
|
5938
5930
|
case "damp":
|
|
5939
|
-
|
|
5931
|
+
out.push(`${indent} <damp/>`);
|
|
5940
5932
|
break;
|
|
5941
5933
|
case "damp-all":
|
|
5942
|
-
|
|
5934
|
+
out.push(`${indent} <damp-all/>`);
|
|
5943
5935
|
break;
|
|
5944
5936
|
case "scordatura":
|
|
5945
5937
|
if (dirType.accords && dirType.accords.length > 0) {
|
|
5946
|
-
|
|
5938
|
+
out.push(`${indent} <scordatura>`);
|
|
5947
5939
|
for (const accord of dirType.accords) {
|
|
5948
|
-
|
|
5949
|
-
|
|
5940
|
+
out.push(`${indent} <accord string="${accord.string}">`);
|
|
5941
|
+
out.push(`${indent} <tuning-step>${accord.tuningStep}</tuning-step>`);
|
|
5950
5942
|
if (accord.tuningAlter !== void 0) {
|
|
5951
|
-
|
|
5943
|
+
out.push(`${indent} <tuning-alter>${accord.tuningAlter}</tuning-alter>`);
|
|
5952
5944
|
}
|
|
5953
|
-
|
|
5954
|
-
|
|
5945
|
+
out.push(`${indent} <tuning-octave>${accord.tuningOctave}</tuning-octave>`);
|
|
5946
|
+
out.push(`${indent} </accord>`);
|
|
5955
5947
|
}
|
|
5956
|
-
|
|
5948
|
+
out.push(`${indent} </scordatura>`);
|
|
5957
5949
|
} else {
|
|
5958
|
-
|
|
5950
|
+
out.push(`${indent} <scordatura/>`);
|
|
5959
5951
|
}
|
|
5960
5952
|
break;
|
|
5961
5953
|
case "harp-pedals":
|
|
5962
5954
|
if (dirType.pedalTunings && dirType.pedalTunings.length > 0) {
|
|
5963
|
-
|
|
5955
|
+
out.push(`${indent} <harp-pedals>`);
|
|
5964
5956
|
for (const pt of dirType.pedalTunings) {
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5957
|
+
out.push(`${indent} <pedal-tuning>`);
|
|
5958
|
+
out.push(`${indent} <pedal-step>${pt.pedalStep}</pedal-step>`);
|
|
5959
|
+
out.push(`${indent} <pedal-alter>${pt.pedalAlter}</pedal-alter>`);
|
|
5960
|
+
out.push(`${indent} </pedal-tuning>`);
|
|
5969
5961
|
}
|
|
5970
|
-
|
|
5962
|
+
out.push(`${indent} </harp-pedals>`);
|
|
5971
5963
|
} else {
|
|
5972
|
-
|
|
5964
|
+
out.push(`${indent} <harp-pedals/>`);
|
|
5973
5965
|
}
|
|
5974
5966
|
break;
|
|
5975
5967
|
case "image":
|
|
5976
5968
|
let imgAttrs = "";
|
|
5977
5969
|
if (dirType.source) imgAttrs += ` source="${escapeXml(dirType.source)}"`;
|
|
5978
5970
|
if (dirType.type) imgAttrs += ` type="${escapeXml(dirType.type)}"`;
|
|
5979
|
-
|
|
5971
|
+
out.push(`${indent} <image${imgAttrs}/>`);
|
|
5980
5972
|
break;
|
|
5981
5973
|
case "pedal": {
|
|
5982
5974
|
let pedalAttrs = ` type="${dirType.type}"`;
|
|
@@ -5984,68 +5976,76 @@ function serializeDirectionType(dirType, indent) {
|
|
|
5984
5976
|
if (dirType.defaultY !== void 0) pedalAttrs += ` default-y="${dirType.defaultY}"`;
|
|
5985
5977
|
if (dirType.relativeX !== void 0) pedalAttrs += ` relative-x="${dirType.relativeX}"`;
|
|
5986
5978
|
if (dirType.halign) pedalAttrs += ` halign="${dirType.halign}"`;
|
|
5987
|
-
|
|
5979
|
+
out.push(`${indent} <pedal${pedalAttrs}/>`);
|
|
5988
5980
|
break;
|
|
5989
5981
|
}
|
|
5990
5982
|
case "octave-shift": {
|
|
5991
5983
|
const sizeAttr = dirType.size !== void 0 ? ` size="${dirType.size}"` : "";
|
|
5992
|
-
|
|
5984
|
+
out.push(`${indent} <octave-shift type="${dirType.type}"${sizeAttr}/>`);
|
|
5993
5985
|
break;
|
|
5994
5986
|
}
|
|
5995
5987
|
case "swing":
|
|
5996
|
-
|
|
5988
|
+
out.push(`${indent} <swing>`);
|
|
5997
5989
|
if (dirType.straight) {
|
|
5998
|
-
|
|
5990
|
+
out.push(`${indent} <straight/>`);
|
|
5999
5991
|
} else {
|
|
6000
5992
|
if (dirType.first !== void 0) {
|
|
6001
|
-
|
|
5993
|
+
out.push(`${indent} <first>${dirType.first}</first>`);
|
|
6002
5994
|
}
|
|
6003
5995
|
if (dirType.second !== void 0) {
|
|
6004
|
-
|
|
5996
|
+
out.push(`${indent} <second>${dirType.second}</second>`);
|
|
6005
5997
|
}
|
|
6006
5998
|
if (dirType.swingType) {
|
|
6007
|
-
|
|
5999
|
+
out.push(`${indent} <swing-type>${dirType.swingType}</swing-type>`);
|
|
6008
6000
|
}
|
|
6009
6001
|
}
|
|
6010
|
-
|
|
6002
|
+
out.push(`${indent} </swing>`);
|
|
6011
6003
|
break;
|
|
6012
6004
|
}
|
|
6013
|
-
|
|
6014
|
-
return lines;
|
|
6005
|
+
out.push(`${indent}</direction-type>`);
|
|
6015
6006
|
}
|
|
6016
|
-
function serializeBarline(barline, indent) {
|
|
6017
|
-
const lines = [];
|
|
6007
|
+
function serializeBarline(barline, indent, out) {
|
|
6018
6008
|
let attrs = ` location="${barline.location}"`;
|
|
6019
6009
|
if (barline._id) attrs += ` id="${escapeXml(barline._id)}"`;
|
|
6020
|
-
|
|
6010
|
+
out.push(`${indent}<barline${attrs}>`);
|
|
6021
6011
|
if (barline.barStyle) {
|
|
6022
|
-
|
|
6012
|
+
out.push(`${indent} <bar-style>${barline.barStyle}</bar-style>`);
|
|
6023
6013
|
}
|
|
6024
6014
|
if (barline.ending) {
|
|
6025
6015
|
let endingAttrs = ` number="${barline.ending.number}" type="${barline.ending.type}"`;
|
|
6026
6016
|
if (barline.ending.defaultY !== void 0) endingAttrs += ` default-y="${barline.ending.defaultY}"`;
|
|
6027
6017
|
if (barline.ending.endLength !== void 0) endingAttrs += ` end-length="${barline.ending.endLength}"`;
|
|
6028
6018
|
if (barline.ending.text) {
|
|
6029
|
-
|
|
6019
|
+
out.push(`${indent} <ending${endingAttrs}>${escapeXml(barline.ending.text)}</ending>`);
|
|
6030
6020
|
} else {
|
|
6031
|
-
|
|
6021
|
+
out.push(`${indent} <ending${endingAttrs}/>`);
|
|
6032
6022
|
}
|
|
6033
6023
|
}
|
|
6034
6024
|
if (barline.repeat) {
|
|
6035
6025
|
let repeatAttrs = ` direction="${barline.repeat.direction}"`;
|
|
6036
6026
|
if (barline.repeat.times !== void 0) repeatAttrs += ` times="${barline.repeat.times}"`;
|
|
6037
6027
|
if (barline.repeat.winged) repeatAttrs += ` winged="${barline.repeat.winged}"`;
|
|
6038
|
-
|
|
6028
|
+
out.push(`${indent} <repeat${repeatAttrs}/>`);
|
|
6039
6029
|
}
|
|
6040
|
-
|
|
6041
|
-
return lines;
|
|
6030
|
+
out.push(`${indent}</barline>`);
|
|
6042
6031
|
}
|
|
6032
|
+
var XML_ESCAPE_RE = /[&<>"']/g;
|
|
6033
|
+
var XML_ESCAPE_MAP = {
|
|
6034
|
+
"&": "&",
|
|
6035
|
+
"<": "<",
|
|
6036
|
+
">": ">",
|
|
6037
|
+
'"': """,
|
|
6038
|
+
"'": "'"
|
|
6039
|
+
};
|
|
6040
|
+
var XML_ESCAPE_TEST = /[&<>"']/;
|
|
6043
6041
|
function escapeXml(str) {
|
|
6044
|
-
|
|
6042
|
+
if (!XML_ESCAPE_TEST.test(str)) return str;
|
|
6043
|
+
return str.replace(XML_ESCAPE_RE, (ch) => XML_ESCAPE_MAP[ch]);
|
|
6045
6044
|
}
|
|
6046
6045
|
function buildAttrs(attrs) {
|
|
6047
6046
|
let result = "";
|
|
6048
|
-
for (const
|
|
6047
|
+
for (const key in attrs) {
|
|
6048
|
+
const value = attrs[key];
|
|
6049
6049
|
if (value === void 0) continue;
|
|
6050
6050
|
if (typeof value === "boolean") {
|
|
6051
6051
|
result += ` ${key}="${value ? "yes" : "no"}"`;
|
|
@@ -6063,48 +6063,45 @@ function pushOptionalElement(lines, indent, tag, value) {
|
|
|
6063
6063
|
lines.push(`${indent}<${tag}>${escaped}</${tag}>`);
|
|
6064
6064
|
}
|
|
6065
6065
|
}
|
|
6066
|
-
function serializeStaffDetails(sd, indent) {
|
|
6067
|
-
const lines = [];
|
|
6066
|
+
function serializeStaffDetails(sd, indent, out) {
|
|
6068
6067
|
const attrs = buildAttrs({
|
|
6069
6068
|
"number": sd.number,
|
|
6070
6069
|
"show-frets": sd.showFrets,
|
|
6071
6070
|
"print-object": sd.printObject,
|
|
6072
6071
|
"print-spacing": sd.printSpacing
|
|
6073
6072
|
});
|
|
6074
|
-
|
|
6075
|
-
pushOptionalElement(
|
|
6076
|
-
pushOptionalElement(
|
|
6073
|
+
out.push(`${indent}<staff-details${attrs}>`);
|
|
6074
|
+
pushOptionalElement(out, `${indent} `, "staff-type", sd.staffType);
|
|
6075
|
+
pushOptionalElement(out, `${indent} `, "staff-lines", sd.staffLines);
|
|
6077
6076
|
if (sd.staffTuning) {
|
|
6078
6077
|
for (const tuning of sd.staffTuning) {
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
pushOptionalElement(
|
|
6082
|
-
|
|
6083
|
-
|
|
6078
|
+
out.push(`${indent} <staff-tuning${buildAttrs({ line: tuning.line })}>`);
|
|
6079
|
+
out.push(`${indent} <tuning-step>${tuning.tuningStep}</tuning-step>`);
|
|
6080
|
+
pushOptionalElement(out, `${indent} `, "tuning-alter", tuning.tuningAlter);
|
|
6081
|
+
out.push(`${indent} <tuning-octave>${tuning.tuningOctave}</tuning-octave>`);
|
|
6082
|
+
out.push(`${indent} </staff-tuning>`);
|
|
6084
6083
|
}
|
|
6085
6084
|
}
|
|
6086
|
-
pushOptionalElement(
|
|
6085
|
+
pushOptionalElement(out, `${indent} `, "capo", sd.capo);
|
|
6087
6086
|
if (sd.staffSize !== void 0) {
|
|
6088
6087
|
const attrs2 = buildAttrs({ scaling: sd.staffSizeScaling });
|
|
6089
|
-
|
|
6088
|
+
out.push(`${indent} <staff-size${attrs2}>${sd.staffSize}</staff-size>`);
|
|
6090
6089
|
}
|
|
6091
|
-
|
|
6092
|
-
return lines;
|
|
6090
|
+
out.push(`${indent}</staff-details>`);
|
|
6093
6091
|
}
|
|
6094
|
-
function serializeMeasureStyle(ms, indent) {
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
pushOptionalElement(lines, `${indent} `, "multiple-rest", ms.multipleRest);
|
|
6092
|
+
function serializeMeasureStyle(ms, indent, out) {
|
|
6093
|
+
out.push(`${indent}<measure-style${buildAttrs({ number: ms.number })}>`);
|
|
6094
|
+
pushOptionalElement(out, `${indent} `, "multiple-rest", ms.multipleRest);
|
|
6098
6095
|
if (ms.measureRepeat) {
|
|
6099
6096
|
const mrAttrs = buildAttrs({
|
|
6100
6097
|
type: ms.measureRepeat.type,
|
|
6101
6098
|
slashes: ms.measureRepeat.slashes
|
|
6102
6099
|
});
|
|
6103
|
-
|
|
6100
|
+
out.push(`${indent} <measure-repeat${mrAttrs}/>`);
|
|
6104
6101
|
}
|
|
6105
6102
|
if (ms.beatRepeat) {
|
|
6106
6103
|
const brAttrs = buildAttrs({ type: ms.beatRepeat.type, slashes: ms.beatRepeat.slashes });
|
|
6107
|
-
|
|
6104
|
+
out.push(`${indent} <beat-repeat${brAttrs}/>`);
|
|
6108
6105
|
}
|
|
6109
6106
|
if (ms.slash) {
|
|
6110
6107
|
const slAttrs = buildAttrs({
|
|
@@ -6112,13 +6109,11 @@ function serializeMeasureStyle(ms, indent) {
|
|
|
6112
6109
|
"use-dots": ms.slash.useDots,
|
|
6113
6110
|
"use-stems": ms.slash.useStems
|
|
6114
6111
|
});
|
|
6115
|
-
|
|
6112
|
+
out.push(`${indent} <slash${slAttrs}/>`);
|
|
6116
6113
|
}
|
|
6117
|
-
|
|
6118
|
-
return lines;
|
|
6114
|
+
out.push(`${indent}</measure-style>`);
|
|
6119
6115
|
}
|
|
6120
|
-
function serializeHarmony(harmony, indent) {
|
|
6121
|
-
const lines = [];
|
|
6116
|
+
function serializeHarmony(harmony, indent, out) {
|
|
6122
6117
|
const attrs = buildAttrs({
|
|
6123
6118
|
id: harmony._id,
|
|
6124
6119
|
placement: harmony.placement,
|
|
@@ -6127,114 +6122,110 @@ function serializeHarmony(harmony, indent) {
|
|
|
6127
6122
|
halign: harmony.halign,
|
|
6128
6123
|
"font-size": harmony.fontSize
|
|
6129
6124
|
});
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6125
|
+
out.push(`${indent}<harmony${attrs}>`);
|
|
6126
|
+
out.push(`${indent} <root>`);
|
|
6127
|
+
out.push(`${indent} <root-step>${harmony.root.rootStep}</root-step>`);
|
|
6133
6128
|
if (harmony.root.rootAlter !== void 0) {
|
|
6134
|
-
|
|
6129
|
+
out.push(`${indent} <root-alter>${harmony.root.rootAlter}</root-alter>`);
|
|
6135
6130
|
}
|
|
6136
|
-
|
|
6131
|
+
out.push(`${indent} </root>`);
|
|
6137
6132
|
let kindAttrs = "";
|
|
6138
6133
|
if (harmony.kindText !== void 0) kindAttrs += ` text="${escapeXml(harmony.kindText)}"`;
|
|
6139
6134
|
if (harmony.kindHalign) kindAttrs += ` halign="${escapeXml(harmony.kindHalign)}"`;
|
|
6140
|
-
|
|
6135
|
+
out.push(`${indent} <kind${kindAttrs}>${escapeXml(harmony.kind)}</kind>`);
|
|
6141
6136
|
if (harmony.bass) {
|
|
6142
6137
|
let bassAttrs = "";
|
|
6143
6138
|
if (harmony.bass.arrangement) bassAttrs += ` arrangement="${escapeXml(harmony.bass.arrangement)}"`;
|
|
6144
|
-
|
|
6145
|
-
|
|
6139
|
+
out.push(`${indent} <bass${bassAttrs}>`);
|
|
6140
|
+
out.push(`${indent} <bass-step>${harmony.bass.bassStep}</bass-step>`);
|
|
6146
6141
|
if (harmony.bass.bassAlter !== void 0) {
|
|
6147
|
-
|
|
6142
|
+
out.push(`${indent} <bass-alter>${harmony.bass.bassAlter}</bass-alter>`);
|
|
6148
6143
|
}
|
|
6149
|
-
|
|
6144
|
+
out.push(`${indent} </bass>`);
|
|
6150
6145
|
}
|
|
6151
6146
|
if (harmony.inversion !== void 0) {
|
|
6152
|
-
|
|
6147
|
+
out.push(`${indent} <inversion>${harmony.inversion}</inversion>`);
|
|
6153
6148
|
}
|
|
6154
6149
|
if (harmony.degrees) {
|
|
6155
6150
|
for (const deg of harmony.degrees) {
|
|
6156
|
-
|
|
6157
|
-
|
|
6151
|
+
out.push(`${indent} <degree>`);
|
|
6152
|
+
out.push(`${indent} <degree-value>${deg.degreeValue}</degree-value>`);
|
|
6158
6153
|
if (deg.degreeAlter !== void 0) {
|
|
6159
|
-
|
|
6154
|
+
out.push(`${indent} <degree-alter>${deg.degreeAlter}</degree-alter>`);
|
|
6160
6155
|
}
|
|
6161
|
-
|
|
6162
|
-
|
|
6156
|
+
out.push(`${indent} <degree-type>${deg.degreeType}</degree-type>`);
|
|
6157
|
+
out.push(`${indent} </degree>`);
|
|
6163
6158
|
}
|
|
6164
6159
|
}
|
|
6165
6160
|
if (harmony.frame) {
|
|
6166
|
-
|
|
6161
|
+
out.push(`${indent} <frame>`);
|
|
6167
6162
|
if (harmony.frame.frameStrings !== void 0) {
|
|
6168
|
-
|
|
6163
|
+
out.push(`${indent} <frame-strings>${harmony.frame.frameStrings}</frame-strings>`);
|
|
6169
6164
|
}
|
|
6170
6165
|
if (harmony.frame.frameFrets !== void 0) {
|
|
6171
|
-
|
|
6166
|
+
out.push(`${indent} <frame-frets>${harmony.frame.frameFrets}</frame-frets>`);
|
|
6172
6167
|
}
|
|
6173
6168
|
if (harmony.frame.firstFret !== void 0) {
|
|
6174
6169
|
let ffAttrs = "";
|
|
6175
6170
|
if (harmony.frame.firstFretText) ffAttrs += ` text="${escapeXml(harmony.frame.firstFretText)}"`;
|
|
6176
6171
|
if (harmony.frame.firstFretLocation) ffAttrs += ` location="${harmony.frame.firstFretLocation}"`;
|
|
6177
|
-
|
|
6172
|
+
out.push(`${indent} <first-fret${ffAttrs}>${harmony.frame.firstFret}</first-fret>`);
|
|
6178
6173
|
}
|
|
6179
6174
|
if (harmony.frame.frameNotes) {
|
|
6180
6175
|
for (const fn of harmony.frame.frameNotes) {
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6176
|
+
out.push(`${indent} <frame-note>`);
|
|
6177
|
+
out.push(`${indent} <string>${fn.string}</string>`);
|
|
6178
|
+
out.push(`${indent} <fret>${fn.fret}</fret>`);
|
|
6184
6179
|
if (fn.fingering) {
|
|
6185
|
-
|
|
6180
|
+
out.push(`${indent} <fingering>${escapeXml(fn.fingering)}</fingering>`);
|
|
6186
6181
|
}
|
|
6187
6182
|
if (fn.barre) {
|
|
6188
|
-
|
|
6183
|
+
out.push(`${indent} <barre type="${fn.barre}"/>`);
|
|
6189
6184
|
}
|
|
6190
|
-
|
|
6185
|
+
out.push(`${indent} </frame-note>`);
|
|
6191
6186
|
}
|
|
6192
6187
|
}
|
|
6193
|
-
|
|
6188
|
+
out.push(`${indent} </frame>`);
|
|
6194
6189
|
}
|
|
6195
6190
|
if (harmony.offset !== void 0) {
|
|
6196
|
-
|
|
6191
|
+
out.push(`${indent} <offset>${harmony.offset}</offset>`);
|
|
6197
6192
|
}
|
|
6198
6193
|
if (harmony.staff !== void 0) {
|
|
6199
|
-
|
|
6194
|
+
out.push(`${indent} <staff>${harmony.staff}</staff>`);
|
|
6200
6195
|
}
|
|
6201
|
-
|
|
6202
|
-
return lines;
|
|
6196
|
+
out.push(`${indent}</harmony>`);
|
|
6203
6197
|
}
|
|
6204
|
-
function serializeFiguredBass(fb, indent) {
|
|
6205
|
-
const lines = [];
|
|
6198
|
+
function serializeFiguredBass(fb, indent, out) {
|
|
6206
6199
|
let attrs = "";
|
|
6207
6200
|
if (fb._id) attrs += ` id="${escapeXml(fb._id)}"`;
|
|
6208
6201
|
if (fb.parentheses) attrs += ' parentheses="yes"';
|
|
6209
|
-
|
|
6202
|
+
out.push(`${indent}<figured-bass${attrs}>`);
|
|
6210
6203
|
for (const fig of fb.figures) {
|
|
6211
|
-
|
|
6204
|
+
out.push(`${indent} <figure>`);
|
|
6212
6205
|
if (fig.prefix) {
|
|
6213
|
-
|
|
6206
|
+
out.push(`${indent} <prefix>${escapeXml(fig.prefix)}</prefix>`);
|
|
6214
6207
|
}
|
|
6215
6208
|
if (fig.figureNumber) {
|
|
6216
|
-
|
|
6209
|
+
out.push(`${indent} <figure-number>${escapeXml(fig.figureNumber)}</figure-number>`);
|
|
6217
6210
|
}
|
|
6218
6211
|
if (fig.suffix) {
|
|
6219
|
-
|
|
6212
|
+
out.push(`${indent} <suffix>${escapeXml(fig.suffix)}</suffix>`);
|
|
6220
6213
|
}
|
|
6221
6214
|
if (fig.extend) {
|
|
6222
6215
|
if (typeof fig.extend === "object" && fig.extend.type) {
|
|
6223
|
-
|
|
6216
|
+
out.push(`${indent} <extend type="${fig.extend.type}"/>`);
|
|
6224
6217
|
} else {
|
|
6225
|
-
|
|
6218
|
+
out.push(`${indent} <extend/>`);
|
|
6226
6219
|
}
|
|
6227
6220
|
}
|
|
6228
|
-
|
|
6221
|
+
out.push(`${indent} </figure>`);
|
|
6229
6222
|
}
|
|
6230
6223
|
if (fb.duration !== void 0) {
|
|
6231
|
-
|
|
6224
|
+
out.push(`${indent} <duration>${fb.duration}</duration>`);
|
|
6232
6225
|
}
|
|
6233
|
-
|
|
6234
|
-
return lines;
|
|
6226
|
+
out.push(`${indent}</figured-bass>`);
|
|
6235
6227
|
}
|
|
6236
|
-
function serializeSound(sound, indent) {
|
|
6237
|
-
const lines = [];
|
|
6228
|
+
function serializeSound(sound, indent, out) {
|
|
6238
6229
|
const attrs = [];
|
|
6239
6230
|
if (sound._id) attrs.push(`id="${escapeXml(sound._id)}"`);
|
|
6240
6231
|
if (sound.tempo !== void 0) attrs.push(`tempo="${sound.tempo}"`);
|
|
@@ -6251,29 +6242,28 @@ function serializeSound(sound, indent) {
|
|
|
6251
6242
|
if (sound.sostenutoPedal) attrs.push(`sostenuto-pedal="${sound.sostenutoPedal === true ? "yes" : sound.sostenutoPedal}"`);
|
|
6252
6243
|
const attrStr = attrs.length > 0 ? ` ${attrs.join(" ")}` : "";
|
|
6253
6244
|
if (sound.swing) {
|
|
6254
|
-
|
|
6255
|
-
|
|
6245
|
+
out.push(`${indent}<sound${attrStr}>`);
|
|
6246
|
+
out.push(`${indent} <swing>`);
|
|
6256
6247
|
if (sound.swing.straight) {
|
|
6257
|
-
|
|
6248
|
+
out.push(`${indent} <straight/>`);
|
|
6258
6249
|
} else {
|
|
6259
6250
|
if (sound.swing.first !== void 0) {
|
|
6260
|
-
|
|
6251
|
+
out.push(`${indent} <first>${sound.swing.first}</first>`);
|
|
6261
6252
|
}
|
|
6262
6253
|
if (sound.swing.second !== void 0) {
|
|
6263
|
-
|
|
6254
|
+
out.push(`${indent} <second>${sound.swing.second}</second>`);
|
|
6264
6255
|
}
|
|
6265
6256
|
if (sound.swing.swingType) {
|
|
6266
|
-
|
|
6257
|
+
out.push(`${indent} <swing-type>${sound.swing.swingType}</swing-type>`);
|
|
6267
6258
|
}
|
|
6268
6259
|
}
|
|
6269
|
-
|
|
6270
|
-
|
|
6260
|
+
out.push(`${indent} </swing>`);
|
|
6261
|
+
out.push(`${indent}</sound>`);
|
|
6271
6262
|
} else if (attrs.length === 0 && !sound._id) {
|
|
6272
|
-
|
|
6263
|
+
out.push(`${indent}<sound/>`);
|
|
6273
6264
|
} else {
|
|
6274
|
-
|
|
6265
|
+
out.push(`${indent}<sound${attrStr}/>`);
|
|
6275
6266
|
}
|
|
6276
|
-
return lines;
|
|
6277
6267
|
}
|
|
6278
6268
|
|
|
6279
6269
|
// src/exporters/musicxml-compressed.ts
|
|
@@ -8159,4 +8149,4 @@ async function serializeToFile(score, filePath, options = {}) {
|
|
|
8159
8149
|
|
|
8160
8150
|
|
|
8161
8151
|
|
|
8162
|
-
exports.STEPS = _chunkVE2KCZMAjs.STEPS; exports.STEP_SEMITONES = _chunkVE2KCZMAjs.STEP_SEMITONES; exports.ValidationException = _chunkKABVHR2Pjs.ValidationException; exports.addArticulation = _chunkKABVHR2Pjs.addArticulation; exports.addBeam = _chunkKABVHR2Pjs.addBeam; exports.addBowing = _chunkKABVHR2Pjs.addBowing; exports.addBreathMark = _chunkKABVHR2Pjs.addBreathMark; exports.addCaesura = _chunkKABVHR2Pjs.addCaesura; exports.addChord = _chunkKABVHR2Pjs.addChord; exports.addChordNote = _chunkKABVHR2Pjs.addChordNote; exports.addChordNoteChecked = _chunkKABVHR2Pjs.addChordNoteChecked; exports.addChordSymbol = _chunkKABVHR2Pjs.addChordSymbol; exports.addCoda = _chunkKABVHR2Pjs.addCoda; exports.addDaCapo = _chunkKABVHR2Pjs.addDaCapo; exports.addDalSegno = _chunkKABVHR2Pjs.addDalSegno; exports.addDynamics = _chunkKABVHR2Pjs.addDynamics; exports.addEnding = _chunkKABVHR2Pjs.addEnding; exports.addFermata = _chunkKABVHR2Pjs.addFermata; exports.addFine = _chunkKABVHR2Pjs.addFine; exports.addFingering = _chunkKABVHR2Pjs.addFingering; exports.addGraceNote = _chunkKABVHR2Pjs.addGraceNote; exports.addHarmony = _chunkKABVHR2Pjs.addHarmony; exports.addLyric = _chunkKABVHR2Pjs.addLyric; exports.addNote = _chunkKABVHR2Pjs.addNote; exports.addNoteChecked = _chunkKABVHR2Pjs.addNoteChecked; exports.addOctaveShift = _chunkKABVHR2Pjs.addOctaveShift; exports.addOrnament = _chunkKABVHR2Pjs.addOrnament; exports.addPart = _chunkKABVHR2Pjs.addPart; exports.addPedal = _chunkKABVHR2Pjs.addPedal; exports.addRehearsalMark = _chunkKABVHR2Pjs.addRehearsalMark; exports.addRepeat = _chunkKABVHR2Pjs.addRepeat; exports.addRepeatBarline = _chunkKABVHR2Pjs.addRepeatBarline; exports.addSegno = _chunkKABVHR2Pjs.addSegno; exports.addSlur = _chunkKABVHR2Pjs.addSlur; exports.addStringNumber = _chunkKABVHR2Pjs.addStringNumber; exports.addTempo = _chunkKABVHR2Pjs.addTempo; exports.addText = _chunkKABVHR2Pjs.addText; exports.addTextDirection = _chunkKABVHR2Pjs.addTextDirection; exports.addTie = _chunkKABVHR2Pjs.addTie; exports.addToCoda = _chunkKABVHR2Pjs.addToCoda; exports.addVoice = _chunkKABVHR2Pjs.addVoice; exports.addWedge = _chunkKABVHR2Pjs.addWedge; exports.assertMeasureValid = _chunkKABVHR2Pjs.assertMeasureValid; exports.assertValid = _chunkKABVHR2Pjs.assertValid; exports.autoBeam = _chunkKABVHR2Pjs.autoBeam; exports.buildVoiceToStaffMap = _chunkVE2KCZMAjs.buildVoiceToStaffMap; exports.buildVoiceToStaffMapForPart = _chunkVE2KCZMAjs.buildVoiceToStaffMapForPart; exports.changeBarline = _chunkKABVHR2Pjs.changeBarline; exports.changeClef = _chunkKABVHR2Pjs.changeClef; exports.changeKey = _chunkKABVHR2Pjs.changeKey; exports.changeNoteDuration = _chunkKABVHR2Pjs.changeNoteDuration; exports.changeTime = _chunkKABVHR2Pjs.changeTime; exports.convertToGrace = _chunkKABVHR2Pjs.convertToGrace; exports.copyNotes = _chunkKABVHR2Pjs.copyNotes; exports.copyNotesMultiMeasure = _chunkKABVHR2Pjs.copyNotesMultiMeasure; exports.countNotes = _chunkVE2KCZMAjs.countNotes; exports.createTuplet = _chunkKABVHR2Pjs.createTuplet; exports.cutNotes = _chunkKABVHR2Pjs.cutNotes; exports.decodeBuffer = decodeBuffer; exports.deleteMeasure = _chunkKABVHR2Pjs.deleteMeasure; exports.deleteNote = _chunkKABVHR2Pjs.deleteNote; exports.deleteNoteChecked = _chunkKABVHR2Pjs.deleteNoteChecked; exports.duplicatePart = _chunkKABVHR2Pjs.duplicatePart; exports.exportMidi = exportMidi; exports.findBarlines = _chunkVE2KCZMAjs.findBarlines; exports.findDirectionsByType = _chunkVE2KCZMAjs.findDirectionsByType; exports.findNotes = _chunkVE2KCZMAjs.findNotes; exports.findNotesWithNotation = _chunkVE2KCZMAjs.findNotesWithNotation; exports.formatLocation = _chunkKABVHR2Pjs.formatLocation; exports.generateId = _chunkKABVHR2Pjs.generateId; exports.getAbsolutePosition = _chunkVE2KCZMAjs.getAbsolutePosition; exports.getAdjacentNotes = _chunkVE2KCZMAjs.getAdjacentNotes; exports.getAllNotes = _chunkVE2KCZMAjs.getAllNotes; exports.getAllPartInfos = getAllPartInfos; exports.getAttributesAtMeasure = _chunkVE2KCZMAjs.getAttributesAtMeasure; exports.getBeamGroups = _chunkVE2KCZMAjs.getBeamGroups; exports.getChordProgression = _chunkVE2KCZMAjs.getChordProgression; exports.getChords = _chunkVE2KCZMAjs.getChords; exports.getClefChanges = _chunkVE2KCZMAjs.getClefChanges; exports.getClefForStaff = _chunkVE2KCZMAjs.getClefForStaff; exports.getDirectionOfKind = getDirectionOfKind; exports.getDirections = _chunkVE2KCZMAjs.getDirections; exports.getDirectionsAtPosition = _chunkVE2KCZMAjs.getDirectionsAtPosition; exports.getDirectionsOfKind = getDirectionsOfKind; exports.getDivisions = _chunkVE2KCZMAjs.getDivisions; exports.getDuration = _chunkVE2KCZMAjs.getDuration; exports.getDynamics = _chunkVE2KCZMAjs.getDynamics; exports.getEffectiveStaff = _chunkVE2KCZMAjs.getEffectiveStaff; exports.getEndings = _chunkVE2KCZMAjs.getEndings; exports.getEntriesAtPosition = _chunkVE2KCZMAjs.getEntriesAtPosition; exports.getEntriesForStaff = _chunkVE2KCZMAjs.getEntriesForStaff; exports.getEntriesInRange = _chunkVE2KCZMAjs.getEntriesInRange; exports.getHarmonies = _chunkVE2KCZMAjs.getHarmonies; exports.getHarmonyAtPosition = _chunkVE2KCZMAjs.getHarmonyAtPosition; exports.getKeyChanges = _chunkVE2KCZMAjs.getKeyChanges; exports.getLyricText = _chunkVE2KCZMAjs.getLyricText; exports.getLyrics = _chunkVE2KCZMAjs.getLyrics; exports.getMeasure = _chunkVE2KCZMAjs.getMeasure; exports.getMeasureByIndex = _chunkVE2KCZMAjs.getMeasureByIndex; exports.getMeasureContext = _chunkKABVHR2Pjs.getMeasureContext; exports.getMeasureCount = _chunkVE2KCZMAjs.getMeasureCount; exports.getMeasureEndPosition = _chunkVE2KCZMAjs.getMeasureEndPosition; exports.getNextNote = _chunkVE2KCZMAjs.getNextNote; exports.getNormalizedDuration = _chunkVE2KCZMAjs.getNormalizedDuration; exports.getNormalizedPosition = _chunkVE2KCZMAjs.getNormalizedPosition; exports.getNotesAtPosition = _chunkVE2KCZMAjs.getNotesAtPosition; exports.getNotesForStaff = _chunkVE2KCZMAjs.getNotesForStaff; exports.getNotesForVoice = _chunkVE2KCZMAjs.getNotesForVoice; exports.getNotesInRange = _chunkVE2KCZMAjs.getNotesInRange; exports.getOctaveShifts = _chunkVE2KCZMAjs.getOctaveShifts; exports.getPartAbbreviation = getPartAbbreviation; exports.getPartById = _chunkVE2KCZMAjs.getPartById; exports.getPartByIndex = _chunkVE2KCZMAjs.getPartByIndex; exports.getPartCount = _chunkVE2KCZMAjs.getPartCount; exports.getPartIds = _chunkVE2KCZMAjs.getPartIds; exports.getPartIndex = _chunkVE2KCZMAjs.getPartIndex; exports.getPartInfo = getPartInfo; exports.getPartName = getPartName; exports.getPartNameMap = getPartNameMap; exports.getPedalMarkings = _chunkVE2KCZMAjs.getPedalMarkings; exports.getPrevNote = _chunkVE2KCZMAjs.getPrevNote; exports.getRepeatStructure = _chunkVE2KCZMAjs.getRepeatStructure; exports.getSlurSpans = _chunkVE2KCZMAjs.getSlurSpans; exports.getSoundDamperPedal = getSoundDamperPedal; exports.getSoundDynamics = getSoundDynamics; exports.getSoundSoftPedal = getSoundSoftPedal; exports.getSoundSostenutoPedal = getSoundSostenutoPedal; exports.getSoundTempo = getSoundTempo; exports.getStaffRange = _chunkVE2KCZMAjs.getStaffRange; exports.getStaveCount = _chunkVE2KCZMAjs.getStaveCount; exports.getStaves = _chunkVE2KCZMAjs.getStaves; exports.getStructuralChanges = _chunkVE2KCZMAjs.getStructuralChanges; exports.getTempoMarkings = _chunkVE2KCZMAjs.getTempoMarkings; exports.getTiedNoteGroups = _chunkVE2KCZMAjs.getTiedNoteGroups; exports.getTimeChanges = _chunkVE2KCZMAjs.getTimeChanges; exports.getTupletGroups = _chunkVE2KCZMAjs.getTupletGroups; exports.getVerseCount = _chunkVE2KCZMAjs.getVerseCount; exports.getVerticalSlice = _chunkVE2KCZMAjs.getVerticalSlice; exports.getVoiceLine = _chunkVE2KCZMAjs.getVoiceLine; exports.getVoiceLineInRange = _chunkVE2KCZMAjs.getVoiceLineInRange; exports.getVoices = _chunkVE2KCZMAjs.getVoices; exports.getVoicesForStaff = _chunkVE2KCZMAjs.getVoicesForStaff; exports.getWedges = _chunkVE2KCZMAjs.getWedges; exports.groupByStaff = _chunkVE2KCZMAjs.groupByStaff; exports.groupByVoice = _chunkVE2KCZMAjs.groupByVoice; exports.hasBeam = hasBeam; exports.hasDirectionOfKind = hasDirectionOfKind; exports.hasLyrics = hasLyrics; exports.hasMultipleStaves = _chunkVE2KCZMAjs.hasMultipleStaves; exports.hasNotations = hasNotations; exports.hasNotes = _chunkVE2KCZMAjs.hasNotes; exports.hasTie = hasTie; exports.hasTieStart = hasTieStart; exports.hasTieStop = hasTieStop; exports.hasTuplet = hasTuplet; exports.inferStaff = _chunkVE2KCZMAjs.inferStaff; exports.insertClefChange = _chunkKABVHR2Pjs.insertClefChange; exports.insertMeasure = _chunkKABVHR2Pjs.insertMeasure; exports.insertNote = _chunkKABVHR2Pjs.insertNote; exports.isChordNote = isChordNote; exports.isCompressed = isCompressed; exports.isCueNote = isCueNote; exports.isGraceNote = isGraceNote; exports.isPartInfo = isPartInfo; exports.isPitchedNote = isPitchedNote; exports.isRest = isRest; exports.isRestMeasure = _chunkVE2KCZMAjs.isRestMeasure; exports.isUnpitchedNote = isUnpitchedNote; exports.isValid = _chunkKABVHR2Pjs.isValid; exports.iterateEntries = _chunkVE2KCZMAjs.iterateEntries; exports.iterateNotes = _chunkVE2KCZMAjs.iterateNotes; exports.lowerAccidental = _chunkKABVHR2Pjs.lowerAccidental; exports.measureRoundtrip = _chunkVE2KCZMAjs.measureRoundtrip; exports.modifyDynamics = _chunkKABVHR2Pjs.modifyDynamics; exports.modifyNoteDuration = _chunkKABVHR2Pjs.modifyNoteDuration; exports.modifyNoteDurationChecked = _chunkKABVHR2Pjs.modifyNoteDurationChecked; exports.modifyNotePitch = _chunkKABVHR2Pjs.modifyNotePitch; exports.modifyNotePitchChecked = _chunkKABVHR2Pjs.modifyNotePitchChecked; exports.modifyTempo = _chunkKABVHR2Pjs.modifyTempo; exports.moveNoteToStaff = _chunkKABVHR2Pjs.moveNoteToStaff; exports.parse = parse; exports.parseAbc = parseAbc; exports.parseAuto = parseAuto; exports.parseCompressed = parseCompressed; exports.parseFile = parseFile; exports.pasteNotes = _chunkKABVHR2Pjs.pasteNotes; exports.pasteNotesMultiMeasure = _chunkKABVHR2Pjs.pasteNotesMultiMeasure; exports.pitchToSemitone = _chunkVE2KCZMAjs.pitchToSemitone; exports.raiseAccidental = _chunkKABVHR2Pjs.raiseAccidental; exports.removeArticulation = _chunkKABVHR2Pjs.removeArticulation; exports.removeBeam = _chunkKABVHR2Pjs.removeBeam; exports.removeBowing = _chunkKABVHR2Pjs.removeBowing; exports.removeBreathMark = _chunkKABVHR2Pjs.removeBreathMark; exports.removeCaesura = _chunkKABVHR2Pjs.removeCaesura; exports.removeChordSymbol = _chunkKABVHR2Pjs.removeChordSymbol; exports.removeDynamics = _chunkKABVHR2Pjs.removeDynamics; exports.removeEnding = _chunkKABVHR2Pjs.removeEnding; exports.removeFermata = _chunkKABVHR2Pjs.removeFermata; exports.removeFingering = _chunkKABVHR2Pjs.removeFingering; exports.removeGraceNote = _chunkKABVHR2Pjs.removeGraceNote; exports.removeHarmony = _chunkKABVHR2Pjs.removeHarmony; exports.removeLyric = _chunkKABVHR2Pjs.removeLyric; exports.removeNote = _chunkKABVHR2Pjs.removeNote; exports.removeOctaveShift = _chunkKABVHR2Pjs.removeOctaveShift; exports.removeOrnament = _chunkKABVHR2Pjs.removeOrnament; exports.removePart = _chunkKABVHR2Pjs.removePart; exports.removePedal = _chunkKABVHR2Pjs.removePedal; exports.removeRepeat = _chunkKABVHR2Pjs.removeRepeat; exports.removeRepeatBarline = _chunkKABVHR2Pjs.removeRepeatBarline; exports.removeSlur = _chunkKABVHR2Pjs.removeSlur; exports.removeStringNumber = _chunkKABVHR2Pjs.removeStringNumber; exports.removeTempo = _chunkKABVHR2Pjs.removeTempo; exports.removeTie = _chunkKABVHR2Pjs.removeTie; exports.removeTuplet = _chunkKABVHR2Pjs.removeTuplet; exports.removeWedge = _chunkKABVHR2Pjs.removeWedge; exports.scoresEqual = _chunkVE2KCZMAjs.scoresEqual; exports.serialize = serialize; exports.serializeAbc = serializeAbc; exports.serializeCompressed = serializeCompressed; exports.serializeToFile = serializeToFile; exports.setBarline = _chunkKABVHR2Pjs.setBarline; exports.setBeaming = _chunkKABVHR2Pjs.setBeaming; exports.setNotePitch = _chunkKABVHR2Pjs.setNotePitch; exports.setNotePitchBySemitone = _chunkKABVHR2Pjs.setNotePitchBySemitone; exports.setStaves = _chunkKABVHR2Pjs.setStaves; exports.shiftNotePitch = _chunkKABVHR2Pjs.shiftNotePitch; exports.stopOctaveShift = _chunkKABVHR2Pjs.stopOctaveShift; exports.transpose = _chunkKABVHR2Pjs.transpose; exports.transposeChecked = _chunkKABVHR2Pjs.transposeChecked; exports.updateChordSymbol = _chunkKABVHR2Pjs.updateChordSymbol; exports.updateHarmony = _chunkKABVHR2Pjs.updateHarmony; exports.updateLyric = _chunkKABVHR2Pjs.updateLyric; exports.validate = _chunkKABVHR2Pjs.validate; exports.validateBackupForward = _chunkKABVHR2Pjs.validateBackupForward; exports.validateBeams = _chunkKABVHR2Pjs.validateBeams; exports.validateDivisions = _chunkKABVHR2Pjs.validateDivisions; exports.validateMeasureDuration = _chunkKABVHR2Pjs.validateMeasureDuration; exports.validateMeasureLocal = _chunkKABVHR2Pjs.validateMeasureLocal; exports.validatePartReferences = _chunkKABVHR2Pjs.validatePartReferences; exports.validatePartStructure = _chunkKABVHR2Pjs.validatePartStructure; exports.validateSlurs = _chunkKABVHR2Pjs.validateSlurs; exports.validateSlursAcrossMeasures = _chunkKABVHR2Pjs.validateSlursAcrossMeasures; exports.validateStaffStructure = _chunkKABVHR2Pjs.validateStaffStructure; exports.validateTies = _chunkKABVHR2Pjs.validateTies; exports.validateTiesAcrossMeasures = _chunkKABVHR2Pjs.validateTiesAcrossMeasures; exports.validateTuplets = _chunkKABVHR2Pjs.validateTuplets; exports.validateVoiceStaff = _chunkKABVHR2Pjs.validateVoiceStaff; exports.withAbsolutePositions = _chunkVE2KCZMAjs.withAbsolutePositions;
|
|
8152
|
+
exports.STEPS = _chunkVE2KCZMAjs.STEPS; exports.STEP_SEMITONES = _chunkVE2KCZMAjs.STEP_SEMITONES; exports.ValidationException = _chunkTBGS7OISjs.ValidationException; exports.addArticulation = _chunkTBGS7OISjs.addArticulation; exports.addBeam = _chunkTBGS7OISjs.addBeam; exports.addBowing = _chunkTBGS7OISjs.addBowing; exports.addBreathMark = _chunkTBGS7OISjs.addBreathMark; exports.addCaesura = _chunkTBGS7OISjs.addCaesura; exports.addChord = _chunkTBGS7OISjs.addChord; exports.addChordNote = _chunkTBGS7OISjs.addChordNote; exports.addChordNoteChecked = _chunkTBGS7OISjs.addChordNoteChecked; exports.addChordSymbol = _chunkTBGS7OISjs.addChordSymbol; exports.addCoda = _chunkTBGS7OISjs.addCoda; exports.addDaCapo = _chunkTBGS7OISjs.addDaCapo; exports.addDalSegno = _chunkTBGS7OISjs.addDalSegno; exports.addDynamics = _chunkTBGS7OISjs.addDynamics; exports.addEnding = _chunkTBGS7OISjs.addEnding; exports.addFermata = _chunkTBGS7OISjs.addFermata; exports.addFine = _chunkTBGS7OISjs.addFine; exports.addFingering = _chunkTBGS7OISjs.addFingering; exports.addGraceNote = _chunkTBGS7OISjs.addGraceNote; exports.addHarmony = _chunkTBGS7OISjs.addHarmony; exports.addLyric = _chunkTBGS7OISjs.addLyric; exports.addNote = _chunkTBGS7OISjs.addNote; exports.addNoteChecked = _chunkTBGS7OISjs.addNoteChecked; exports.addOctaveShift = _chunkTBGS7OISjs.addOctaveShift; exports.addOrnament = _chunkTBGS7OISjs.addOrnament; exports.addPart = _chunkTBGS7OISjs.addPart; exports.addPedal = _chunkTBGS7OISjs.addPedal; exports.addRehearsalMark = _chunkTBGS7OISjs.addRehearsalMark; exports.addRepeat = _chunkTBGS7OISjs.addRepeat; exports.addRepeatBarline = _chunkTBGS7OISjs.addRepeatBarline; exports.addSegno = _chunkTBGS7OISjs.addSegno; exports.addSlur = _chunkTBGS7OISjs.addSlur; exports.addStringNumber = _chunkTBGS7OISjs.addStringNumber; exports.addTempo = _chunkTBGS7OISjs.addTempo; exports.addText = _chunkTBGS7OISjs.addText; exports.addTextDirection = _chunkTBGS7OISjs.addTextDirection; exports.addTie = _chunkTBGS7OISjs.addTie; exports.addToCoda = _chunkTBGS7OISjs.addToCoda; exports.addVoice = _chunkTBGS7OISjs.addVoice; exports.addWedge = _chunkTBGS7OISjs.addWedge; exports.assertMeasureValid = _chunkTBGS7OISjs.assertMeasureValid; exports.assertValid = _chunkTBGS7OISjs.assertValid; exports.autoBeam = _chunkTBGS7OISjs.autoBeam; exports.buildVoiceToStaffMap = _chunkVE2KCZMAjs.buildVoiceToStaffMap; exports.buildVoiceToStaffMapForPart = _chunkVE2KCZMAjs.buildVoiceToStaffMapForPart; exports.changeBarline = _chunkTBGS7OISjs.changeBarline; exports.changeClef = _chunkTBGS7OISjs.changeClef; exports.changeKey = _chunkTBGS7OISjs.changeKey; exports.changeNoteDuration = _chunkTBGS7OISjs.changeNoteDuration; exports.changeTime = _chunkTBGS7OISjs.changeTime; exports.convertToGrace = _chunkTBGS7OISjs.convertToGrace; exports.copyNotes = _chunkTBGS7OISjs.copyNotes; exports.copyNotesMultiMeasure = _chunkTBGS7OISjs.copyNotesMultiMeasure; exports.countNotes = _chunkVE2KCZMAjs.countNotes; exports.createTuplet = _chunkTBGS7OISjs.createTuplet; exports.cutNotes = _chunkTBGS7OISjs.cutNotes; exports.decodeBuffer = decodeBuffer; exports.deleteMeasure = _chunkTBGS7OISjs.deleteMeasure; exports.deleteNote = _chunkTBGS7OISjs.deleteNote; exports.deleteNoteChecked = _chunkTBGS7OISjs.deleteNoteChecked; exports.duplicatePart = _chunkTBGS7OISjs.duplicatePart; exports.exportMidi = exportMidi; exports.findBarlines = _chunkVE2KCZMAjs.findBarlines; exports.findDirectionsByType = _chunkVE2KCZMAjs.findDirectionsByType; exports.findNotes = _chunkVE2KCZMAjs.findNotes; exports.findNotesWithNotation = _chunkVE2KCZMAjs.findNotesWithNotation; exports.formatLocation = _chunkTBGS7OISjs.formatLocation; exports.generateId = _chunkTBGS7OISjs.generateId; exports.getAbsolutePosition = _chunkVE2KCZMAjs.getAbsolutePosition; exports.getAdjacentNotes = _chunkVE2KCZMAjs.getAdjacentNotes; exports.getAllNotes = _chunkVE2KCZMAjs.getAllNotes; exports.getAllPartInfos = getAllPartInfos; exports.getAttributesAtMeasure = _chunkVE2KCZMAjs.getAttributesAtMeasure; exports.getBeamGroups = _chunkVE2KCZMAjs.getBeamGroups; exports.getChordProgression = _chunkVE2KCZMAjs.getChordProgression; exports.getChords = _chunkVE2KCZMAjs.getChords; exports.getClefChanges = _chunkVE2KCZMAjs.getClefChanges; exports.getClefForStaff = _chunkVE2KCZMAjs.getClefForStaff; exports.getDirectionOfKind = getDirectionOfKind; exports.getDirections = _chunkVE2KCZMAjs.getDirections; exports.getDirectionsAtPosition = _chunkVE2KCZMAjs.getDirectionsAtPosition; exports.getDirectionsOfKind = getDirectionsOfKind; exports.getDivisions = _chunkVE2KCZMAjs.getDivisions; exports.getDuration = _chunkVE2KCZMAjs.getDuration; exports.getDynamics = _chunkVE2KCZMAjs.getDynamics; exports.getEffectiveStaff = _chunkVE2KCZMAjs.getEffectiveStaff; exports.getEndings = _chunkVE2KCZMAjs.getEndings; exports.getEntriesAtPosition = _chunkVE2KCZMAjs.getEntriesAtPosition; exports.getEntriesForStaff = _chunkVE2KCZMAjs.getEntriesForStaff; exports.getEntriesInRange = _chunkVE2KCZMAjs.getEntriesInRange; exports.getHarmonies = _chunkVE2KCZMAjs.getHarmonies; exports.getHarmonyAtPosition = _chunkVE2KCZMAjs.getHarmonyAtPosition; exports.getKeyChanges = _chunkVE2KCZMAjs.getKeyChanges; exports.getLyricText = _chunkVE2KCZMAjs.getLyricText; exports.getLyrics = _chunkVE2KCZMAjs.getLyrics; exports.getMeasure = _chunkVE2KCZMAjs.getMeasure; exports.getMeasureByIndex = _chunkVE2KCZMAjs.getMeasureByIndex; exports.getMeasureContext = _chunkTBGS7OISjs.getMeasureContext; exports.getMeasureCount = _chunkVE2KCZMAjs.getMeasureCount; exports.getMeasureEndPosition = _chunkVE2KCZMAjs.getMeasureEndPosition; exports.getNextNote = _chunkVE2KCZMAjs.getNextNote; exports.getNormalizedDuration = _chunkVE2KCZMAjs.getNormalizedDuration; exports.getNormalizedPosition = _chunkVE2KCZMAjs.getNormalizedPosition; exports.getNotesAtPosition = _chunkVE2KCZMAjs.getNotesAtPosition; exports.getNotesForStaff = _chunkVE2KCZMAjs.getNotesForStaff; exports.getNotesForVoice = _chunkVE2KCZMAjs.getNotesForVoice; exports.getNotesInRange = _chunkVE2KCZMAjs.getNotesInRange; exports.getOctaveShifts = _chunkVE2KCZMAjs.getOctaveShifts; exports.getPartAbbreviation = getPartAbbreviation; exports.getPartById = _chunkVE2KCZMAjs.getPartById; exports.getPartByIndex = _chunkVE2KCZMAjs.getPartByIndex; exports.getPartCount = _chunkVE2KCZMAjs.getPartCount; exports.getPartIds = _chunkVE2KCZMAjs.getPartIds; exports.getPartIndex = _chunkVE2KCZMAjs.getPartIndex; exports.getPartInfo = getPartInfo; exports.getPartName = getPartName; exports.getPartNameMap = getPartNameMap; exports.getPedalMarkings = _chunkVE2KCZMAjs.getPedalMarkings; exports.getPrevNote = _chunkVE2KCZMAjs.getPrevNote; exports.getRepeatStructure = _chunkVE2KCZMAjs.getRepeatStructure; exports.getSlurSpans = _chunkVE2KCZMAjs.getSlurSpans; exports.getSoundDamperPedal = getSoundDamperPedal; exports.getSoundDynamics = getSoundDynamics; exports.getSoundSoftPedal = getSoundSoftPedal; exports.getSoundSostenutoPedal = getSoundSostenutoPedal; exports.getSoundTempo = getSoundTempo; exports.getStaffRange = _chunkVE2KCZMAjs.getStaffRange; exports.getStaveCount = _chunkVE2KCZMAjs.getStaveCount; exports.getStaves = _chunkVE2KCZMAjs.getStaves; exports.getStructuralChanges = _chunkVE2KCZMAjs.getStructuralChanges; exports.getTempoMarkings = _chunkVE2KCZMAjs.getTempoMarkings; exports.getTiedNoteGroups = _chunkVE2KCZMAjs.getTiedNoteGroups; exports.getTimeChanges = _chunkVE2KCZMAjs.getTimeChanges; exports.getTupletGroups = _chunkVE2KCZMAjs.getTupletGroups; exports.getVerseCount = _chunkVE2KCZMAjs.getVerseCount; exports.getVerticalSlice = _chunkVE2KCZMAjs.getVerticalSlice; exports.getVoiceLine = _chunkVE2KCZMAjs.getVoiceLine; exports.getVoiceLineInRange = _chunkVE2KCZMAjs.getVoiceLineInRange; exports.getVoices = _chunkVE2KCZMAjs.getVoices; exports.getVoicesForStaff = _chunkVE2KCZMAjs.getVoicesForStaff; exports.getWedges = _chunkVE2KCZMAjs.getWedges; exports.groupByStaff = _chunkVE2KCZMAjs.groupByStaff; exports.groupByVoice = _chunkVE2KCZMAjs.groupByVoice; exports.hasBeam = hasBeam; exports.hasDirectionOfKind = hasDirectionOfKind; exports.hasLyrics = hasLyrics; exports.hasMultipleStaves = _chunkVE2KCZMAjs.hasMultipleStaves; exports.hasNotations = hasNotations; exports.hasNotes = _chunkVE2KCZMAjs.hasNotes; exports.hasTie = hasTie; exports.hasTieStart = hasTieStart; exports.hasTieStop = hasTieStop; exports.hasTuplet = hasTuplet; exports.inferStaff = _chunkVE2KCZMAjs.inferStaff; exports.insertClefChange = _chunkTBGS7OISjs.insertClefChange; exports.insertMeasure = _chunkTBGS7OISjs.insertMeasure; exports.insertNote = _chunkTBGS7OISjs.insertNote; exports.isChordNote = isChordNote; exports.isCompressed = isCompressed; exports.isCueNote = isCueNote; exports.isGraceNote = isGraceNote; exports.isPartInfo = isPartInfo; exports.isPitchedNote = isPitchedNote; exports.isRest = isRest; exports.isRestMeasure = _chunkVE2KCZMAjs.isRestMeasure; exports.isUnpitchedNote = isUnpitchedNote; exports.isValid = _chunkTBGS7OISjs.isValid; exports.iterateEntries = _chunkVE2KCZMAjs.iterateEntries; exports.iterateNotes = _chunkVE2KCZMAjs.iterateNotes; exports.lowerAccidental = _chunkTBGS7OISjs.lowerAccidental; exports.measureRoundtrip = _chunkVE2KCZMAjs.measureRoundtrip; exports.modifyDynamics = _chunkTBGS7OISjs.modifyDynamics; exports.modifyNoteDuration = _chunkTBGS7OISjs.modifyNoteDuration; exports.modifyNoteDurationChecked = _chunkTBGS7OISjs.modifyNoteDurationChecked; exports.modifyNotePitch = _chunkTBGS7OISjs.modifyNotePitch; exports.modifyNotePitchChecked = _chunkTBGS7OISjs.modifyNotePitchChecked; exports.modifyTempo = _chunkTBGS7OISjs.modifyTempo; exports.moveNoteToStaff = _chunkTBGS7OISjs.moveNoteToStaff; exports.parse = parse; exports.parseAbc = parseAbc; exports.parseAuto = parseAuto; exports.parseCompressed = parseCompressed; exports.parseFile = parseFile; exports.pasteNotes = _chunkTBGS7OISjs.pasteNotes; exports.pasteNotesMultiMeasure = _chunkTBGS7OISjs.pasteNotesMultiMeasure; exports.pitchToSemitone = _chunkVE2KCZMAjs.pitchToSemitone; exports.raiseAccidental = _chunkTBGS7OISjs.raiseAccidental; exports.removeArticulation = _chunkTBGS7OISjs.removeArticulation; exports.removeBeam = _chunkTBGS7OISjs.removeBeam; exports.removeBowing = _chunkTBGS7OISjs.removeBowing; exports.removeBreathMark = _chunkTBGS7OISjs.removeBreathMark; exports.removeCaesura = _chunkTBGS7OISjs.removeCaesura; exports.removeChordSymbol = _chunkTBGS7OISjs.removeChordSymbol; exports.removeDynamics = _chunkTBGS7OISjs.removeDynamics; exports.removeEnding = _chunkTBGS7OISjs.removeEnding; exports.removeFermata = _chunkTBGS7OISjs.removeFermata; exports.removeFingering = _chunkTBGS7OISjs.removeFingering; exports.removeGraceNote = _chunkTBGS7OISjs.removeGraceNote; exports.removeHarmony = _chunkTBGS7OISjs.removeHarmony; exports.removeLyric = _chunkTBGS7OISjs.removeLyric; exports.removeNote = _chunkTBGS7OISjs.removeNote; exports.removeOctaveShift = _chunkTBGS7OISjs.removeOctaveShift; exports.removeOrnament = _chunkTBGS7OISjs.removeOrnament; exports.removePart = _chunkTBGS7OISjs.removePart; exports.removePedal = _chunkTBGS7OISjs.removePedal; exports.removeRepeat = _chunkTBGS7OISjs.removeRepeat; exports.removeRepeatBarline = _chunkTBGS7OISjs.removeRepeatBarline; exports.removeSlur = _chunkTBGS7OISjs.removeSlur; exports.removeStringNumber = _chunkTBGS7OISjs.removeStringNumber; exports.removeTempo = _chunkTBGS7OISjs.removeTempo; exports.removeTie = _chunkTBGS7OISjs.removeTie; exports.removeTuplet = _chunkTBGS7OISjs.removeTuplet; exports.removeWedge = _chunkTBGS7OISjs.removeWedge; exports.scoresEqual = _chunkVE2KCZMAjs.scoresEqual; exports.serialize = serialize; exports.serializeAbc = serializeAbc; exports.serializeCompressed = serializeCompressed; exports.serializeToFile = serializeToFile; exports.setBarline = _chunkTBGS7OISjs.setBarline; exports.setBeaming = _chunkTBGS7OISjs.setBeaming; exports.setNotePitch = _chunkTBGS7OISjs.setNotePitch; exports.setNotePitchBySemitone = _chunkTBGS7OISjs.setNotePitchBySemitone; exports.setStaves = _chunkTBGS7OISjs.setStaves; exports.shiftNotePitch = _chunkTBGS7OISjs.shiftNotePitch; exports.stopOctaveShift = _chunkTBGS7OISjs.stopOctaveShift; exports.transpose = _chunkTBGS7OISjs.transpose; exports.transposeChecked = _chunkTBGS7OISjs.transposeChecked; exports.updateChordSymbol = _chunkTBGS7OISjs.updateChordSymbol; exports.updateHarmony = _chunkTBGS7OISjs.updateHarmony; exports.updateLyric = _chunkTBGS7OISjs.updateLyric; exports.validate = _chunkTBGS7OISjs.validate; exports.validateBackupForward = _chunkTBGS7OISjs.validateBackupForward; exports.validateBeams = _chunkTBGS7OISjs.validateBeams; exports.validateDivisions = _chunkTBGS7OISjs.validateDivisions; exports.validateMeasureDuration = _chunkTBGS7OISjs.validateMeasureDuration; exports.validateMeasureLocal = _chunkTBGS7OISjs.validateMeasureLocal; exports.validatePartReferences = _chunkTBGS7OISjs.validatePartReferences; exports.validatePartStructure = _chunkTBGS7OISjs.validatePartStructure; exports.validateSlurs = _chunkTBGS7OISjs.validateSlurs; exports.validateSlursAcrossMeasures = _chunkTBGS7OISjs.validateSlursAcrossMeasures; exports.validateStaffStructure = _chunkTBGS7OISjs.validateStaffStructure; exports.validateTies = _chunkTBGS7OISjs.validateTies; exports.validateTiesAcrossMeasures = _chunkTBGS7OISjs.validateTiesAcrossMeasures; exports.validateTuplets = _chunkTBGS7OISjs.validateTuplets; exports.validateVoiceStaff = _chunkTBGS7OISjs.validateVoiceStaff; exports.withAbsolutePositions = _chunkVE2KCZMAjs.withAbsolutePositions;
|