abcjs 6.4.3 → 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/RELEASE.md +16 -1
- package/dist/abcjs-basic-min.js +2 -2
- package/dist/abcjs-basic.js +111 -27
- package/dist/abcjs-basic.js.map +1 -1
- package/dist/abcjs-plugin-min.js +2 -2
- package/package.json +1 -1
- package/src/parse/abc_parse_music.js +8 -4
- package/src/parse/tune-builder.js +11 -1
- package/src/synth/abc_midi_flattener.js +9 -10
- 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/version.js +1 -1
package/package.json
CHANGED
|
@@ -294,8 +294,7 @@ MusicParser.prototype.parseMusic = function(line) {
|
|
|
294
294
|
else if (bar.endEnding)
|
|
295
295
|
multilineVars.barFirstEndingNum = undefined;
|
|
296
296
|
if (bar.type !== 'bar_invisible' && multilineVars.measureNotEmpty) {
|
|
297
|
-
|
|
298
|
-
if (isFirstVoice) {
|
|
297
|
+
if (isFirstVoice()) {
|
|
299
298
|
multilineVars.currBarNumber++;
|
|
300
299
|
if (multilineVars.barNumbers && multilineVars.currBarNumber % multilineVars.barNumbers === 0)
|
|
301
300
|
bar.barNumber = multilineVars.currBarNumber;
|
|
@@ -510,6 +509,8 @@ MusicParser.prototype.parseMusic = function(line) {
|
|
|
510
509
|
if (el.startTie !== undefined) el.pitches[0].startTie = el.startTie;
|
|
511
510
|
} else {
|
|
512
511
|
el.rest = core.rest;
|
|
512
|
+
if (core.rest.type === 'multimeasure' && isFirstVoice())
|
|
513
|
+
multilineVars.currBarNumber += core.rest.text - 1 // The minus one is because the measure with the rest is already counted once normally.
|
|
513
514
|
if (core.endSlur !== undefined) el.endSlur = core.endSlur;
|
|
514
515
|
if (core.endTie !== undefined) el.rest.endTie = core.endTie;
|
|
515
516
|
if (core.startSlur !== undefined) el.startSlur = core.startSlur;
|
|
@@ -1030,8 +1031,7 @@ MusicParser.prototype.startNewLine = function() {
|
|
|
1030
1031
|
params.currentVoiceName = voices[mv]
|
|
1031
1032
|
}
|
|
1032
1033
|
}
|
|
1033
|
-
|
|
1034
|
-
if (multilineVars.barNumbers === 0 && isFirstVoice && multilineVars.currBarNumber !== 1)
|
|
1034
|
+
if (multilineVars.barNumbers === 0 && isFirstVoice() && multilineVars.currBarNumber !== 1)
|
|
1035
1035
|
params.barNumber = multilineVars.currBarNumber;
|
|
1036
1036
|
tuneBuilder.startNewLine(params);
|
|
1037
1037
|
if (multilineVars.key.impliedNaturals)
|
|
@@ -1315,4 +1315,8 @@ var getBrokenRhythm = function(line, index) {
|
|
|
1315
1315
|
return null;
|
|
1316
1316
|
};
|
|
1317
1317
|
|
|
1318
|
+
function isFirstVoice() {
|
|
1319
|
+
return multilineVars.currentVoice === undefined || (multilineVars.currentVoice.staffNum === 0 && multilineVars.currentVoice.index === 0);
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1318
1322
|
module.exports = MusicParser;
|
|
@@ -382,7 +382,7 @@ var TuneBuilder = function (tune) {
|
|
|
382
382
|
|
|
383
383
|
this.getCurrentVoice = function () {
|
|
384
384
|
//console.log("getCurrentVoice", tune.lineNum)
|
|
385
|
-
var currLine = tune.lines
|
|
385
|
+
var currLine = getPrevMusicLine(tune.lines, tune.lineNum)
|
|
386
386
|
if (!currLine)
|
|
387
387
|
return null;
|
|
388
388
|
var currStaff = currLine.staff[tune.staffNum];
|
|
@@ -803,6 +803,16 @@ function wrapMusicLines(lines, barsperstaff) {
|
|
|
803
803
|
return false;
|
|
804
804
|
}
|
|
805
805
|
|
|
806
|
+
function getPrevMusicLine(lines, currentLine) {
|
|
807
|
+
// If the current line doesn't have music, search backwards until one is found.
|
|
808
|
+
while (currentLine >= 0) {
|
|
809
|
+
if (lines[currentLine].staff)
|
|
810
|
+
return lines[currentLine];
|
|
811
|
+
currentLine--;
|
|
812
|
+
}
|
|
813
|
+
return null;
|
|
814
|
+
}
|
|
815
|
+
|
|
806
816
|
function getNextMusicLine(lines, currentLine) {
|
|
807
817
|
currentLine++;
|
|
808
818
|
while (lines.length > currentLine) {
|
|
@@ -415,10 +415,10 @@ var pitchesToPerc = require('./pitches-to-perc');
|
|
|
415
415
|
|
|
416
416
|
switch (noteModification) {
|
|
417
417
|
case "trill":
|
|
418
|
-
var note =
|
|
418
|
+
var note = 2;
|
|
419
419
|
while (runningDuration > 0) {
|
|
420
420
|
currentTrack.push({ cmd: 'note', pitch: p.pitch+note, volume: p.volume, start: start, duration: shortestNote, gap: 0, instrument: currentInstrument, style: 'decoration' });
|
|
421
|
-
note = (note ===
|
|
421
|
+
note = (note === 2) ? 0 : 2;
|
|
422
422
|
runningDuration -= shortestNote;
|
|
423
423
|
start += shortestNote;
|
|
424
424
|
}
|
|
@@ -427,7 +427,7 @@ var pitchesToPerc = require('./pitches-to-perc');
|
|
|
427
427
|
currentTrack.push({ cmd: 'note', pitch: p.pitch, volume: p.volume, start: start, duration: shortestNote, gap: 0, instrument: currentInstrument, style: 'decoration' });
|
|
428
428
|
runningDuration -= shortestNote;
|
|
429
429
|
start += shortestNote;
|
|
430
|
-
currentTrack.push({ cmd: 'note', pitch: p.pitch+
|
|
430
|
+
currentTrack.push({ cmd: 'note', pitch: p.pitch+2, volume: p.volume, start: start, duration: shortestNote, gap: 0, instrument: currentInstrument, style: 'decoration' });
|
|
431
431
|
runningDuration -= shortestNote;
|
|
432
432
|
start += shortestNote;
|
|
433
433
|
currentTrack.push({ cmd: 'note', pitch: p.pitch, volume: p.volume, start: start, duration: runningDuration, gap: 0, instrument: currentInstrument });
|
|
@@ -436,18 +436,17 @@ var pitchesToPerc = require('./pitches-to-perc');
|
|
|
436
436
|
currentTrack.push({ cmd: 'note', pitch: p.pitch, volume: p.volume, start: start, duration: shortestNote, gap: 0, instrument: currentInstrument, style: 'decoration' });
|
|
437
437
|
runningDuration -= shortestNote;
|
|
438
438
|
start += shortestNote;
|
|
439
|
-
currentTrack.push({ cmd: 'note', pitch: p.pitch-
|
|
439
|
+
currentTrack.push({ cmd: 'note', pitch: p.pitch-2, volume: p.volume, start: start, duration: shortestNote, gap: 0, instrument: currentInstrument, style: 'decoration' });
|
|
440
440
|
runningDuration -= shortestNote;
|
|
441
441
|
start += shortestNote;
|
|
442
442
|
currentTrack.push({ cmd: 'note', pitch: p.pitch, volume: p.volume, start: start, duration: runningDuration, gap: 0, instrument: currentInstrument });
|
|
443
443
|
break;
|
|
444
444
|
case "turn":
|
|
445
|
-
shortestNote = p.duration /
|
|
446
|
-
currentTrack.push({ cmd: 'note', pitch: p.pitch, volume: p.volume, start: start, duration: shortestNote, gap: 0, instrument: currentInstrument, style: 'decoration' });
|
|
447
|
-
currentTrack.push({ cmd: 'note', pitch: p.pitch
|
|
448
|
-
currentTrack.push({ cmd: 'note', pitch: p.pitch, volume: p.volume, start: start+shortestNote*2, duration: shortestNote, gap: 0, instrument: currentInstrument, style: 'decoration' });
|
|
449
|
-
currentTrack.push({ cmd: 'note', pitch: p.pitch
|
|
450
|
-
currentTrack.push({ cmd: 'note', pitch: p.pitch, volume: p.volume, start: start+shortestNote*4, duration: shortestNote, gap: 0, instrument: currentInstrument });
|
|
445
|
+
shortestNote = p.duration / 4;
|
|
446
|
+
currentTrack.push({ cmd: 'note', pitch: p.pitch+2, volume: p.volume, start: start, duration: shortestNote, gap: 0, instrument: currentInstrument, style: 'decoration' });
|
|
447
|
+
currentTrack.push({ cmd: 'note', pitch: p.pitch, volume: p.volume, start: start+shortestNote, duration: shortestNote, gap: 0, instrument: currentInstrument, style: 'decoration' });
|
|
448
|
+
currentTrack.push({ cmd: 'note', pitch: p.pitch-1, volume: p.volume, start: start+shortestNote*2, duration: shortestNote, gap: 0, instrument: currentInstrument, style: 'decoration' });
|
|
449
|
+
currentTrack.push({ cmd: 'note', pitch: p.pitch, volume: p.volume, start: start+shortestNote*3, duration: shortestNote, gap: 0, instrument: currentInstrument, style: 'decoration' });
|
|
451
450
|
break;
|
|
452
451
|
case "roll":
|
|
453
452
|
while (runningDuration > 0) {
|
|
@@ -943,7 +943,8 @@ AbstractEngraver.prototype.addMeasureNumber = function (number, abselem) {
|
|
|
943
943
|
var dx = 0;
|
|
944
944
|
if (abselem.isClef) // 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.
|
|
945
945
|
dx += measureNumDim.width / 2
|
|
946
|
-
|
|
946
|
+
// MAE 1 Oct 2024 - Change 13 to 13.5 since previously bar numbers were very slightly overlapping the top of the clef
|
|
947
|
+
var vert = measureNumDim.width > 10 && abselem.abcelem.type === "treble" ? 13.5 : 11
|
|
947
948
|
abselem.addFixed(new RelativeElement(number, dx, measureNumDim.width, vert + measureNumDim.height / spacing.STEP, { type: "barNumber", dim: this.getTextSize.attr("measurefont", 'bar-number') }));
|
|
948
949
|
};
|
|
949
950
|
|
|
@@ -177,22 +177,33 @@ AbsoluteElement.prototype.setLimit = function (member, child) {
|
|
|
177
177
|
};
|
|
178
178
|
|
|
179
179
|
AbsoluteElement.prototype._addChild = function (child) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
180
|
+
// console.log("Relative:",child);
|
|
181
|
+
|
|
182
|
+
// MAE 30 Sep 2024 - To avoid extra space for chords if there is only a bar number on the clef
|
|
183
|
+
var okToPushTop = true;
|
|
184
|
+
if ((this.abcelem.el_type == "clef") && (child.type == "barNumber")){
|
|
185
|
+
okToPushTop = false;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
child.parent = this;
|
|
189
|
+
this.children[this.children.length] = child;
|
|
190
|
+
|
|
191
|
+
if (okToPushTop){
|
|
192
|
+
this.pushTop(child.top);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
this.pushBottom(child.bottom);
|
|
196
|
+
this.setLimit('tempoHeightAbove', child);
|
|
197
|
+
this.setLimit('partHeightAbove', child);
|
|
198
|
+
this.setLimit('volumeHeightAbove', child);
|
|
199
|
+
this.setLimit('dynamicHeightAbove', child);
|
|
200
|
+
this.setLimit('endingHeightAbove', child);
|
|
201
|
+
this.setLimit('chordHeightAbove', child);
|
|
202
|
+
this.setLimit('lyricHeightAbove', child);
|
|
203
|
+
this.setLimit('lyricHeightBelow', child);
|
|
204
|
+
this.setLimit('chordHeightBelow', child);
|
|
205
|
+
this.setLimit('volumeHeightBelow', child);
|
|
206
|
+
this.setLimit('dynamicHeightBelow', child);
|
|
196
207
|
};
|
|
197
208
|
|
|
198
209
|
AbsoluteElement.prototype.pushTop = function (top) {
|
package/version.js
CHANGED