abcjs 6.4.2 → 6.4.4
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/LICENSE.md +1 -1
- package/RELEASE.md +28 -1
- package/dist/abcjs-basic-min.js +2 -2
- package/dist/abcjs-basic-min.js.LICENSE +1 -1
- package/dist/abcjs-basic.js +98 -32
- package/dist/abcjs-basic.js.map +1 -1
- package/dist/abcjs-plugin-min.js +2 -2
- package/dist/abcjs-plugin-min.js.LICENSE +1 -1
- package/index.js +1 -1
- package/license.js +1 -1
- package/package.json +1 -1
- package/plugin.js +1 -1
- package/src/data/abc_tune.js +2 -0
- package/src/parse/abc_parse_music.js +40 -21
- package/src/parse/tune-builder.js +11 -1
- package/src/synth/abc_midi_flattener.js +9 -10
- package/src/synth/chord-track.js +9 -0
- package/src/test/abc_midi_sequencer_lint.js +1 -1
- package/src/write/creation/abstract-engraver.js +2 -1
- package/src/write/creation/elements/absolute-element.js +27 -16
- package/src/write/creation/elements/tie-element.js +26 -0
- package/src/write/layout/set-upper-and-lower-elements.js +8 -0
- package/test.js +1 -1
- package/types/index.d.ts +1 -1
- package/version.js +1 -1
- package/temp.txt +0 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**!
|
|
2
|
-
Copyright (c) 2009-
|
|
2
|
+
Copyright (c) 2009-2024 Paul Rosen and Gregory Dyke
|
|
3
3
|
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
package/dist/abcjs-basic.js
CHANGED
|
@@ -18,7 +18,7 @@ return /******/ (function() { // webpackBootstrap
|
|
|
18
18
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
19
19
|
|
|
20
20
|
/**!
|
|
21
|
-
Copyright (c) 2009-
|
|
21
|
+
Copyright (c) 2009-2024 Paul Rosen and Gregory Dyke
|
|
22
22
|
|
|
23
23
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
24
24
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1667,6 +1667,7 @@ var Tune = function Tune() {
|
|
|
1667
1667
|
}
|
|
1668
1668
|
this.getBpm = function (tempo) {
|
|
1669
1669
|
var bpm;
|
|
1670
|
+
if (!tempo) tempo = this.metaText ? this.metaText.tempo : null;
|
|
1670
1671
|
if (tempo) {
|
|
1671
1672
|
bpm = tempo.bpm;
|
|
1672
1673
|
var beatLength = this.getBeatLength();
|
|
@@ -6547,8 +6548,7 @@ MusicParser.prototype.parseMusic = function (line) {
|
|
|
6547
6548
|
if (el.chord !== undefined) bar.chord = el.chord;
|
|
6548
6549
|
if (bar.startEnding && multilineVars.barFirstEndingNum === undefined) multilineVars.barFirstEndingNum = multilineVars.currBarNumber;else if (bar.startEnding && bar.endEnding && multilineVars.barFirstEndingNum) multilineVars.currBarNumber = multilineVars.barFirstEndingNum;else if (bar.endEnding) multilineVars.barFirstEndingNum = undefined;
|
|
6549
6550
|
if (bar.type !== 'bar_invisible' && multilineVars.measureNotEmpty) {
|
|
6550
|
-
|
|
6551
|
-
if (isFirstVoice) {
|
|
6551
|
+
if (isFirstVoice()) {
|
|
6552
6552
|
multilineVars.currBarNumber++;
|
|
6553
6553
|
if (multilineVars.barNumbers && multilineVars.currBarNumber % multilineVars.barNumbers === 0) bar.barNumber = multilineVars.currBarNumber;
|
|
6554
6554
|
}
|
|
@@ -6743,6 +6743,7 @@ MusicParser.prototype.parseMusic = function (line) {
|
|
|
6743
6743
|
if (el.startTie !== undefined) el.pitches[0].startTie = el.startTie;
|
|
6744
6744
|
} else {
|
|
6745
6745
|
el.rest = core.rest;
|
|
6746
|
+
if (core.rest.type === 'multimeasure' && isFirstVoice()) multilineVars.currBarNumber += core.rest.text - 1; // The minus one is because the measure with the rest is already counted once normally.
|
|
6746
6747
|
if (core.endSlur !== undefined) el.endSlur = core.endSlur;
|
|
6747
6748
|
if (core.endTie !== undefined) el.rest.endTie = core.endTie;
|
|
6748
6749
|
if (core.startSlur !== undefined) el.startSlur = core.startSlur;
|
|
@@ -6836,15 +6837,30 @@ var letter_to_chord = function letter_to_chord(line, i) {
|
|
|
6836
6837
|
chord[1] = chord[1].substring(1);
|
|
6837
6838
|
chord[2] = 'right';
|
|
6838
6839
|
} else if (chord[0] > 0 && chord[1].length > 0 && chord[1][0] === '@') {
|
|
6839
|
-
// @-15,5.7
|
|
6840
|
+
// @-15,5.7
|
|
6840
6841
|
chord[1] = chord[1].substring(1);
|
|
6841
6842
|
var x = tokenizer.getFloat(chord[1]);
|
|
6842
|
-
if (x.digits === 0)
|
|
6843
|
+
if (x.digits === 0) {
|
|
6844
|
+
warn("Missing first position in absolutely positioned annotation.", line, i);
|
|
6845
|
+
chord[1] = chord[1].replace("@", "");
|
|
6846
|
+
chord[2] = 'above';
|
|
6847
|
+
return chord;
|
|
6848
|
+
}
|
|
6843
6849
|
chord[1] = chord[1].substring(x.digits);
|
|
6844
|
-
if (chord[1][0] !== ',')
|
|
6850
|
+
if (chord[1][0] !== ',') {
|
|
6851
|
+
warn("Missing comma absolutely positioned annotation.", line, i);
|
|
6852
|
+
chord[1] = chord[1].replace("@", "");
|
|
6853
|
+
chord[2] = 'above';
|
|
6854
|
+
return chord;
|
|
6855
|
+
}
|
|
6845
6856
|
chord[1] = chord[1].substring(1);
|
|
6846
6857
|
var y = tokenizer.getFloat(chord[1]);
|
|
6847
|
-
if (y.digits === 0)
|
|
6858
|
+
if (y.digits === 0) {
|
|
6859
|
+
warn("Missing second position in absolutely positioned annotation.", line, i);
|
|
6860
|
+
chord[1] = chord[1].replace("@", "");
|
|
6861
|
+
chord[2] = 'above';
|
|
6862
|
+
return chord;
|
|
6863
|
+
}
|
|
6848
6864
|
chord[1] = chord[1].substring(y.digits);
|
|
6849
6865
|
var ws = tokenizer.skipWhiteSpace(chord[1]);
|
|
6850
6866
|
chord[1] = chord[1].substring(ws);
|
|
@@ -7188,8 +7204,7 @@ MusicParser.prototype.startNewLine = function () {
|
|
|
7188
7204
|
if (params.currentVoice.staffNum === multilineVars.voices[voices[mv]].staffNum && params.currentVoice.index === multilineVars.voices[voices[mv]].index) params.currentVoiceName = voices[mv];
|
|
7189
7205
|
}
|
|
7190
7206
|
}
|
|
7191
|
-
|
|
7192
|
-
if (multilineVars.barNumbers === 0 && isFirstVoice && multilineVars.currBarNumber !== 1) params.barNumber = multilineVars.currBarNumber;
|
|
7207
|
+
if (multilineVars.barNumbers === 0 && isFirstVoice() && multilineVars.currBarNumber !== 1) params.barNumber = multilineVars.currBarNumber;
|
|
7193
7208
|
tuneBuilder.startNewLine(params);
|
|
7194
7209
|
if (multilineVars.key.impliedNaturals) delete multilineVars.key.impliedNaturals;
|
|
7195
7210
|
multilineVars.partForNextLine = {};
|
|
@@ -7485,6 +7500,9 @@ var getBrokenRhythm = function getBrokenRhythm(line, index) {
|
|
|
7485
7500
|
}
|
|
7486
7501
|
return null;
|
|
7487
7502
|
};
|
|
7503
|
+
function isFirstVoice() {
|
|
7504
|
+
return multilineVars.currentVoice === undefined || multilineVars.currentVoice.staffNum === 0 && multilineVars.currentVoice.index === 0;
|
|
7505
|
+
}
|
|
7488
7506
|
module.exports = MusicParser;
|
|
7489
7507
|
|
|
7490
7508
|
/***/ }),
|
|
@@ -9558,7 +9576,7 @@ var TuneBuilder = function TuneBuilder(tune) {
|
|
|
9558
9576
|
};
|
|
9559
9577
|
this.getCurrentVoice = function () {
|
|
9560
9578
|
//console.log("getCurrentVoice", tune.lineNum)
|
|
9561
|
-
var currLine = tune.lines
|
|
9579
|
+
var currLine = getPrevMusicLine(tune.lines, tune.lineNum);
|
|
9562
9580
|
if (!currLine) return null;
|
|
9563
9581
|
var currStaff = currLine.staff[tune.staffNum];
|
|
9564
9582
|
if (!currStaff) return null;
|
|
@@ -9981,6 +9999,14 @@ function wrapMusicLines(lines, barsperstaff) {
|
|
|
9981
9999
|
}
|
|
9982
10000
|
return false;
|
|
9983
10001
|
}
|
|
10002
|
+
function getPrevMusicLine(lines, currentLine) {
|
|
10003
|
+
// If the current line doesn't have music, search backwards until one is found.
|
|
10004
|
+
while (currentLine >= 0) {
|
|
10005
|
+
if (lines[currentLine].staff) return lines[currentLine];
|
|
10006
|
+
currentLine--;
|
|
10007
|
+
}
|
|
10008
|
+
return null;
|
|
10009
|
+
}
|
|
9984
10010
|
function getNextMusicLine(lines, currentLine) {
|
|
9985
10011
|
currentLine++;
|
|
9986
10012
|
while (lines.length > currentLine) {
|
|
@@ -11512,7 +11538,7 @@ var pitchesToPerc = __webpack_require__(/*! ./pitches-to-perc */ "./src/synth/pi
|
|
|
11512
11538
|
var shortestNote = durationRounded(1.0 / 32);
|
|
11513
11539
|
switch (noteModification) {
|
|
11514
11540
|
case "trill":
|
|
11515
|
-
var note =
|
|
11541
|
+
var note = 2;
|
|
11516
11542
|
while (runningDuration > 0) {
|
|
11517
11543
|
currentTrack.push({
|
|
11518
11544
|
cmd: 'note',
|
|
@@ -11524,7 +11550,7 @@ var pitchesToPerc = __webpack_require__(/*! ./pitches-to-perc */ "./src/synth/pi
|
|
|
11524
11550
|
instrument: currentInstrument,
|
|
11525
11551
|
style: 'decoration'
|
|
11526
11552
|
});
|
|
11527
|
-
note = note ===
|
|
11553
|
+
note = note === 2 ? 0 : 2;
|
|
11528
11554
|
runningDuration -= shortestNote;
|
|
11529
11555
|
start += shortestNote;
|
|
11530
11556
|
}
|
|
@@ -11544,7 +11570,7 @@ var pitchesToPerc = __webpack_require__(/*! ./pitches-to-perc */ "./src/synth/pi
|
|
|
11544
11570
|
start += shortestNote;
|
|
11545
11571
|
currentTrack.push({
|
|
11546
11572
|
cmd: 'note',
|
|
11547
|
-
pitch: p.pitch +
|
|
11573
|
+
pitch: p.pitch + 2,
|
|
11548
11574
|
volume: p.volume,
|
|
11549
11575
|
start: start,
|
|
11550
11576
|
duration: shortestNote,
|
|
@@ -11579,7 +11605,7 @@ var pitchesToPerc = __webpack_require__(/*! ./pitches-to-perc */ "./src/synth/pi
|
|
|
11579
11605
|
start += shortestNote;
|
|
11580
11606
|
currentTrack.push({
|
|
11581
11607
|
cmd: 'note',
|
|
11582
|
-
pitch: p.pitch -
|
|
11608
|
+
pitch: p.pitch - 2,
|
|
11583
11609
|
volume: p.volume,
|
|
11584
11610
|
start: start,
|
|
11585
11611
|
duration: shortestNote,
|
|
@@ -11600,10 +11626,10 @@ var pitchesToPerc = __webpack_require__(/*! ./pitches-to-perc */ "./src/synth/pi
|
|
|
11600
11626
|
});
|
|
11601
11627
|
break;
|
|
11602
11628
|
case "turn":
|
|
11603
|
-
shortestNote = p.duration /
|
|
11629
|
+
shortestNote = p.duration / 4;
|
|
11604
11630
|
currentTrack.push({
|
|
11605
11631
|
cmd: 'note',
|
|
11606
|
-
pitch: p.pitch,
|
|
11632
|
+
pitch: p.pitch + 2,
|
|
11607
11633
|
volume: p.volume,
|
|
11608
11634
|
start: start,
|
|
11609
11635
|
duration: shortestNote,
|
|
@@ -11613,7 +11639,7 @@ var pitchesToPerc = __webpack_require__(/*! ./pitches-to-perc */ "./src/synth/pi
|
|
|
11613
11639
|
});
|
|
11614
11640
|
currentTrack.push({
|
|
11615
11641
|
cmd: 'note',
|
|
11616
|
-
pitch: p.pitch
|
|
11642
|
+
pitch: p.pitch,
|
|
11617
11643
|
volume: p.volume,
|
|
11618
11644
|
start: start + shortestNote,
|
|
11619
11645
|
duration: shortestNote,
|
|
@@ -11623,7 +11649,7 @@ var pitchesToPerc = __webpack_require__(/*! ./pitches-to-perc */ "./src/synth/pi
|
|
|
11623
11649
|
});
|
|
11624
11650
|
currentTrack.push({
|
|
11625
11651
|
cmd: 'note',
|
|
11626
|
-
pitch: p.pitch,
|
|
11652
|
+
pitch: p.pitch - 1,
|
|
11627
11653
|
volume: p.volume,
|
|
11628
11654
|
start: start + shortestNote * 2,
|
|
11629
11655
|
duration: shortestNote,
|
|
@@ -11633,7 +11659,7 @@ var pitchesToPerc = __webpack_require__(/*! ./pitches-to-perc */ "./src/synth/pi
|
|
|
11633
11659
|
});
|
|
11634
11660
|
currentTrack.push({
|
|
11635
11661
|
cmd: 'note',
|
|
11636
|
-
pitch: p.pitch
|
|
11662
|
+
pitch: p.pitch,
|
|
11637
11663
|
volume: p.volume,
|
|
11638
11664
|
start: start + shortestNote * 3,
|
|
11639
11665
|
duration: shortestNote,
|
|
@@ -11641,15 +11667,6 @@ var pitchesToPerc = __webpack_require__(/*! ./pitches-to-perc */ "./src/synth/pi
|
|
|
11641
11667
|
instrument: currentInstrument,
|
|
11642
11668
|
style: 'decoration'
|
|
11643
11669
|
});
|
|
11644
|
-
currentTrack.push({
|
|
11645
|
-
cmd: 'note',
|
|
11646
|
-
pitch: p.pitch,
|
|
11647
|
-
volume: p.volume,
|
|
11648
|
-
start: start + shortestNote * 4,
|
|
11649
|
-
duration: shortestNote,
|
|
11650
|
-
gap: 0,
|
|
11651
|
-
instrument: currentInstrument
|
|
11652
|
-
});
|
|
11653
11670
|
break;
|
|
11654
11671
|
case "roll":
|
|
11655
11672
|
while (runningDuration > 0) {
|
|
@@ -13395,6 +13412,14 @@ ChordTrack.prototype.interpretChord = function (name) {
|
|
|
13395
13412
|
}
|
|
13396
13413
|
bass += chordTranspose;
|
|
13397
13414
|
|
|
13415
|
+
// MAE 31 Aug 2024 - For visual transpose backup range issue
|
|
13416
|
+
// If transposed below A or above G, bring it back in the normal backup range
|
|
13417
|
+
if (bass < 33) {
|
|
13418
|
+
bass += 12;
|
|
13419
|
+
} else if (bass > 44) {
|
|
13420
|
+
bass -= 12;
|
|
13421
|
+
}
|
|
13422
|
+
|
|
13398
13423
|
// MAE 17 Jun 2024 - Supporting octave shifted bass and chords
|
|
13399
13424
|
var unshiftedBass = bass;
|
|
13400
13425
|
bass += this.bassOctaveShift * 12;
|
|
@@ -18220,7 +18245,8 @@ AbstractEngraver.prototype.addMeasureNumber = function (number, abselem) {
|
|
|
18220
18245
|
if (abselem.isClef)
|
|
18221
18246
|
// If this is a clef rather than bar line, then the number shouldn't be centered because it could overlap the left side. This is an easy way to let it be centered but move it over, too.
|
|
18222
18247
|
dx += measureNumDim.width / 2;
|
|
18223
|
-
|
|
18248
|
+
// MAE 1 Oct 2024 - Change 13 to 13.5 since previously bar numbers were very slightly overlapping the top of the clef
|
|
18249
|
+
var vert = measureNumDim.width > 10 && abselem.abcelem.type === "treble" ? 13.5 : 11;
|
|
18224
18250
|
abselem.addFixed(new RelativeElement(number, dx, measureNumDim.width, vert + measureNumDim.height / spacing.STEP, {
|
|
18225
18251
|
type: "barNumber",
|
|
18226
18252
|
dim: this.getTextSize.attr("measurefont", 'bar-number')
|
|
@@ -19485,10 +19511,18 @@ AbsoluteElement.prototype.setLimit = function (member, child) {
|
|
|
19485
19511
|
if (!this.specialY[member]) this.specialY[member] = child[member];else this.specialY[member] = Math.max(this.specialY[member], child[member]);
|
|
19486
19512
|
};
|
|
19487
19513
|
AbsoluteElement.prototype._addChild = function (child) {
|
|
19488
|
-
//
|
|
19514
|
+
// console.log("Relative:",child);
|
|
19515
|
+
|
|
19516
|
+
// MAE 30 Sep 2024 - To avoid extra space for chords if there is only a bar number on the clef
|
|
19517
|
+
var okToPushTop = true;
|
|
19518
|
+
if (this.abcelem.el_type == "clef" && child.type == "barNumber") {
|
|
19519
|
+
okToPushTop = false;
|
|
19520
|
+
}
|
|
19489
19521
|
child.parent = this;
|
|
19490
19522
|
this.children[this.children.length] = child;
|
|
19491
|
-
|
|
19523
|
+
if (okToPushTop) {
|
|
19524
|
+
this.pushTop(child.top);
|
|
19525
|
+
}
|
|
19492
19526
|
this.pushBottom(child.bottom);
|
|
19493
19527
|
this.setLimit('tempoHeightAbove', child);
|
|
19494
19528
|
this.setLimit('partHeightAbove', child);
|
|
@@ -20602,6 +20636,30 @@ TieElem.prototype.avoidCollisionAbove = function () {
|
|
|
20602
20636
|
if (maxInnerHeight > this.startY && maxInnerHeight > this.endY) this.startY = this.endY = maxInnerHeight - 1;
|
|
20603
20637
|
}
|
|
20604
20638
|
};
|
|
20639
|
+
TieElem.prototype.getYBounds = function () {
|
|
20640
|
+
var lineStartX = 10; // TODO-PER: I'm not sure where to get this number from but it probably doesn't matter much
|
|
20641
|
+
var lineEndX = 1000; // TODO-PER: I'm not sure where to get this number from but it probably doesn't matter much
|
|
20642
|
+
if (this.isTie) {
|
|
20643
|
+
this.calcTieDirection();
|
|
20644
|
+
this.calcX(lineStartX, lineEndX);
|
|
20645
|
+
this.calcTieY();
|
|
20646
|
+
} else {
|
|
20647
|
+
this.calcSlurDirection();
|
|
20648
|
+
this.calcX(lineStartX, lineEndX);
|
|
20649
|
+
this.calcSlurY();
|
|
20650
|
+
}
|
|
20651
|
+
var top;
|
|
20652
|
+
var bottom;
|
|
20653
|
+
// TODO-PER: It's hard to tell how far the arc is, so I'm just using 3 as the max
|
|
20654
|
+
if (this.above) {
|
|
20655
|
+
bottom = Math.min(this.startY, this.endY);
|
|
20656
|
+
top = bottom + 3;
|
|
20657
|
+
} else {
|
|
20658
|
+
top = Math.min(this.startY, this.endY);
|
|
20659
|
+
bottom = top - 3;
|
|
20660
|
+
}
|
|
20661
|
+
return [top, bottom];
|
|
20662
|
+
};
|
|
20605
20663
|
module.exports = TieElem;
|
|
20606
20664
|
|
|
20607
20665
|
/***/ }),
|
|
@@ -25381,6 +25439,14 @@ function setUpperAndLowerVoiceElements(positionY, voice, spacing) {
|
|
|
25381
25439
|
case 'EndingElem':
|
|
25382
25440
|
setUpperAndLowerEndingElements(positionY, abselem);
|
|
25383
25441
|
break;
|
|
25442
|
+
case 'TieElem':
|
|
25443
|
+
// If a tie element is the highest or lowest thing then space might need to make room for it.
|
|
25444
|
+
var yBounds = abselem.getYBounds();
|
|
25445
|
+
voice.staff.top = Math.max(voice.staff.top, yBounds[0]);
|
|
25446
|
+
voice.staff.top = Math.max(voice.staff.top, yBounds[1]);
|
|
25447
|
+
voice.staff.bottom = Math.min(voice.staff.bottom, yBounds[0]);
|
|
25448
|
+
voice.staff.bottom = Math.min(voice.staff.bottom, yBounds[1]);
|
|
25449
|
+
break;
|
|
25384
25450
|
}
|
|
25385
25451
|
}
|
|
25386
25452
|
}
|
|
@@ -26489,7 +26555,7 @@ module.exports = Svg;
|
|
|
26489
26555
|
\********************/
|
|
26490
26556
|
/***/ (function(module) {
|
|
26491
26557
|
|
|
26492
|
-
var version = '6.4.
|
|
26558
|
+
var version = '6.4.4';
|
|
26493
26559
|
module.exports = version;
|
|
26494
26560
|
|
|
26495
26561
|
/***/ })
|