abcjs 6.6.3 → 6.6.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.
@@ -203,10 +203,6 @@ var TimingCallbacks = function TimingCallbacks(target, params) {
203
203
  var self = this;
204
204
  if (!params) params = {};
205
205
  self.qpm = params.qpm ? parseInt(params.qpm, 10) : null;
206
- if (!self.qpm) {
207
- var tempo = target.metaText ? target.metaText.tempo : null;
208
- self.qpm = target.getBpm(tempo);
209
- }
210
206
  self.extraMeasuresAtBeginning = params.extraMeasuresAtBeginning ? parseInt(params.extraMeasuresAtBeginning, 10) : 0;
211
207
  self.beatCallback = params.beatCallback; // This is called for each beat.
212
208
  self.eventCallback = params.eventCallback; // This is called for each note or rest encountered.
@@ -216,6 +212,10 @@ var TimingCallbacks = function TimingCallbacks(target, params) {
216
212
  if (!self.beatSubdivisions) self.beatSubdivisions = 1;
217
213
  self.joggerTimer = null;
218
214
  self.replaceTarget = function (newTarget) {
215
+ if (!params.qpm) {
216
+ var tempo = newTarget.metaText ? newTarget.metaText.tempo : null;
217
+ self.qpm = newTarget.getBpm(tempo);
218
+ }
219
219
  self.noteTimings = newTarget.setTiming(self.qpm, self.extraMeasuresAtBeginning);
220
220
  if (newTarget.noteTimings.length === 0) self.noteTimings = newTarget.setTiming(0, 0);
221
221
  if (self.lineEndCallback) {
@@ -442,14 +442,40 @@ var TimingCallbacks = function TimingCallbacks(target, params) {
442
442
  startTime: self.startTime
443
443
  };
444
444
  }
445
- var thisStartTime = self.startTime; // the beat callback can call seek and change the position from beneath us.
446
- self.beatCallback(self.beatStarts[self.currentBeat].b, self.totalBeats / self.beatSubdivisions, self.lastMoment, position, debugInfo);
447
- if (thisStartTime !== self.startTime) {
448
- return timestamp - self.startTime;
449
- } // else
450
- // self.currentBeat++;
451
- }
452
445
 
446
+ // there is a case where self.beatStarts[self.currentBeat] doesn't exist, but I don't know how. Give more info in that case for better debugging.
447
+ if (self.currentBeat < 0 || self.currentBeat >= self.beatStarts.length || !self.beatStarts[self.currentBeat]) {
448
+ var obj = {
449
+ currentBeat: self.currentBeat,
450
+ beatStartLength: self.beatStarts.length,
451
+ totalBeats: self.totalBeats,
452
+ startTime: self.startTime,
453
+ currentTime: self.currentTime,
454
+ lastMoment: self.lastMoment,
455
+ lastTimestamp: self.lastTimestamp,
456
+ qpm: self.qpm,
457
+ millisecondsPerBeat: self.millisecondsPerBeat,
458
+ beatSubdivisions: self.beatSubdivisions,
459
+ currentEvent: self.currentEvent,
460
+ currentLine: self.currentLine,
461
+ isPaused: self.isPaused,
462
+ isRunning: self.isRunning,
463
+ pausedPercent: self.pausedPercent,
464
+ justUnpaused: self.justUnpaused,
465
+ newSeekPercent: self.newSeekPercent
466
+ };
467
+ setTimeout(function () {
468
+ // throw the error outside of the normal processing so that everything else continues working.
469
+ throw new Error("abcjs-timing-callback error: " + JSON.stringify(obj));
470
+ }, 1);
471
+ } else {
472
+ var thisStartTime = self.startTime; // the beat callback can call seek and change the position from beneath us.
473
+ self.beatCallback(self.beatStarts[self.currentBeat].b, self.totalBeats / self.beatSubdivisions, self.lastMoment, position, debugInfo);
474
+ if (thisStartTime !== self.startTime) {
475
+ return timestamp - self.startTime;
476
+ }
477
+ }
478
+ }
453
479
  return null;
454
480
  };
455
481
 
@@ -3220,6 +3246,8 @@ var Parse = function Parse() {
3220
3246
  }
3221
3247
  strTune = arr.join(" "); //. the split removed two characters, so this puts them back
3222
3248
  }
3249
+ // If there is an escaped percent, then temporarily change it so it doesn't affect the processing.
3250
+ strTune = strTune.replace(/\\%/g, "\u200B\uFF05");
3223
3251
  // take care of line continuations right away, but keep the same number of characters
3224
3252
  strTune = strTune.replace(/\\([ \t]*)(%.*)*\n/g, function (all, backslash, comment) {
3225
3253
  var padding = comment ? Array(comment.length + 1).join(' ') : "";
@@ -5211,7 +5239,7 @@ var ParseHeader = function ParseHeader(tokenizer, warn, multilineVars, tune, tun
5211
5239
  return [e - i + 1 + ws];
5212
5240
  case "[M:":
5213
5241
  var meter = this.setMeter(line.substring(i + 3, e));
5214
- if (tuneBuilder.hasBeginMusic() && meter) tuneBuilder.appendStartingElement('meter', startChar, endChar, meter);else multilineVars.meter = meter;
5242
+ if (startLine && multilineVars.currentVoice && meter) multilineVars.staves[multilineVars.currentVoice.staffNum].meter = meter;else if (tuneBuilder.hasBeginMusic() && meter) tuneBuilder.appendStartingElement('meter', startChar, endChar, meter);else multilineVars.meter = meter;
5215
5243
  return [e - i + 1 + ws];
5216
5244
  case "[K:":
5217
5245
  var result = parseKeyVoice.parseKey(line.substring(i + 3, e), true);
@@ -5682,8 +5710,17 @@ var parseKeyVoice = {};
5682
5710
  key.accidentals.forEach(function (k) {
5683
5711
  ret.accidentals.push(Object.assign({}, k));
5684
5712
  });
5713
+ if (key.explicitAccidentals) {
5714
+ ret.explicitAccidentals = [];
5715
+ key.explicitAccidentals.forEach(function (k) {
5716
+ ret.explicitAccidentals.push(Object.assign({}, k));
5717
+ });
5718
+ }
5685
5719
  return ret;
5686
5720
  };
5721
+ var setVoiceKey = function setVoiceKey() {
5722
+ if (multilineVars.currentVoice) multilineVars.currentVoice.key = parseKeyVoice.deepCopyKey(multilineVars.key);
5723
+ };
5687
5724
  var pitches = {
5688
5725
  A: 5,
5689
5726
  B: 6,
@@ -5814,6 +5851,10 @@ var parseKeyVoice = {};
5814
5851
  };
5815
5852
  ret.foundKey = true;
5816
5853
  tokens.shift();
5854
+ if (!isInline) {
5855
+ multilineVars.globalKey = parseKeyVoice.deepCopyKey(multilineVars.key);
5856
+ }
5857
+ setVoiceKey();
5817
5858
  break;
5818
5859
  case 'Hp':
5819
5860
  parseDirective.addDirective("bagpipes");
@@ -5834,6 +5875,10 @@ var parseKeyVoice = {};
5834
5875
  };
5835
5876
  ret.foundKey = true;
5836
5877
  tokens.shift();
5878
+ if (!isInline) {
5879
+ multilineVars.globalKey = parseKeyVoice.deepCopyKey(multilineVars.key);
5880
+ }
5881
+ setVoiceKey();
5837
5882
  break;
5838
5883
  case 'none':
5839
5884
  // we got the none key - that's the same as C to us
@@ -5845,6 +5890,10 @@ var parseKeyVoice = {};
5845
5890
  };
