abcjs 6.1.7 → 6.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/RELEASE.md +48 -0
- package/dist/abcjs-basic-min.js +2 -2
- package/dist/abcjs-basic.js +144 -20
- package/dist/abcjs-basic.js.map +1 -1
- package/dist/abcjs-plugin-min.js +2 -2
- package/package.json +6 -6
- package/src/data/abc_tune.js +2 -0
- package/src/midi/abc_midi_create.js +8 -2
- package/src/parse/abc_parse.js +1 -0
- package/src/parse/abc_parse_key_voice.js +10 -1
- package/src/parse/abc_parse_music.js +2 -1
- package/src/parse/abc_transpose.js +14 -3
- package/src/synth/abc_midi_sequencer.js +1 -1
- package/src/synth/pitches-to-perc.js +12 -0
- package/src/tablatures/instruments/string-patterns.js +18 -1
- package/src/tablatures/instruments/tab-note.js +12 -1
- package/src/tablatures/tab-absolute-elements.js +3 -0
- package/src/tablatures/tab-renderer.js +1 -0
- package/src/test/abc_parser_lint.js +1 -1
- package/src/write/abc_decoration.js +20 -4
- package/src/write/abc_relative_element.js +1 -0
- package/src/write/classes.js +4 -0
- package/src/write/draw/absolute.js +8 -0
- package/src/write/draw/relative.js +1 -1
- package/src/write/selection.js +3 -3
- package/types/index.d.ts +64 -16
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "abcjs",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.9",
|
|
4
4
|
"description": "Renderer for abc music notation",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -44,16 +44,16 @@
|
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://abcjs.net",
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/core": "7.20.
|
|
47
|
+
"@babel/core": "7.20.12",
|
|
48
48
|
"@babel/preset-env": "7.20.2",
|
|
49
49
|
"@tarp/require": "1.4.3",
|
|
50
|
-
"babel-loader": "9.1.
|
|
50
|
+
"babel-loader": "9.1.2",
|
|
51
51
|
"chai": "4.3.7",
|
|
52
|
-
"concurrently": "7.
|
|
52
|
+
"concurrently": "7.6.0",
|
|
53
53
|
"http-server": "14.1.1",
|
|
54
|
-
"mocha": "10.
|
|
54
|
+
"mocha": "10.2.0",
|
|
55
55
|
"opener": "1.5.2",
|
|
56
|
-
"vuepress": "2.0.0-beta.
|
|
56
|
+
"vuepress": "2.0.0-beta.60",
|
|
57
57
|
"vuex": "4.1.0",
|
|
58
58
|
"webpack-bundle-analyzer": "4.7.0",
|
|
59
59
|
"webpack-cli": "4.10.0"
|
package/src/data/abc_tune.js
CHANGED
|
@@ -36,8 +36,14 @@ var create;
|
|
|
36
36
|
var pan = 0;
|
|
37
37
|
if (options.pan && options.pan.length > i)
|
|
38
38
|
pan = options.pan[i];
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
if (event.instrument === 128) {
|
|
40
|
+
// If we're using the percussion voice, change to Channel 10
|
|
41
|
+
midi.setChannel(9, pan);
|
|
42
|
+
midi.setInstrument(0);
|
|
43
|
+
} else {
|
|
44
|
+
midi.setChannel(event.channel, pan);
|
|
45
|
+
midi.setInstrument(event.instrument);
|
|
46
|
+
}
|
|
41
47
|
break;
|
|
42
48
|
case 'note':
|
|
43
49
|
var gapLengthInBeats = event.gap * beatsPerSecond;
|
package/src/parse/abc_parse.js
CHANGED
|
@@ -408,6 +408,16 @@ var parseKeyVoice = {};
|
|
|
408
408
|
multilineVars.clef.staffscale = tokens[0].floatt;
|
|
409
409
|
tokens.shift();
|
|
410
410
|
break;
|
|
411
|
+
case "octave":
|
|
412
|
+
tokens.shift();
|
|
413
|
+
if (tokens.length === 0) { warn("Expected = after octave", str, 0); return ret; }
|
|
414
|
+
token = tokens.shift();
|
|
415
|
+
if (token.token !== "=") { warn("Expected = after octave", str, token.start); break; }
|
|
416
|
+
if (tokens.length === 0) { warn("Expected parameter after octave=", str, 0); return ret; }
|
|
417
|
+
if (tokens[0].type !== 'number') { warn("Expected number after octave", str, tokens[0].start); break; }
|
|
418
|
+
multilineVars.octave = tokens[0].intt;
|
|
419
|
+
tokens.shift();
|
|
420
|
+
break;
|
|
411
421
|
case "style":
|
|
412
422
|
tokens.shift();
|
|
413
423
|
if (tokens.length === 0) { warn("Expected = after style", str, 0); return ret; }
|
|
@@ -716,7 +726,6 @@ var parseKeyVoice = {};
|
|
|
716
726
|
addNextTokenToVoiceInfo(id, 'staffscale', 'number');
|
|
717
727
|
break;
|
|
718
728
|
case 'octave':
|
|
719
|
-
// TODO-PER: This is accepted, but not implemented, yet.
|
|
720
729
|
addNextTokenToVoiceInfo(id, 'octave', 'number');
|
|
721
730
|
break;
|
|
722
731
|
case 'volume':
|
|
@@ -724,7 +724,7 @@ var legalAccents = [
|
|
|
724
724
|
"slide", "marcato",
|
|
725
725
|
"upbow", "downbow", "/", "//", "///", "////", "trem1", "trem2", "trem3", "trem4",
|
|
726
726
|
"turnx", "invertedturn", "invertedturnx", "trill(", "trill)", "arpeggio", "xstem", "mark", "umarcato",
|
|
727
|
-
"style=normal", "style=harmonic", "style=rhythm", "style=x", "style=triangle"
|
|
727
|
+
"style=normal", "style=harmonic", "style=rhythm", "style=x", "style=triangle", "D.C.alcoda", "D.C.alfine", "D.S.alcoda", "D.S.alfine", "editorial", "courtesy"
|
|
728
728
|
];
|
|
729
729
|
|
|
730
730
|
var volumeDecorations = [
|
|
@@ -1128,6 +1128,7 @@ var getCoreNote = function(line, index, el, canHaveBrokenRhythm) {
|
|
|
1128
1128
|
case 'g':
|
|
1129
1129
|
if (state === 'startSlur' || state === 'sharp2' || state === 'flat2' || state === 'pitch') {
|
|
1130
1130
|
el.pitch = pitches[line.charAt(index)];
|
|
1131
|
+
el.pitch += 7 * (multilineVars.currentVoice && multilineVars.currentVoice.octave !== undefined ? multilineVars.currentVoice.octave : multilineVars.octave);
|
|
1131
1132
|
el.name = line.charAt(index);
|
|
1132
1133
|
if (el.accidental)
|
|
1133
1134
|
el.name = accMap[el.accidental] + el.name;
|
|
@@ -51,7 +51,15 @@ transpose.keySignature = function(multilineVars, keyName, root, acc, localTransp
|
|
|
51
51
|
keyName = keyName.substr(2);
|
|
52
52
|
} else
|
|
53
53
|
keyName = keyName.substr(1);
|
|
54
|
-
var
|
|
54
|
+
var thisKeyIndex = keyIndex[baseKey]
|
|
55
|
+
var recognized = thisKeyIndex !== undefined
|
|
56
|
+
if (!recognized) {
|
|
57
|
+
// Either the key sig is "none" or we don't recognize it. Either way we don't change it, and we assume key of C for the purposes of this calculation.
|
|
58
|
+
thisKeyIndex = 0
|
|
59
|
+
baseKey = "C"
|
|
60
|
+
keyName = ""
|
|
61
|
+
}
|
|
62
|
+
var index = thisKeyIndex + multilineVars.localTranspose;
|
|
55
63
|
while (index < 0) index += 12;
|
|
56
64
|
if (index > 11) index = index % 12;
|
|
57
65
|
var newKeyName = (keyName[0] === 'm' ? newKeyMinor[index] : newKey[index]);
|
|
@@ -87,7 +95,10 @@ transpose.keySignature = function(multilineVars, keyName, root, acc, localTransp
|
|
|
87
95
|
multilineVars.localTransposeVerticalMovement = distance + Math.floor(multilineVars.localTranspose / 12) * 7;
|
|
88
96
|
else
|
|
89
97
|
multilineVars.localTransposeVerticalMovement = distance + Math.ceil(multilineVars.localTranspose / 12) * 7;
|
|
90
|
-
|
|
98
|
+
if (recognized)
|
|
99
|
+
return { accidentals: newKeySig, root: newKeyName[0], acc: newKeyName.length > 1 ? newKeyName[1] : "" };
|
|
100
|
+
else
|
|
101
|
+
return { accidentals: [], root: root, acc: acc };
|
|
91
102
|
};
|
|
92
103
|
|
|
93
104
|
transpose.chordName = function(multilineVars, chord) {
|
|
@@ -145,7 +156,7 @@ var accidentals3 = {
|
|
|
145
156
|
"1": "^",
|
|
146
157
|
"2": "^^"
|
|
147
158
|
};
|
|
148
|
-
var count = 0
|
|
159
|
+
//var count = 0
|
|
149
160
|
transpose.note = function(multilineVars, el) {
|
|
150
161
|
// the "el" that is passed in has el.name, el.accidental, and el.pitch. "pitch" is the vertical position (0=middle C)
|
|
151
162
|
// localTranspose is the number of half steps
|
|
@@ -6,7 +6,7 @@ var parseCommon = require("../parse/abc_common");
|
|
|
6
6
|
(function() {
|
|
7
7
|
"use strict";
|
|
8
8
|
|
|
9
|
-
var measureLength;
|
|
9
|
+
var measureLength = 1; // This should be set by the meter, but just in case that is missing, we'll take a guess.
|
|
10
10
|
// The abc is provided to us line by line. It might have repeats in it. We want to re arrange the elements to
|
|
11
11
|
// be an array of voices with all the repeats embedded, and no lines. Then it is trivial to go through the events
|
|
12
12
|
// one at a time and turn it into midi.
|
|
@@ -55,6 +55,18 @@ var pitchMap = {
|
|
|
55
55
|
n13: "=b",
|
|
56
56
|
s13: "^b",
|
|
57
57
|
x13: "b",
|
|
58
|
+
f14: "_c'",
|
|
59
|
+
n14: "=c'",
|
|
60
|
+
s14: "^c'",
|
|
61
|
+
x14: "c'",
|
|
62
|
+
f15: "_d'",
|
|
63
|
+
n15: "=d'",
|
|
64
|
+
s15: "^d'",
|
|
65
|
+
x15: "d'",
|
|
66
|
+
f16: "_e'",
|
|
67
|
+
n16: "=e'",
|
|
68
|
+
s16: "^e'",
|
|
69
|
+
x16: "e'",
|
|
58
70
|
}
|
|
59
71
|
|
|
60
72
|
function pitchesToPerc(pitchObj) {
|
|
@@ -103,7 +103,7 @@ function handleChordNotes(self, notes) {
|
|
|
103
103
|
|
|
104
104
|
function noteToNumber(self, note, stringNumber, secondPosition , firstSize) {
|
|
105
105
|
var strings = self.strings;
|
|
106
|
-
note.checkKeyAccidentals(self.accidentals) ;
|
|
106
|
+
note.checkKeyAccidentals(self.accidentals, self.measureAccidentals) ;
|
|
107
107
|
if (secondPosition) {
|
|
108
108
|
strings = secondPosition;
|
|
109
109
|
}
|
|
@@ -131,6 +131,22 @@ function noteToNumber(self, note, stringNumber, secondPosition , firstSize) {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
function toNumber(self, note) {
|
|
134
|
+
if (note.isAltered || note.natural) {
|
|
135
|
+
var acc;
|
|
136
|
+
if (note.isFlat) {
|
|
137
|
+
if (note.isDouble)
|
|
138
|
+
acc = "__"
|
|
139
|
+
else
|
|
140
|
+
acc = "_"
|
|
141
|
+
} else if (note.isSharp) {
|
|
142
|
+
if (note.isDouble)
|
|
143
|
+
acc = "^^"
|
|
144
|
+
else
|
|
145
|
+
acc = "^"
|
|
146
|
+
} else if (note.natural)
|
|
147
|
+
acc = "="
|
|
148
|
+
self.measureAccidentals[note.name.toUpperCase()] = acc
|
|
149
|
+
}
|
|
134
150
|
var num = null;
|
|
135
151
|
var str = 0;
|
|
136
152
|
var lowestString = self.strings[self.strings.length - 1];
|
|
@@ -254,6 +270,7 @@ function StringPatterns(plugin) {
|
|
|
254
270
|
// override default
|
|
255
271
|
this.highestNote = highestNote;
|
|
256
272
|
}
|
|
273
|
+
this.measureAccidentals = {}
|
|
257
274
|
this.capo = 0;
|
|
258
275
|
if (capo) {
|
|
259
276
|
this.capo = capo;
|
|
@@ -115,7 +115,18 @@ TabNote.prototype.isLowerThan = function (note) {
|
|
|
115
115
|
return false;
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
TabNote.prototype.checkKeyAccidentals = function(accidentals) {
|
|
118
|
+
TabNote.prototype.checkKeyAccidentals = function(accidentals, measureAccidentals) {
|
|
119
|
+
if (this.isAltered || this.natural)
|
|
120
|
+
return
|
|
121
|
+
if (measureAccidentals[this.name.toUpperCase()]) {
|
|
122
|
+
switch (measureAccidentals[this.name.toUpperCase()]) {
|
|
123
|
+
case "__": this.acc = -2; return;
|
|
124
|
+
case "_": this.acc = -1; return;
|
|
125
|
+
case "=": this.acc = 0; return;
|
|
126
|
+
case "^": this.acc = 1; return;
|
|
127
|
+
case "^^": this.acc = 2; return;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
119
130
|
if (accidentals) {
|
|
120
131
|
var curNote = this.name;
|
|
121
132
|
for (var iii = 0; iii < accidentals.length; iii++) {
|
|
@@ -27,6 +27,8 @@ function cloneAbsolute(absSrc) {
|
|
|
27
27
|
if (returned.abcelem.el_type === "note")
|
|
28
28
|
returned.abcelem.el_type = 'tabNumber';
|
|
29
29
|
}
|
|
30
|
+
// TODO-PER: This fixes the classes because the element isn't created at the right time.
|
|
31
|
+
absSrc.cloned = returned
|
|
30
32
|
return returned;
|
|
31
33
|
}
|
|
32
34
|
|
|
@@ -226,6 +228,7 @@ TabAbsoluteElements.prototype.build = function (plugin,
|
|
|
226
228
|
}
|
|
227
229
|
break;
|
|
228
230
|
case 'bar':
|
|
231
|
+
plugin.semantics.strings.measureAccidentals = {}
|
|
229
232
|
var lastBar = false;
|
|
230
233
|
if (ii === source.children.length-1) {
|
|
231
234
|
// used for final line bar drawing
|
|
@@ -228,6 +228,7 @@ TabRenderer.prototype.doLayout = function () {
|
|
|
228
228
|
for (var ii = 0; ii < nbVoices; ii++) {
|
|
229
229
|
var tabVoice = new VoiceElement(0, 0);
|
|
230
230
|
var nameHeight = buildTabName(this, tabVoice) / spacing.STEP;
|
|
231
|
+
nameHeight = Math.max(nameHeight, 1) // If there is no label for the tab line, then there needs to be a little padding
|
|
231
232
|
staffGroup.staffs[this.staffIndex].top += nameHeight;
|
|
232
233
|
staffGroup.height += nameHeight * spacing.STEP;
|
|
233
234
|
tabVoice.staff = staffGroupInfos;
|
|
@@ -61,7 +61,7 @@ var ParserLint = function() {
|
|
|
61
61
|
"p", "pp", "f", "ff", "mf", "mp", "ppp", "pppp", "fff", "ffff", "sfz", "repeatbar", "repeatbar2", "slide",
|
|
62
62
|
"upbow", "downbow", "staccato", "trem1", "trem2", "trem3", "trem4",
|
|
63
63
|
"/", "//", "///", "////", "turnx", "invertedturn", "invertedturnx", "arpeggio", "trill(", "trill)", "xstem",
|
|
64
|
-
"mark", "marcato", "umarcato"
|
|
64
|
+
"mark", "marcato", "umarcato", "D.C.alcoda", "D.C.alfine", "D.S.alcoda", "D.S.alfine", "editorial", "courtesy"
|
|
65
65
|
] } };
|
|
66
66
|
|
|
67
67
|
var tempoProperties = {
|
|
@@ -143,12 +143,12 @@ var Decoration = function Decoration() {
|
|
|
143
143
|
}
|
|
144
144
|
return y;
|
|
145
145
|
}
|
|
146
|
-
function textDecoration(text, placement) {
|
|
146
|
+
function textDecoration(text, placement, anchor) {
|
|
147
147
|
var y = getPlacement(placement);
|
|
148
148
|
var textFudge = 2;
|
|
149
149
|
var textHeight = 5;
|
|
150
150
|
// TODO-PER: Get the height of the current font and use that for the thickness.
|
|
151
|
-
abselem.addFixedX(new RelativeElement(text, width/2, 0, y+textFudge, {type:"decoration", klass: 'ornament', thickness: 3}));
|
|
151
|
+
abselem.addFixedX(new RelativeElement(text, width/2, 0, y+textFudge, {type:"decoration", klass: 'ornament', thickness: 3, anchor: anchor}));
|
|
152
152
|
|
|
153
153
|
incrementPlacement(placement, textHeight);
|
|
154
154
|
}
|
|
@@ -205,11 +205,27 @@ var Decoration = function Decoration() {
|
|
|
205
205
|
case "5":
|
|
206
206
|
case "D.C.":
|
|
207
207
|
case "D.S.":
|
|
208
|
-
textDecoration(decoration[i], positioning);
|
|
208
|
+
textDecoration(decoration[i], positioning, 'middle');
|
|
209
|
+
hasOne = true;
|
|
210
|
+
break;
|
|
211
|
+
case "D.C.alcoda":
|
|
212
|
+
textDecoration("D.C. al coda", positioning, 'left');
|
|
213
|
+
hasOne = true;
|
|
214
|
+
break;
|
|
215
|
+
case "D.C.alfine":
|
|
216
|
+
textDecoration("D.C. al fine", positioning, 'left');
|
|
217
|
+
hasOne = true;
|
|
218
|
+
break;
|
|
219
|
+
case "D.S.alcoda":
|
|
220
|
+
textDecoration("D.S. al coda", positioning, 'left');
|
|
221
|
+
hasOne = true;
|
|
222
|
+
break;
|
|
223
|
+
case "D.S.alfine":
|
|
224
|
+
textDecoration("D.S. al fine", positioning, 'left');
|
|
209
225
|
hasOne = true;
|
|
210
226
|
break;
|
|
211
227
|
case "fine":
|
|
212
|
-
textDecoration("FINE", positioning);
|
|
228
|
+
textDecoration("FINE", positioning, 'middle');
|
|
213
229
|
hasOne = true;
|
|
214
230
|
break;
|
|
215
231
|
case "+":
|
|
@@ -13,6 +13,7 @@ var RelativeElement = function RelativeElement(c, dx, w, pitch, opt) {
|
|
|
13
13
|
this.pitch2 = opt.pitch2;
|
|
14
14
|
this.linewidth = opt.linewidth;
|
|
15
15
|
this.klass = opt.klass;
|
|
16
|
+
this.anchor = opt.anchor ? opt.anchor : 'middle'
|
|
16
17
|
this.top = pitch;
|
|
17
18
|
if (this.pitch2 !== undefined && this.pitch2 > this.top) this.top = this.pitch2;
|
|
18
19
|
this.bottom = pitch;
|
package/src/write/classes.js
CHANGED
|
@@ -79,6 +79,10 @@ Classes.prototype.generate = function (c) {
|
|
|
79
79
|
return "";
|
|
80
80
|
var ret = [];
|
|
81
81
|
if (c && c.length > 0) ret.push(c);
|
|
82
|
+
if (c === "tab-number") // TODO-PER-HACK! straighten out the tablature
|
|
83
|
+
return ret.join(' ')
|
|
84
|
+
if (c === "text instrument-name")
|
|
85
|
+
return "abcjs-text abcjs-instrument-name"
|
|
82
86
|
if (this.lineNumber !== null) ret.push("l"+this.lineNumber);
|
|
83
87
|
if (this.measureNumber !== null) ret.push("m"+this.measureNumber);
|
|
84
88
|
if (this.measureNumber !== null) ret.push("mm"+this.measureTotal()); // measureNumber is null between measures so this is still the test for measureTotal
|
|
@@ -32,6 +32,14 @@ function drawAbsolute(renderer, params, bartop, selectables, staffPos) {
|
|
|
32
32
|
}
|
|
33
33
|
var g = elementGroup.endGroup(klass, params.type);
|
|
34
34
|
if (g) {
|
|
35
|
+
// TODO-PER-HACK! This corrects the classes because the tablature is not being created at the right time.
|
|
36
|
+
if (params.cloned) {
|
|
37
|
+
params.cloned.overrideClasses = g.className.baseVal
|
|
38
|
+
}
|
|
39
|
+
if (params.overrideClasses) {
|
|
40
|
+
var type = g.classList && g.classList.length > 0 ? g.classList[0] + ' ' : ''
|
|
41
|
+
g.setAttribute("class", type + params.overrideClasses)
|
|
42
|
+
}
|
|
35
43
|
if (isTempo) {
|
|
36
44
|
params.startChar = params.abcelem.startChar;
|
|
37
45
|
params.endChar = params.abcelem.endChar;
|
|
@@ -46,7 +46,7 @@ function drawRelativeElement(renderer, params, bartop) {
|
|
|
46
46
|
break;
|
|
47
47
|
case "decoration":
|
|
48
48
|
// The +6 is to compensate for the placement of text in svg: to be on the same row as symbols, the y-coord needs to compensate for the center line.
|
|
49
|
-
params.graphelem = renderText(renderer, { x: params.x, y: y+6, text: params.c, type: 'annotationfont', klass: renderer.controller.classes.generate("annotation"), anchor:
|
|
49
|
+
params.graphelem = renderText(renderer, { x: params.x, y: y+6, text: params.c, type: 'annotationfont', klass: renderer.controller.classes.generate("annotation"), anchor: params.anchor, centerVertically: true, dim: params.dim}, false);
|
|
50
50
|
break;
|
|
51
51
|
case "text":
|
|
52
52
|
params.graphelem = renderText(renderer, { x: params.x, y: y, text: params.c, type: 'annotationfont', klass: renderer.controller.classes.generate("annotation"), anchor: "start", centerVertically: params.centerVertically, dim: params.dim, lane: params.getLane(), name: "annotation"}, false);
|
package/src/write/selection.js
CHANGED
|
@@ -15,9 +15,9 @@ function setupSelection(engraver, svgs) {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
for (var i = 0; i < svgs.length; i++) {
|
|
18
|
-
svgs[i].addEventListener('touchstart', mouseDown.bind(engraver));
|
|
19
|
-
svgs[i].addEventListener('touchmove', mouseMove.bind(engraver));
|
|
20
|
-
svgs[i].addEventListener('touchend', mouseUp.bind(engraver));
|
|
18
|
+
svgs[i].addEventListener('touchstart', mouseDown.bind(engraver), {passive: true});
|
|
19
|
+
svgs[i].addEventListener('touchmove', mouseMove.bind(engraver), {passive: true});
|
|
20
|
+
svgs[i].addEventListener('touchend', mouseUp.bind(engraver), {passive: true});
|
|
21
21
|
svgs[i].addEventListener('mousedown', mouseDown.bind(engraver));
|
|
22
22
|
svgs[i].addEventListener('mousemove', mouseMove.bind(engraver));
|
|
23
23
|
svgs[i].addEventListener('mouseup', mouseUp.bind(engraver));
|
package/types/index.d.ts
CHANGED
|
@@ -68,7 +68,8 @@ declare module 'abcjs' {
|
|
|
68
68
|
"p" | "pp" | "f" | "ff" | "mf" | "mp" | "ppp" | "pppp" | "fff" | "ffff" | "sfz" | "repeatbar" | "repeatbar2" | "slide" |
|
|
69
69
|
"upbow" | "downbow" | "staccato" | "trem1" | "trem2" | "trem3" | "trem4" |
|
|
70
70
|
"/" | "//" | "///" | "////" | "turnx" | "invertedturn" | "invertedturnx" | "arpeggio" | "trill(" | "trill)" | "xstem" |
|
|
71
|
-
"mark" | "marcato" | "umarcato"
|
|
71
|
+
"mark" | "marcato" | "umarcato" |
|
|
72
|
+
"D.C.alcoda" | "D.C.alfine" | "D.S.alcoda" | "D.S.alfine" | "editorial" | "courtesy"
|
|
72
73
|
|
|
73
74
|
//
|
|
74
75
|
// Basic types
|
|
@@ -157,19 +158,54 @@ declare module 'abcjs' {
|
|
|
157
158
|
|
|
158
159
|
export type MidiParam = Array<string|number>;
|
|
159
160
|
|
|
160
|
-
export type MidiGracePitches = Array<{instrument:
|
|
161
|
+
export type MidiGracePitches = Array<{instrument: number; pitch: number; volume: number; cents?: number; durationInMeasures: number}>;
|
|
161
162
|
|
|
162
163
|
export interface MidiPitch {
|
|
163
|
-
instrument:
|
|
164
|
+
instrument: number;
|
|
164
165
|
pitch: number;
|
|
165
166
|
duration: number;
|
|
166
167
|
volume: number;
|
|
167
|
-
cents?: number
|
|
168
|
+
cents?: number;
|
|
169
|
+
start: number;
|
|
170
|
+
gap: number;
|
|
168
171
|
}
|
|
169
172
|
|
|
170
173
|
export type MidiPitches = Array<MidiPitch>;
|
|
171
174
|
|
|
172
|
-
export
|
|
175
|
+
export interface AbsoluteElement {
|
|
176
|
+
abcelem : AbcElem;
|
|
177
|
+
bottom : number;
|
|
178
|
+
children : Array<RelativeElement>
|
|
179
|
+
duration : number;
|
|
180
|
+
durationClass : number;
|
|
181
|
+
elemset : Array<SVGElement>
|
|
182
|
+
extra : Array<RelativeElement>
|
|
183
|
+
extraw : number;
|
|
184
|
+
fixed : {w: number, t: number, b: number}
|
|
185
|
+
heads : Array<RelativeElement>
|
|
186
|
+
invisible : boolean;
|
|
187
|
+
minspacing : number;
|
|
188
|
+
notePositions : Array<{x:number; y:number;}>
|
|
189
|
+
right : Array<RelativeElement>
|
|
190
|
+
specialY : Array<{
|
|
191
|
+
chordHeightAbove : number;
|
|
192
|
+
chordHeightBelow : number;
|
|
193
|
+
dynamicHeightAbove : number;
|
|
194
|
+
dynamicHeightBelow : number;
|
|
195
|
+
endingHeightAbove : number;
|
|
196
|
+
lyricHeightAbove : number;
|
|
197
|
+
lyricHeightBelow : number;
|
|
198
|
+
partHeightAbove : number;
|
|
199
|
+
tempoHeightAbove : number;
|
|
200
|
+
volumeHeightAbove : number;
|
|
201
|
+
volumeHeightBelow : number;
|
|
202
|
+
}>
|
|
203
|
+
top : number;
|
|
204
|
+
tuneNumber : number;
|
|
205
|
+
type : "symbol" | "tempo" | "part" | "rest" | "note" | "bar" | "staff-extra clef" | "staff-extra key-signature" | "staff-extra time-signature";
|
|
206
|
+
w : number;
|
|
207
|
+
x : number;
|
|
208
|
+
}
|
|
173
209
|
|
|
174
210
|
export type AbstractEngraver = any;
|
|
175
211
|
|
|
@@ -340,7 +376,7 @@ declare module 'abcjs' {
|
|
|
340
376
|
millisecondsPerMeasure: number;
|
|
341
377
|
type: NoteTimingEventType;
|
|
342
378
|
|
|
343
|
-
elements?: Array<HTMLElement
|
|
379
|
+
elements?: Array<Array<HTMLElement>>;
|
|
344
380
|
endChar?: number;
|
|
345
381
|
endCharArray?: Array<number>;
|
|
346
382
|
endX?: number;
|
|
@@ -349,6 +385,7 @@ declare module 'abcjs' {
|
|
|
349
385
|
line?: number;
|
|
350
386
|
measureNumber?: number;
|
|
351
387
|
midiPitches?: MidiPitches;
|
|
388
|
+
midiGraceNotePitches?: MidiGracePitches;
|
|
352
389
|
startChar?: number;
|
|
353
390
|
startCharArray?: Array<number>;
|
|
354
391
|
top?: number;
|
|
@@ -781,21 +818,32 @@ declare module 'abcjs' {
|
|
|
781
818
|
}
|
|
782
819
|
|
|
783
820
|
export interface AbcElem {
|
|
784
|
-
el_type: string //TODO enumerate these
|
|
785
|
-
abselem:
|
|
821
|
+
el_type: string; //TODO enumerate these
|
|
822
|
+
abselem: AbsoluteElement;
|
|
786
823
|
beambr?: number;
|
|
787
|
-
chord?: Array<
|
|
788
|
-
decoration: Array<
|
|
824
|
+
chord?: Array<{name: string; position: ChordPlacement}>
|
|
825
|
+
decoration: Array<string> //TODO enumerate these
|
|
789
826
|
duration: number
|
|
790
827
|
endBeam?: boolean
|
|
791
828
|
endSlur?: number
|
|
792
829
|
endTriplet?: true
|
|
793
|
-
gracenotes?: Array<
|
|
794
|
-
lyric?: Array<
|
|
830
|
+
gracenotes?: Array<{duration: number; name:string; pitch: number; verticalPosition: number;}>
|
|
831
|
+
lyric?: Array<{syllable: string; divider: ' ' | '-' | '_';}>
|
|
795
832
|
noStem?: boolean
|
|
796
|
-
|
|
833
|
+
midiPitches?: MidiPitches;
|
|
834
|
+
midiGraceNotePitches?: MidiGracePitches;
|
|
835
|
+
pitches?: Array<{
|
|
836
|
+
pitch: number;
|
|
837
|
+
name: string;
|
|
838
|
+
startSlur?: Array<{label: number}>;
|
|
839
|
+
endSlur?: Array<number>;
|
|
840
|
+
startTie?: {};
|
|
841
|
+
endTie?: boolean;
|
|
842
|
+
verticalPos: number;
|
|
843
|
+
highestVert: number;
|
|
844
|
+
}>
|
|
797
845
|
positioning?: any
|
|
798
|
-
rest?:
|
|
846
|
+
rest?: {"type": "rest"}
|
|
799
847
|
startBeam?: boolean
|
|
800
848
|
startTriplet?: number
|
|
801
849
|
tripletMultiplier?: number
|
|
@@ -1086,8 +1134,8 @@ declare module 'abcjs' {
|
|
|
1086
1134
|
|
|
1087
1135
|
export interface SynthObjectController {
|
|
1088
1136
|
disable(isDisabled: boolean): void
|
|
1089
|
-
setTune(visualObj: TuneObject, userAction: boolean, audioParams?:
|
|
1090
|
-
load(selector: string, cursorControl?:
|
|
1137
|
+
setTune(visualObj: TuneObject, userAction: boolean, audioParams?: SynthOptions): Promise<SynthInitResponse>
|
|
1138
|
+
load(selector: string, cursorControl?: CursorControl | null, visualOptions?: SynthVisualOptions): void
|
|
1091
1139
|
play(): void
|
|
1092
1140
|
pause(): void
|
|
1093
1141
|
toggleLoop(): void
|
package/version.js
CHANGED