5846
5891
  ret.foundKey = true;
5847
5892
  tokens.shift();
5893
+ if (!isInline) {
5894
+ multilineVars.globalKey = parseKeyVoice.deepCopyKey(multilineVars.key);
5895
+ }
5896
+ setVoiceKey();
5848
5897
  break;
5849
5898
  default:
5850
5899
  var retPitch = tokenizer.getKeyPitch(tokens[0].token);
@@ -5905,6 +5954,10 @@ var parseKeyVoice = {};
5905
5954
  }
5906
5955
  }
5907
5956
  }
5957
+ if (!isInline) {
5958
+ multilineVars.globalKey = parseKeyVoice.deepCopyKey(multilineVars.key);
5959
+ }
5960
+ setVoiceKey();
5908
5961
  }
5909
5962
  break;
5910
5963
  }
@@ -5956,6 +6009,10 @@ var parseKeyVoice = {};
5956
6009
  }
5957
6010
  }
5958
6011
  }
6012
+ if (!isInline) {
6013
+ multilineVars.globalKey = parseKeyVoice.deepCopyKey(multilineVars.key);
6014
+ }
6015
+ setVoiceKey();
5959
6016
  }
5960
6017
 
5961
6018
  // Now see if any optional parameters are present. They have the form "key=value", except that "clef=" is optional
@@ -6183,6 +6240,7 @@ var parseKeyVoice = {};
6183
6240
  }
6184
6241
 
6185
6242
  multilineVars.currentVoice = currentVoice;
6243
+ if (currentVoice.key) multilineVars.key = parseKeyVoice.deepCopyKey(currentVoice.key);else if (multilineVars.globalKey) multilineVars.key = parseKeyVoice.deepCopyKey(multilineVars.globalKey);
6186
6244
  return tuneBuilder.setCurrentVoice(currentVoice.staffNum, currentVoice.index, id);
6187
6245
  };
6188
6246
  parseKeyVoice.parseVoice = function (line, i, e) {
@@ -14231,9 +14289,13 @@ ChordTrack.prototype.interpretChord = function (name) {
14231
14289
  };
14232
14290
  };
14233
14291
  ChordTrack.prototype.chordNotes = function (bass, modifier) {
14234
- var intervals = this.chordIntervals[modifier];
14292
+ // accept either chord spelling
14293
+ modifier = modifier.replace(/♭/g, 'b').replace(/♯/g, '#');
14294
+ var intervals = chordIntervals[modifier];
14235
14295
  if (!intervals) {
14236
- if (modifier.slice(0, 2).toLowerCase() === 'ma' || modifier[0] === 'M') intervals = this.chordIntervals.M;else if (modifier[0] === 'm' || modifier[0] === '-') intervals = this.chordIntervals.m;else intervals = this.chordIntervals.M;
14296
+ // If the chord isn't in our list, we can at least guess
14297
+ // whether it is major or minor.
14298
+ if (modifier.slice(0, 2).toLowerCase() === 'ma' || modifier[0] === 'M') intervals = chordIntervals.M;else if (modifier[0] === 'm' || modifier[0] === '-') intervals = chordIntervals.m;else intervals = chordIntervals.M;
14237
14299
  }
14238
14300
  bass += 12; // the chord is an octave above the bass note.
14239
14301
 
@@ -14396,7 +14458,7 @@ function extractNote(chord, index) {
14396
14458
  // This creates an arpeggio note no matter how many notes are in the chord - if it runs out of notes it continues in the next octave
14397
14459
  var octave = Math.floor(index / chord.chick.length);
14398
14460
  var note = chord.chick[index % chord.chick.length];
14399
- //console.log(chord.chick, {index, octave, note}, index % chord.chick.length)
14461
+ //console.log(chord.chick, {index, octave, note, index % chord.chick.length)
14400
14462
  return note + octave * 12;
14401
14463
  }
14402
14464
  function parseGChord(gchord) {
@@ -14488,118 +14550,366 @@ ChordTrack.prototype.basses = {
14488
14550
  'F': 41,
14489
14551
  'G': 43
14490
14552
  };
14491
- ChordTrack.prototype.chordIntervals = {
14492
- // diminished (all flat 5 chords)
14493
- 'dim': [0, 3, 6],
14494
- '°': [0, 3, 6],
14495
- '˚': [0, 3, 6],
14496
- 'dim7': [0, 3, 6, 9],
14497
- '°7': [0, 3, 6, 9],
14498
- '˚7': [0, 3, 6, 9],
14499
- 'ø7': [0, 3, 6, 10],
14500
- 'm7(b5)': [0, 3, 6, 10],
14501
- 'm7b5': [0, 3, 6, 10],
14502
- 'm7♭5': [0, 3, 6, 10],
14503
- '-7(b5)': [0, 3, 6, 10],
14504
- '-7b5': [0, 3, 6, 10],
14505
- '7b5': [0, 4, 6, 10],
14506
- '7(b5)': [0, 4, 6, 10],
14507
- '7♭5': [0, 4, 6, 10],
14508
- '7(b9,b5)': [0, 4, 6, 10, 13],
14509
- '7b9,b5': [0, 4, 6, 10, 13],
14510
- '7(#9,b5)': [0, 4, 6, 10, 15],
14511
- '7#9b5': [0, 4, 6, 10, 15],
14512
- 'maj7(b5)': [0, 4, 6, 11],
14513
- 'maj7b5': [0, 4, 6, 11],
14514
- '13(b5)': [0, 4, 6, 10, 14, 21],
14515
- '13b5': [0, 4, 6, 10, 14, 21],
14516
- // minor (all normal 5, minor 3 chords)
14517
- 'm': [0, 3, 7],
14518
- '-': [0, 3, 7],
14519
- 'm6': [0, 3, 7, 9],
14520
- '-6': [0, 3, 7, 9],
14521
- 'm7': [0, 3, 7, 10],
14522
- '-7': [0, 3, 7, 10],
14523
- '-(b6)': [0, 3, 7, 8],
14524
- '-b6': [0, 3, 7, 8],
14525
- '-6/9': [0, 3, 7, 9, 14],
14526
- '-7(b9)': [0, 3, 7, 10, 13],
14527
- '-7b9': [0, 3, 7, 10, 13],
14528
- '-maj7': [0, 3, 7, 11],
14529
- '-9+7': [0, 3, 7, 11, 13],
14530
- '-11': [0, 3, 7, 11, 14, 17],
14531
- 'm11': [0, 3, 7, 11, 14, 17],
14532
- '-maj9': [0, 3, 7, 11, 14],
14533
- '-∆9': [0, 3, 7, 11, 14],
14534
- 'mM9': [0, 3, 7, 11, 14],
14535
- // major (all normal 5, major 3 chords)
14536
- 'M': [0, 4, 7],
14537
- '6': [0, 4, 7, 9],
14538
- '6/9': [0, 4, 7, 9, 14],
14539
- '6add9': [0, 4, 7, 9, 14],
14540
- '69': [0, 4, 7, 9, 14],
14541
- '7': [0, 4, 7, 10],
14542
- '9': [0, 4, 7, 10, 14],
14543
- '11': [0, 7, 10, 14, 17],
14544
- '13': [0, 4, 7, 10, 14, 21],
14545
- '7b9': [0, 4, 7, 10, 13],
14546
- '7♭9': [0, 4, 7, 10, 13],
14547
- '7(b9)': [0, 4, 7, 10, 13],
14548
- '7(#9)': [0, 4, 7, 10, 15],
14549
- '7#9': [0, 4, 7, 10, 15],
14550
- '(13)': [0, 4, 7, 10, 14, 21],
14551
- '7(9,13)': [0, 4, 7, 10, 14, 21],
14552
- '7(#9,b13)': [0, 4, 7, 10, 15, 20],
14553
- '7(#11)': [0, 4, 7, 10, 14, 18],
14554
- '7#11': [0, 4, 7, 10, 14, 18],
14555
- '7(b13)': [0, 4, 7, 10, 20],
14556
- '7b13': [0, 4, 7, 10, 20],
14557
- '9(#11)': [0, 4, 7, 10, 14, 18],
14558
- '9#11': [0, 4, 7, 10, 14, 18],
14559
- '13(#11)': [0, 4, 7, 10, 18, 21],
14560
- '13#11': [0, 4, 7, 10, 18, 21],
14561
- 'maj7': [0, 4, 7, 11],
14562
- '∆7': [0, 4, 7, 11],
14563
- 'Δ7': [0, 4, 7, 11],
14564
- 'maj9': [0, 4, 7, 11, 14],
14565
- 'maj7(9)': [0, 4, 7, 11, 14],
14566
- 'maj7(11)': [0, 4, 7, 11, 17],
14567
- 'maj7(#11)': [0, 4, 7, 11, 18],
14568
- 'maj7(13)': [0, 4, 7, 14, 21],
14569
- 'maj7(9,13)': [0, 4, 7, 11, 14, 21],
14570
- '7sus4': [0, 5, 7, 10],
14571
- 'm7sus4': [0, 3, 7, 10, 17],
14572
- 'sus4': [0, 5, 7],
14573
- 'sus2': [0, 2, 7],
14574
- '7sus2': [0, 2, 7, 10],
14575
- '9sus4': [0, 5, 7, 10, 14],
14576
- '13sus4': [0, 5, 7, 10, 14, 21],
14577
- // augmented (all sharp 5 chords)
14578
- 'aug7': [0, 4, 8, 10],
14579
- '+7': [0, 4, 8, 10],
14580
- '+': [0, 4, 8],
14581
- '7#5': [0, 4, 8, 10],
14582
- '7♯5': [0, 4, 8, 10],
14583
- '7+5': [0, 4, 8, 10],
14584
- '9#5': [0, 4, 8, 10, 14],
14585
- '9♯5': [0, 4, 8, 10, 14],
14586
- '9+5': [0, 4, 8, 10, 14],
14587
- '-7(#5)': [0, 3, 8, 10],
14588
- '-7#5': [0, 3, 8, 10],
14589
- '7(#5)': [0, 4, 8, 10],
14590
- '7(b9,#5)': [0, 4, 8, 10, 13],
14591
- '7b9#5': [0, 4, 8, 10, 13],
14592
- 'maj7(#5)': [0, 4, 8, 11],
14593
- 'maj7#5': [0, 4, 8, 11],
14594
- 'maj7(#5,#11)': [0, 4, 8, 11, 18],
14595
- 'maj7#5#11': [0, 4, 8, 11, 18],
14596
- '9(#5)': [0, 4, 8, 10, 14],
14597
- '13(#5)': [0, 4, 8, 10, 14, 21],
14598
- '13#5': [0, 4, 8, 10, 14, 21],
14599
- // MAE Power chords added 10 April 2024
14600
- '5': [0, 7],
14601
- '5(8)': [0, 7, 12],
14602
- '5add8': [0, 7, 12]
14553
+ var chordIntervals = {
14554
+ // unusual chords
14555
+ "-addb2": [0, 1, 3, 7],
14556
+ "maddb2": [0, 1, 3, 7],
14557
+ "addb2": [0, 1, 4, 7],
14558
+ "susb2": [0, 1, 7],
14559
+ "-add2": [0, 2, 3, 7],
14560
+ "madd2": [0, 2, 3, 7],
14561
+ "add2": [0, 2, 4, 7],
14562
+ "sus2": [0, 2, 7],
14563
+ "-7sus2": [0, 2, 7, 10],
14564
+ "7sus2": [0, 2, 7, 10],
14565
+ "m7sus2": [0, 2, 7, 10],
14566
+ "min7sus2": [0, 2, 7, 10],
14567
+ "7sus2/9": [0, 2, 7, 10, 14],
14568
+ "add#2": [0, 3, 4, 7],
14569
+ "-add4": [0, 3, 5, 7],
14570
+ "madd4": [0, 3, 5, 7],
14571
+ // diminished chords
14572
+ "dim": [0, 3, 6],
14573
+ "m(b5)": [0, 3, 6],
14574
+ "°": [0, 3, 6],
14575
+ "˚": [0, 3, 6],
14576
+ "-add#4": [0, 3, 6, 7],
14577
+ "madd#4": [0, 3, 6, 7],
14578
+ "dim7": [0, 3, 6, 9],
14579
+ "°7": [0, 3, 6, 9],
14580
+ "˚7": [0, 3, 6, 9],
14581
+ "-7(b5)": [0, 3, 6, 10],
14582
+ "-7b5": [0, 3, 6, 10],
14583
+ "m7(b5)": [0, 3, 6, 10],
14584
+ "m7b5": [0, 3, 6, 10],
14585
+ "ø": [0, 3, 6, 10],
14586
+ "ø7": [0, 3, 6, 10],
14587
+ // minor chords
14588
+ "-": [0, 3, 7],
14589
+ "m": [0, 3, 7],
14590
+ "-(b6)": [0, 3, 7, 8],
14591
+ "-b6": [0, 3, 7, 8],
14592
+ "m(b6)": [0, 3, 7, 8],
14593
+ "mb6": [0, 3, 7, 8],
14594
+ "-6": [0, 3, 7, 9],
14595
+ "m6": [0, 3, 7, 9],
14596
+ "-6(9)": [0, 3, 7, 9, 14],
14597
+ "-6/9": [0, 3, 7, 9, 14],
14598
+ "-69": [0, 3, 7, 9, 14],
14599
+ "m6(9)": [0, 3, 7, 9, 14],
14600
+ "m6/9": [0, 3, 7, 9, 14],
14601
+ "m69": [0, 3, 7, 9, 14],
14602
+ "-7": [0, 3, 7, 10],
14603
+ "m7": [0, 3, 7, 10],
14604
+ "-7(b9)": [0, 3, 7, 10, 13],
14605
+ "-7b9": [0, 3, 7, 10, 13],
14606
+ "-7(9)": [0, 3, 7, 10, 14],
14607
+ "-7/9": [0, 3, 7, 10, 14],
14608
+ "-9": [0, 3, 7, 10, 14],
14609
+ "m7(9)": [0, 3, 7, 10, 14],
14610
+ "m7/9": [0, 3, 7, 10, 14],
14611
+ "m9": [0, 3, 7, 10, 14],
14612
+ "-7(9,11)": [0, 3, 7, 10, 14, 17],
14613
+ "-7/9/11": [0, 3, 7, 10, 14, 17],
14614
+ "m7(9,11)": [0, 3, 7, 10, 14, 17],
14615
+ "m7/9/11": [0, 3, 7, 10, 14, 17],
14616
+ "-13": [0, 3, 7, 10, 14, 17, 21],
14617
+ "-7(9,11,13)": [0, 3, 7, 10, 14, 17, 21],
14618
+ "-7/9/11/13": [0, 3, 7, 10, 14, 17, 21],
14619
+ "m13": [0, 3, 7, 10, 14, 17, 21],
14620
+ "m7(9,11,13)": [0, 3, 7, 10, 14, 17, 21],
14621
+ "m7/9/11/13": [0, 3, 7, 10, 14, 17, 21],
14622
+ "-7(9,13)": [0, 3, 7, 10, 14, 21],
14623
+ "-7/9/13": [0, 3, 7, 10, 14, 21],
14624
+ "m7(9,13)": [0, 3, 7, 10, 14, 21],
14625
+ "m7/9/13": [0, 3, 7, 10, 14, 21],
14626
+ "-7(11)": [0, 3, 7, 10, 17],
14627
+ "-7/11": [0, 3, 7, 10, 17],
14628
+ "m7(11)": [0, 3, 7, 10, 17],
14629
+ "m7/11": [0, 3, 7, 10, 17],
14630
+ "-7(11,13)": [0, 3, 7, 10, 17, 21],
14631
+ "-7/11/13": [0, 3, 7, 10, 17, 21],
14632
+ "m7(11,13)": [0, 3, 7, 10, 17, 21],
14633
+ "m7/11/13": [0, 3, 7, 10, 17, 21],
14634
+ "-(maj7)": [0, 3, 7, 11],
14635
+ "-7M": [0, 3, 7, 11],
14636
+ "-maj7": [0, 3, 7, 11],
14637
+ "-∆7": [0, 3, 7, 11],
14638
+ "m(maj7)": [0, 3, 7, 11],
14639
+ "mM7": [0, 3, 7, 11],
14640
+ "min(maj7)": [0, 3, 7, 11],
14641
+ "-9+7": [0, 3, 7, 11, 13],
14642
+ "-(maj9)": [0, 3, 7, 11, 14],
14643
+ "-7M(9)": [0, 3, 7, 11, 14],
14644
+ "-maj9": [0, 3, 7, 11, 14],
14645
+ "-∆9": [0, 3, 7, 11, 14],
14646
+ "m(maj9)": [0, 3, 7, 11, 14],
14647
+ "mM9": [0, 3, 7, 11, 14],
14648
+ "min(maj9)": [0, 3, 7, 11, 14],
14649
+ "-11": [0, 3, 7, 11, 14, 17],
14650
+ "m11": [0, 3, 7, 11, 14, 17],
14651
+ "-addb9": [0, 3, 7, 13],
14652
+ "maddb9": [0, 3, 7, 13],
14653
+ "-add9": [0, 3, 7, 14],
14654
+ "madd9": [0, 3, 7, 14],
14655
+ "-add11": [0, 3, 7, 17],
14656
+ "madd11": [0, 3, 7, 17],
14657
+ "-add#11": [0, 3, 7, 18],
14658
+ "madd#11": [0, 3, 7, 18],
14659
+ // altered minor chords
14660
+ "-#5": [0, 3, 8],
14661
+ "-(#5)": [0, 3, 8],
14662
+ "m#5": [0, 3, 8],
14663
+ "m(#5)": [0, 3, 8],
14664
+ "-7#5": [0, 3, 8, 10],
14665
+ "-7(#5)": [0, 3, 8, 10],
14666
+ "dim7(b13)": [0, 3, 9, 20],
14667
+ "°7(b13)": [0, 3, 9, 20],
14668
+ "˚7(b13)": [0, 3, 9, 20],
14669
+ // altered major chords
14670
+ "add4": [0, 4, 5, 7],
14671
+ "maj(b5)": [0, 4, 6],
14672
+ "majb5": [0, 4, 6],
14673
+ "add#4": [0, 4, 6, 7],
14674
+ "7(b5)": [0, 4, 6, 10],
14675
+ "7b5": [0, 4, 6, 10],
14676
+ "7(b5,b9)": [0, 4, 6, 10, 13],
14677
+ "7(b9,b5)": [0, 4, 6, 10, 13],
14678
+ "7b5(b9)": [0, 4, 6, 10, 13],
14679
+ "7b9,b5": [0, 4, 6, 10, 13],
14680
+ "7b9b5": [0, 4, 6, 10, 13],
14681
+ "7(b5,b9,b13)": [0, 4, 6, 10, 13, 20],
14682
+ "7/b5/b9/b13": [0, 4, 6, 10, 13, 20],
14683
+ "7b5/b9/b13": [0, 4, 6, 10, 13, 20],
14684
+ "7(b5,b9,13)": [0, 4, 6, 10, 13, 21],
14685
+ "7/b5/b9/13": [0, 4, 6, 10, 13, 21],
14686
+ "7b5/b9/13": [0, 4, 6, 10, 13, 21],
14687
+ "7(9,b5)": [0, 4, 6, 10, 14],
14688
+ "7(b5,9)": [0, 4, 6, 10, 14],
14689
+ "7b5(9)": [0, 4, 6, 10, 14],
14690
+ "9b5": [0, 4, 6, 10, 14],
14691
+ "13(b5)": [0, 4, 6, 10, 14, 21],
14692
+ "13b5": [0, 4, 6, 10, 14, 21],
14693
+ "7(b5,9,13)": [0, 4, 6, 10, 14, 21],
14694
+ "7/b5/9/13": [0, 4, 6, 10, 14, 21],
14695
+ "7b5/9/13": [0, 4, 6, 10, 14, 21],
14696
+ "7#9b5": [0, 4, 6, 10, 15],
14697
+ "7(#9,b5)": [0, 4, 6, 10, 15],
14698
+ "7(b5,#9)": [0, 4, 6, 10, 15],
14699
+ "7b5(#9)": [0, 4, 6, 10, 15],
14700
+ "7(b5,#9,b13)": [0, 4, 6, 10, 15, 20],
14701
+ "7/b5/#9/b13": [0, 4, 6, 10, 15, 20],
14702
+ "7b5/#9/b13": [0, 4, 6, 10, 15, 20],
14703
+ "7(b5,#9,13)": [0, 4, 6, 10, 15, 21],
14704
+ "7/b5/#9/13": [0, 4, 6, 10, 15, 21],
14705
+ "7b5/#9/13": [0, 4, 6, 10, 15, 21],
14706
+ "7(b5,b13)": [0, 4, 6, 10, 20],
14707
+ "7/b5/b13": [0, 4, 6, 10, 20],
14708
+ "7b5/b13": [0, 4, 6, 10, 20],
14709
+ "7(b5,13)": [0, 4, 6, 10, 21],
14710
+ "7/b5/13": [0, 4, 6, 10, 21],
14711
+ "7b5(13)": [0, 4, 6, 10, 21],
14712
+ "7b5/13": [0, 4, 6, 10, 21],
14713
+ "7M(b5)": [0, 4, 6, 11],
14714
+ "maj7(b5)": [0, 4, 6, 11],
14715
+ "maj7b5": [0, 4, 6, 11],
14716
+ "7M(b5,9)": [0, 4, 6, 11, 14],
14717
+ "maj7(b5,9)": [0, 4, 6, 11, 14],
14718
+ "maj7b5/9": [0, 4, 6, 11, 14],
14719
+ "7M(b5,9,13)": [0, 4, 6, 11, 14, 21],
14720
+ "maj7(b5,9,13)": [0, 4, 6, 11, 14, 21],
14721
+ "maj7b5/9/13": [0, 4, 6, 11, 14, 21],
14722
+ "7M(b5,13)": [0, 4, 6, 11, 21],
14723
+ "maj7(b5,13)": [0, 4, 6, 11, 21],
14724
+ "maj7b5/13": [0, 4, 6, 11, 21],
14725
+ // major chords
14726
+ "M": [0, 4, 7],
14727
+ "Δ": [0, 4, 7],
14728
+ "∆": [0, 4, 7],
14729
+ "6": [0, 4, 7, 9],
14730
+ "6(9)": [0, 4, 7, 9, 14],
14731
+ "6/9": [0, 4, 7, 9, 14],
14732
+ "69": [0, 4, 7, 9, 14],
14733
+ "6add9": [0, 4, 7, 9, 14],
14734
+ "6(9,11)": [0, 4, 7, 9, 14, 17],
14735
+ "6/9/11": [0, 4, 7, 9, 14, 17],
14736
+ "6911": [0, 4, 7, 9, 14, 17],
14737
+ "6(9,#11)": [0, 4, 7, 9, 14, 18],
14738
+ "6/9/#11": [0, 4, 7, 9, 14, 18],
14739
+ "69#11": [0, 4, 7, 9, 14, 18],
14740
+ "6(11)": [0, 4, 7, 9, 17],
14741
+ "6/11": [0, 4, 7, 9, 17],
14742
+ "611": [0, 4, 7, 9, 17],
14743
+ "6#11": [0, 4, 7, 9, 18],
14744
+ "6(#11)": [0, 4, 7, 9, 18],
14745
+ "6/#11": [0, 4, 7, 9, 18],
14746
+ "7": [0, 4, 7, 10],
14747
+ "7(b9)": [0, 4, 7, 10, 13],
14748
+ "7b9": [0, 4, 7, 10, 13],
14749
+ "7(9)": [0, 4, 7, 10, 14],
14750
+ "7/9": [0, 4, 7, 10, 14],
14751
+ "9": [0, 4, 7, 10, 14],
14752
+ "7(9,11)": [0, 4, 7, 10, 14, 17],
14753
+ "7/9/11": [0, 4, 7, 10, 14, 17],
14754
+ "7(9,11,13)": [0, 4, 7, 10, 14, 17, 21],
14755
+ "7/9/11/13": [0, 4, 7, 10, 14, 17, 21],
14756
+ "7#11": [0, 4, 7, 10, 14, 18],
14757
+ "7(#11)": [0, 4, 7, 10, 14, 18],
14758
+ "9#11": [0, 4, 7, 10, 14, 18],
14759
+ "9(#11)": [0, 4, 7, 10, 14, 18],
14760
+ "(13)": [0, 4, 7, 10, 14, 21],
14761
+ "13": [0, 4, 7, 10, 14, 21],
14762
+ "7(9,13)": [0, 4, 7, 10, 14, 21],
14763
+ "7/9/13": [0, 4, 7, 10, 14, 21],
14764
+ "9/13": [0, 4, 7, 10, 14, 21],
14765
+ "7#9": [0, 4, 7, 10, 15],
14766
+ "7(#9)": [0, 4, 7, 10, 15],
14767
+ "7(#9,b13)": [0, 4, 7, 10, 15, 20],
14768
+ "7(11)": [0, 4, 7, 10, 17],
14769
+ "7/11": [0, 4, 7, 10, 17],
14770
+ "7(11,13)": [0, 4, 7, 10, 17, 21],
14771
+ "7/11/13": [0, 4, 7, 10, 17, 21],
14772
+ "13#11": [0, 4, 7, 10, 18, 21],
14773
+ "13(#11)": [0, 4, 7, 10, 18, 21],
14774
+ "7(b13)": [0, 4, 7, 10, 20],
14775
+ "7b13": [0, 4, 7, 10, 20],
14776
+ "7(13)": [0, 4, 7, 10, 21],
14777
+ "7/13": [0, 4, 7, 10, 21],
14778
+ "7M": [0, 4, 7, 11],
14779
+ "maj7": [0, 4, 7, 11],
14780
+ "Δ7": [0, 4, 7, 11],
14781
+ "∆7": [0, 4, 7, 11],
14782
+ "7M(9)": [0, 4, 7, 11, 14],
14783
+ "7M/9": [0, 4, 7, 11, 14],
14784
+ "maj7(9)": [0, 4, 7, 11, 14],
14785
+ "maj7/9": [0, 4, 7, 11, 14],
14786
+ "maj9": [0, 4, 7, 11, 14],
14787
+ "Δ9": [0, 4, 7, 11, 14],
14788
+ "∆9": [0, 4, 7, 11, 14],
14789
+ "7M(9,11)": [0, 4, 7, 11, 14, 17],
14790
+ "7M/9/11": [0, 4, 7, 11, 14, 17],
14791
+ "maj11": [0, 4, 7, 11, 14, 17],
14792
+ "maj7(9,11)": [0, 4, 7, 11, 14, 17],
14793
+ "maj7/9/11": [0, 4, 7, 11, 14, 17],
14794
+ "Δ11": [0, 4, 7, 11, 14, 17],
14795
+ "∆11": [0, 4, 7, 11, 14, 17],
14796
+ "7M(9,11,13)": [0, 4, 7, 11, 14, 17, 21],
14797
+ "7M/9/11/13": [0, 4, 7, 11, 14, 17, 21],
14798
+ "maj13": [0, 4, 7, 11, 14, 17, 21],
14799
+ "maj7(9,11,13)": [0, 4, 7, 11, 14, 17, 21],
14800
+ "maj7/9/11/13": [0, 4, 7, 11, 14, 17, 21],
14801
+ "Δ11(13)": [0, 4, 7, 11, 14, 17, 21],
14802
+ "Δ13": [0, 4, 7, 11, 14, 17, 21],
14803
+ "∆11(13)": [0, 4, 7, 11, 14, 17, 21],
14804
+ "7M(9,#11)": [0, 4, 7, 11, 14, 18],
14805
+ "7M/9/#11": [0, 4, 7, 11, 14, 18],
14806
+ "maj7(9,#11)": [0, 4, 7, 11, 14, 18],
14807
+ "maj7/9/#11": [0, 4, 7, 11, 14, 18],
14808
+ "maj9#11": [0, 4, 7, 11, 14, 18],
14809
+ "maj9(#11)": [0, 4, 7, 11, 14, 18],
14810
+ "maj9/#11": [0, 4, 7, 11, 14, 18],
14811
+ "Δ9(#11)": [0, 4, 7, 11, 14, 18],
14812
+ "7M(9,#11,13)": [0, 4, 7, 11, 14, 18, 21],
14813
+ "7M/9/#11/13": [0, 4, 7, 11, 14, 18, 21],
14814
+ "maj13#11": [0, 4, 7, 11, 14, 18, 21],
14815
+ "maj13(#11)": [0, 4, 7, 11, 14, 18, 21],
14816
+ "maj13/#11": [0, 4, 7, 11, 14, 18, 21],
14817
+ "Δ13(#11)": [0, 4, 7, 11, 14, 18, 21],
14818
+ "∆13(#11)": [0, 4, 7, 11, 14, 18, 21],
14819
+ "7M(9,13)": [0, 4, 7, 11, 14, 21],
14820
+ "7M/9/13": [0, 4, 7, 11, 14, 21],
14821
+ "maj7(9,13)": [0, 4, 7, 11, 14, 21],
14822
+ "maj7/9/13": [0, 4, 7, 11, 14, 21],
14823
+ "maj9(13)": [0, 4, 7, 11, 14, 21],
14824
+ "Δ9(13)": [0, 4, 7, 11, 14, 21],
14825
+ "∆9(13)": [0, 4, 7, 11, 14, 21],
14826
+ "7M(11)": [0, 4, 7, 11, 17],
14827
+ "7M/11": [0, 4, 7, 11, 17],
14828
+ "maj7(11)": [0, 4, 7, 11, 17],
14829
+ "maj7/11": [0, 4, 7, 11, 17],
14830
+ "Δ7(11)": [0, 4, 7, 11, 17],
14831
+ "∆7(11)": [0, 4, 7, 11, 17],
14832
+ "7M(#11)": [0, 4, 7, 11, 18],
14833
+ "7M/#11": [0, 4, 7, 11, 18],
14834
+ "maj7(#11)": [0, 4, 7, 11, 18],
14835
+ "maj7/#11": [0, 4, 7, 11, 18],
14836
+ "Δ7(#11)": [0, 4, 7, 11, 18],
14837
+ "∆7(#11)": [0, 4, 7, 11, 18],
14838
+ "7M(13)": [0, 4, 7, 11, 21],
14839
+ "7M/13": [0, 4, 7, 11, 21],
14840
+ "maj7(13)": [0, 4, 7, 11, 21],
14841
+ "maj7/13": [0, 4, 7, 11, 21],
14842
+ "Δ7(13)": [0, 4, 7, 11, 21],
14843
+ "∆7(13)": [0, 4, 7, 11, 21],
14844
+ "addb9": [0, 4, 7, 13],
14845
+ "add9": [0, 4, 7, 14],
14846
+ "add#9": [0, 4, 7, 15],
14847
+ "add11": [0, 4, 7, 17],
14848
+ "add#11": [0, 4, 7, 18],
14849
+ // augmented chords
14850
+ "+": [0, 4, 8],
14851
+ "aug": [0, 4, 8],
14852
+ "+7": [0, 4, 8, 10],
14853
+ "7#5": [0, 4, 8, 10],
14854
+ "7(#5)": [0, 4, 8, 10],
14855
+ "7+5": [0, 4, 8, 10],
14856
+ "aug7": [0, 4, 8, 10],
14857
+ "7(b9,#5)": [0, 4, 8, 10, 13],
14858
+ "7b9#5": [0, 4, 8, 10, 13],
14859
+ "9#5": [0, 4, 8, 10, 14],
14860
+ "9(#5)": [0, 4, 8, 10, 14],
14861
+ "9+5": [0, 4, 8, 10, 14],
14862
+ "13#5": [0, 4, 8, 10, 14, 21],
14863
+ "13(#5)": [0, 4, 8, 10, 14, 21],
14864
+ "7M(#5)": [0, 4, 8, 11],
14865
+ "maj7#5": [0, 4, 8, 11],
14866
+ "maj7(#5)": [0, 4, 8, 11],
14867
+ "7M(#5,9)": [0, 4, 8, 11, 14],
14868
+ "maj7#5/9": [0, 4, 8, 11, 14],
14869
+ "maj7(#5,9)": [0, 4, 8, 11, 14],
14870
+ "maj7#5#11": [0, 4, 8, 11, 18],
14871
+ "maj7(#5,#11)": [0, 4, 8, 11, 18],
14872
+ // sus4 chords
14873
+ "sus": [0, 5, 7],
14874
+ "sus4": [0, 5, 7],
14875
+ "-7sus4": [0, 5, 7, 10],
14876
+ "7sus": [0, 5, 7, 10],
14877
+ "7sus4": [0, 5, 7, 10],
14878
+ "m7sus4": [0, 5, 7, 10],
14879
+ "min7sus4": [0, 5, 7, 10],
14880
+ "7sus(b9)": [0, 5, 7, 10, 13],
14881
+ "7sus4(b9)": [0, 5, 7, 10, 13],
14882
+ "-9sus4": [0, 5, 7, 10, 14],
14883
+ "7sus4(9)": [0, 5, 7, 10, 14],
14884
+ "7sus4/9": [0, 5, 7, 10, 14],
14885
+ "9sus": [0, 5, 7, 10, 14],
14886
+ "9sus4": [0, 5, 7, 10, 14],
14887
+ "m9sus4": [0, 5, 7, 10, 14],
14888
+ "min9sus4": [0, 5, 7, 10, 14],
14889
+ "11sus4": [0, 5, 7, 10, 14, 17],
14890
+ "13sus4": [0, 5, 7, 10, 14, 21],
14891
+ "7sus(#9)": [0, 5, 7, 10, 15],
14892
+ "7sus4(#9)": [0, 5, 7, 10, 15],
14893
+ "7sus4(11)": [0, 5, 7, 10, 17],
14894
+ "7sus4(13)": [0, 5, 7, 10, 21],
14895
+ "7Msus": [0, 5, 7, 11],
14896
+ "7Msus4": [0, 5, 7, 11],
14897
+ "maj7sus": [0, 5, 7, 11],
14898
+ "maj7sus4": [0, 5, 7, 11],
14899
+ // power chords and unusual chords
14900
+ "#4": [0, 6],
14901
+ "b5": [0, 6],
14902
+ "sus#4": [0, 6, 7],
14903
+ "7Msus#4": [0, 6, 11],
14904
+ "maj7sus#4": [0, 6, 11],
14905
+ "5": [0, 7],
14906
+ "11": [0, 7, 10, 14, 17],
14907
+ "5(8)": [0, 7, 12],
14908
+ "5add8": [0, 7, 12],
14909
+ "5(9)": [0, 7, 14],
14910
+ "5add9": [0, 7, 14],
14911
+ "#5": [0, 8],
14912
+ "b6": [0, 8]
14603
14913
  };
14604
14914
  ChordTrack.prototype.rhythmPatterns = {
14605
14915
  "2/2": ['boom', '', '', '', 'chick', '', '', ''],
@@ -15180,7 +15490,14 @@ function CreateSynth() {
15180
15490
  // There might be a previous run that needs to be turned off.
15181
15491
  self.stop();
15182
15492
  var noteMapTracks = createNoteMap(self.flattened);
15183
- if (self.options.swing) addSwing(noteMapTracks, self.options.swing, self.meterFraction, self.pickupLength);
15493
+ if (self.options.swing) {
15494
+ // If we have a drum intro, then the pickup is already incorporated into the beat.
15495
+ // That is, without a drum intro, the first note starts at 0 whether it
15496
+ // is a pickup or not. With a drum intro, the first note will be in its
15497
+ // proper place.
15498
+ var pickupLength = self.options.drumIntro ? 0 : self.pickupLength;
15499
+ addSwing(noteMapTracks, self.options.swing, self.meterFraction, pickupLength);
15500
+ }
15184
15501
  if (self.sequenceCallback) self.sequenceCallback(noteMapTracks, self.callbackContext);
15185
15502
  var panDistances = setPan(noteMapTracks.length, self.pan);
15186
15503
 
@@ -15393,7 +15710,7 @@ function CreateSynth() {
15393
15710
  };
15394
15711
  function addSwing(noteMapTracks, swing, meterFraction, pickupLength) {
15395
15712
  // we can only swing in X/4 and X/8 meters.
15396
- if (meterFraction.den != 4 && meterFraction.den != 8) return;
15713
+ if (meterFraction.den !== 4 && meterFraction.den !== 8) return;
15397
15714
  swing = parseFloat(swing);
15398
15715
 
15399
15716
  // 50 (or less) is no swing,
@@ -15411,7 +15728,7 @@ function CreateSynth() {
15411
15728
  // could be also in the settings. Try out values such 0.1, 0.2
15412
15729
  var volumeIncrease = 0.0;
15413
15730
 
15414
- // the beatLength in X/8 meters
15731
+ // the beatLength in X/4 meters
15415
15732
  var beatLength = 0.25;
15416
15733
 
15417
15734
  // in X/8 meters the 16s swing so the beatLength is halved
@@ -15428,11 +15745,11 @@ function CreateSynth() {
15428
15745
  var event = track[i];
15429
15746
  if (
15430
15747
  // is halfbeat
15431
- (event.start - pickupLength) % halfbeatLength == 0 && (event.start - pickupLength) % beatLength != 0 && (
15748
+ (event.start - pickupLength) % halfbeatLength === 0 && (event.start - pickupLength) % beatLength !== 0 && (
15432
15749
  // the previous note is on the beat or before OR there is no previous note
15433
- i == 0 || track[i - 1].start <= track[i].start - halfbeatLength) && (
15750
+ i === 0 || track[i - 1].start <= track[i].start - halfbeatLength) && (
15434
15751
  // the next note is on the beat or after OR there is no next note
15435
- i == track.length - 1 || track[i + 1].start >= track[i].start + halfbeatLength)) {
15752
+ i === track.length - 1 || track[i + 1].start >= track[i].start + halfbeatLength)) {
15436
15753
  var oldEventStart = event.start;
15437
15754
  event.start += swingDuration;
15438
15755
 
@@ -15441,7 +15758,7 @@ function CreateSynth() {
15441
15758
 
15442
15759
  // if there is a previous note ending at the start of this note, extend its end
15443
15760
  // and decrease its volume
15444
- if (i > 0 && track[i - 1].end == oldEventStart) {
15761
+ if (i > 0 && track[i - 1].end === oldEventStart) {
15445
15762
  track[i - 1].end = event.start;
15446
15763
  track[i - 1].volume *= 1 - volumeIncrease;
15447
15764
  }
@@ -16179,15 +16496,15 @@ function Repeats(voice) {
16179
16496
  index: thisIndex
16180
16497
  });
16181
16498
  }
16182
- if (isStartRepeat) this.sections.push({
16183
- type: "startRepeat",
16184
- index: thisIndex
16185
- });
16186
16499
  if (startEnding) this.sections.push({
16187
16500
  type: "startEnding",
16188
16501
  index: thisIndex,
16189
16502
  endings: startEnding
16190
16503
  });
16504
+ if (isStartRepeat) this.sections.push({
16505
+ type: "startRepeat",
16506
+ index: thisIndex
16507
+ });
16191
16508
  };
16192
16509
  this.resolveRepeats = function () {
16193
16510
  // this.sections contain all the interesting bars - start and end repeats.
@@ -23662,7 +23979,7 @@ function printLine(renderer, x1, x2, y, klass, name, dy) {
23662
23979
  var y1 = roundNumber(y - dy);
23663
23980
  var y2 = roundNumber(y + dy);
23664
23981
  // TODO-PER: This fixes a firefox bug where it isn't displayed
23665
- if (renderer.firefox112) {
23982
+ if (renderer.firefox) {
23666
23983
  y += dy / 2; // Because the y coordinate is the edge of where the line goes but the width widens from the middle.
23667
23984
  var attr = {
23668
23985
  x1: x1,
@@ -23726,7 +24043,7 @@ function printStem(renderer, x, dx, y1, y2, klass, name) {
23726
24043
  x = roundNumber(x);
23727
24044
  var x2 = roundNumber(x + dx);
23728
24045
  // TODO-PER: This fixes a firefox bug where it isn't displayed
23729
- if (renderer.firefox112) {
24046
+ if (renderer.firefox) {
23730
24047
  x += dx / 2; // Because the x coordinate is the edge of where the line goes but the width widens from the middle.
23731
24048
  var attr = {
23732
24049
  x1: x,
@@ -25356,7 +25673,7 @@ function splitSvgIntoLines(renderer, output, title, responsive, scale) {
25356
25673
  if (responsive !== 'resize') svg.setAttribute("height", height);
25357
25674
  if (responsive === 'resize') svg.style.position = '';
25358
25675
  // TODO-PER: Hack! Not sure why this is needed.
25359
- var viewBoxHeight = renderer.firefox112 ? height + 1 : height;
25676
+ var viewBoxHeight = renderer.firefox ? height + 1 : height;
25360
25677
  svg.setAttribute("viewBox", "0 " + nextTop + " " + width + " " + viewBoxHeight);
25361
25678
  svg.appendChild(style.cloneNode(true));
25362
25679
  var titleEl = document.createElement("title");
@@ -27642,7 +27959,7 @@ var Renderer = function Renderer(paper) {
27642
27959
  this.space = 3 * spacing.SPACE;
27643
27960
  this.padding = {}; // renderer's padding is managed by the controller
27644
27961
  this.reset();
27645
- this.firefox112 = navigator.userAgent.indexOf('Firefox/112.0') >= 0;
27962
+ this.firefox = navigator.userAgent.indexOf('Firefox/') >= 0;
27646
27963
  };
27647
27964
  Renderer.prototype.reset = function () {
27648
27965
  this.paper.clear();
@@ -28190,7 +28507,7 @@ module.exports = Svg;
28190
28507
  \********************/
28191
28508
  /***/ (function(module) {
28192
28509
 
28193
- var version = '6.6.3';
28510
+ var version = '6.6.4';
28194
28511
  module.exports = version;
28195
28512
 
28196
28513
  /***/ })