aibandtab
Version:
aibandTab is a music notation and guitar tablature rendering library
1,322 lines (1,287 loc) โข 2.17 MB
JavaScript
/**
* aibandTab v1.0.9 (main, build 0)
*
* Copyright ยฉ 2025, Inter AI All rights reserved.
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.aibandTab = {}));
})(this, (function (exports) { 'use strict';
/**
* Lists all layout modes that are supported.
*/
exports.LayoutMode = void 0;
(function (LayoutMode) {
/**
* Bars are aligned in rows using a fixed width.
*/
LayoutMode[LayoutMode["Page"] = 0] = "Page";
/**
* Bars are aligned horizontally in one row
*/
LayoutMode[LayoutMode["Horizontal"] = 1] = "Horizontal";
})(exports.LayoutMode || (exports.LayoutMode = {}));
/**
* Lists all stave profiles controlling which staves are shown.
*/
exports.StaveProfile = void 0;
(function (StaveProfile) {
/**
* The profile is auto detected by the track configurations.
*/
StaveProfile[StaveProfile["Default"] = 0] = "Default";
/**
* Standard music notation and guitar tablature are rendered.
*/
StaveProfile[StaveProfile["ScoreTab"] = 1] = "ScoreTab";
/**
* Only standard music notation is rendered.
*/
StaveProfile[StaveProfile["Score"] = 2] = "Score";
/**
* Only guitar tablature is rendered.
*/
StaveProfile[StaveProfile["Tab"] = 3] = "Tab";
/**
* Only guitar tablature is rendered, but also rests and time signatures are not shown.
* This profile is typically used in multi-track scenarios.
*/
StaveProfile[StaveProfile["TabMixed"] = 4] = "TabMixed";
})(exports.StaveProfile || (exports.StaveProfile = {}));
/**
* This public class provides names for all general midi instruments.
*/
class GeneralMidi {
static getValue(name) {
if (!GeneralMidi._values) {
GeneralMidi._values = new Map();
}
name = name.toLowerCase().replaceAll(' ', '');
return GeneralMidi._values.has(name) ? GeneralMidi._values.get(name) : 0;
}
static isPiano(program) {
return program <= 7 || program >= 16 && program <= 23;
}
static isGuitar(program) {
return program >= 24 && program <= 39 || program === 105 || program === 43;
}
}
GeneralMidi._values = new Map([
['acousticgrandpiano', 0], ['brightacousticpiano', 1], ['electricgrandpiano', 2],
['honkytonkpiano', 3], ['electricpiano1', 4], ['electricpiano2', 5], ['harpsichord', 6],
['clavinet', 7], ['celesta', 8], ['glockenspiel', 9], ['musicbox', 10], ['vibraphone', 11],
['marimba', 12], ['xylophone', 13], ['tubularbells', 14], ['dulcimer', 15],
['drawbarorgan', 16], ['percussiveorgan', 17], ['rockorgan', 18], ['churchorgan', 19],
['reedorgan', 20], ['accordion', 21], ['harmonica', 22], ['tangoaccordion', 23],
['acousticguitarnylon', 24], ['acousticguitarsteel', 25], ['electricguitarjazz', 26],
['electricguitarclean', 27], ['electricguitarmuted', 28], ['overdrivenguitar', 29],
['distortionguitar', 30], ['guitarharmonics', 31], ['acousticbass', 32],
['electricbassfinger', 33], ['electricbasspick', 34], ['fretlessbass', 35],
['slapbass1', 36], ['slapbass2', 37], ['synthbass1', 38], ['synthbass2', 39],
['violin', 40], ['viola', 41], ['cello', 42], ['contrabass', 43], ['tremolostrings', 44],
['pizzicatostrings', 45], ['orchestralharp', 46], ['timpani', 47], ['stringensemble1', 48],
['stringensemble2', 49], ['synthstrings1', 50], ['synthstrings2', 51], ['choiraahs', 52],
['voiceoohs', 53], ['synthvoice', 54], ['orchestrahit', 55], ['trumpet', 56],
['trombone', 57], ['tuba', 58], ['mutedtrumpet', 59], ['frenchhorn', 60],
['brasssection', 61], ['synthbrass1', 62], ['synthbrass2', 63], ['sopranosax', 64],
['altosax', 65], ['tenorsax', 66], ['baritonesax', 67], ['oboe', 68], ['englishhorn', 69],
['bassoon', 70], ['clarinet', 71], ['piccolo', 72], ['flute', 73], ['recorder', 74],
['panflute', 75], ['blownbottle', 76], ['shakuhachi', 77], ['whistle', 78], ['ocarina', 79],
['lead1square', 80], ['lead2sawtooth', 81], ['lead3calliope', 82], ['lead4chiff', 83],
['lead5charang', 84], ['lead6voice', 85], ['lead7fifths', 86], ['lead8bassandlead', 87],
['pad1newage', 88], ['pad2warm', 89], ['pad3polysynth', 90], ['pad4choir', 91],
['pad5bowed', 92], ['pad6metallic', 93], ['pad7halo', 94], ['pad8sweep', 95],
['fx1rain', 96], ['fx2soundtrack', 97], ['fx3crystal', 98], ['fx4atmosphere', 99],
['fx5brightness', 100], ['fx6goblins', 101], ['fx7echoes', 102], ['fx8scifi', 103],
['sitar', 104], ['banjo', 105], ['shamisen', 106], ['koto', 107], ['kalimba', 108],
['bagpipe', 109], ['fiddle', 110], ['shanai', 111], ['tinklebell', 112], ['agogo', 113],
['steeldrums', 114], ['woodblock', 115], ['taikodrum', 116], ['melodictom', 117],
['synthdrum', 118], ['reversecymbal', 119], ['guitarfretnoise', 120], ['breathnoise', 121],
['seashore', 122], ['birdtweet', 123], ['telephonering', 124], ['helicopter', 125],
['applause', 126], ['gunshot', 127]
]);
/**
* This is the base public class for creating new song importers which
* enable reading scores from any binary datasource
*/
class ScoreImporter {
/**
* Initializes the importer with the given data and settings.
*/
init(data, settings) {
this.data = data;
this.settings = settings;
}
}
exports.AibandTabErrorType = void 0;
(function (AibandTabErrorType) {
AibandTabErrorType[AibandTabErrorType["General"] = 0] = "General";
AibandTabErrorType[AibandTabErrorType["Format"] = 1] = "Format";
AibandTabErrorType[AibandTabErrorType["AibandTex"] = 2] = "AibandTex";
})(exports.AibandTabErrorType || (exports.AibandTabErrorType = {}));
class AibandTabError extends Error {
constructor(type, message = "", inner) {
super(message ?? "", { cause: inner });
this.type = type;
Object.setPrototypeOf(this, AibandTabError.prototype);
}
}
/**
* The exception thrown by a {@link ScoreImporter} in case the
* binary data does not contain a reader compatible structure.
*/
class UnsupportedFormatError extends AibandTabError {
constructor(message = null, inner) {
super(exports.AibandTabErrorType.Format, message ?? 'Unsupported format', inner);
Object.setPrototypeOf(this, UnsupportedFormatError.prototype);
}
}
/**
* Lists all types of note acceuntations
*/
var AccentuationType;
(function (AccentuationType) {
/**
* No accentuation
*/
AccentuationType[AccentuationType["None"] = 0] = "None";
/**
* Normal accentuation
*/
AccentuationType[AccentuationType["Normal"] = 1] = "Normal";
/**
* Heavy accentuation
*/
AccentuationType[AccentuationType["Heavy"] = 2] = "Heavy";
/**
* Tenuto accentuation
*/
AccentuationType[AccentuationType["Tenuto"] = 3] = "Tenuto";
})(AccentuationType || (AccentuationType = {}));
/**
* This public enumeration lists all types of automations.
*/
var AutomationType;
(function (AutomationType) {
/**
* Tempo change.
*/
AutomationType[AutomationType["Tempo"] = 0] = "Tempo";
/**
* Colume change.
*/
AutomationType[AutomationType["Volume"] = 1] = "Volume";
/**
* Instrument change.
*/
AutomationType[AutomationType["Instrument"] = 2] = "Instrument";
/**
* Balance change.
*/
AutomationType[AutomationType["Balance"] = 3] = "Balance";
})(AutomationType || (AutomationType = {}));
/**
* Automations are used to change the behaviour of a song.
* @cloneable
* @json
* @json_strict
*/
class Automation {
constructor() {
/**
* Gets or sets whether the automation is applied linear.
*/
this.isLinear = false;
/**
* Gets or sets the type of the automation.
*/
this.type = AutomationType.Tempo;
/**
* Gets or sets the target value of the automation.
*/
this.value = 0;
/**
* Gets or sets the relative position of of the automation.
*/
this.ratioPosition = 0;
/**
* Gets or sets the additional text of the automation.
*/
this.text = '';
}
static buildTempoAutomation(isLinear, ratioPosition, value, reference) {
if (reference < 1 || reference > 5) {
reference = 2;
}
let references = new Float32Array([1, 0.5, 1.0, 1.5, 2.0, 3.0]);
let automation = new Automation();
automation.type = AutomationType.Tempo;
automation.isLinear = isLinear;
automation.ratioPosition = ratioPosition;
automation.value = value * references[reference];
return automation;
}
static buildInstrumentAutomation(isLinear, ratioPosition, value) {
let automation = new Automation();
automation.type = AutomationType.Instrument;
automation.isLinear = isLinear;
automation.ratioPosition = ratioPosition;
automation.value = value;
return automation;
}
}
/**
* This public enumeration lists all supported Clefs.
* What is a Clef?
A Clef is a musical symbol used in sheet music to indicate the pitch range and position of notes on the staff. It tells musicians which notes correspond to which lines and spaces on the staff, essentially setting the "reference point" for reading music.
The word "Clef" comes from the French word for "key," as it provides the "key" to understanding the notes on the staff.
Explanation of the Clefs in Your Code
In the code you provided, the Clef enumeration lists different types of clefs. Hereโs what they mean:
1. Neutral Clef
Description: The neutral clef does not assign specific pitches to lines or spaces.
Use Case: It is typically used for unpitched percussion instruments, like drums, where the height of the note on the staff does not represent a pitch.
2. C Clefs (C3 and C4)
Description: The C clef indicates the position of Middle C (C4) on the staff. It can be shifted to different lines to adjust the pitch range for specific instruments.
C3 Clef: Middle C is placed on the third line of the staff.
C4 Clef: Middle C is placed on the fourth line of the staff.
Use Case:
The C clef is commonly used for instruments with a midrange pitch, such as the viola (Alto Clef) or some vocal parts (Tenor Clef).
3. F Clef (F4)
Description: The F clef (commonly known as the Bass Clef) indicates that the F below Middle C (F3) is located on the fourth line of the staff.
Use Case:
Used for low-pitched instruments, such as the cello, bass, trombone, and tuba.
4. G Clef (G2)
Description: The G clef (commonly known as the Treble Clef) indicates that the G above Middle C (G4) is located on the second line of the staff.
Use Case:
Used for high-pitched instruments, such as the violin, flute, clarinet, and trumpet, as well as for soprano and alto voices.
Summary of Clefs
Clef Name Symbol Purpose / Notes Typical Instruments / Voices
Neutral ๐ฅ For unpitched percussion; no defined pitches on the staff. Drums, cymbals, other percussion.
C3 ๐ผ Middle C on the third line of the staff (Alto Clef). Viola, alto trombone.
C4 ๐ผ Middle C on the fourth line of the staff (Tenor Clef). Cello, trombone, bassoon.
F4 ๐ผ F below Middle C on the fourth line (Bass Clef). Cello, bass, tuba, bassoon.
G2 ๐ผ G above Middle C on the second line (Treble Clef). Violin, flute, clarinet, trumpet, soprano voice.
Each clef determines how notes are interpreted on the staff and is essential for reading and playing music across different instruments and vocal ranges.
*/
var Clef;
(function (Clef) {
/**
* Neutral clef.
*/
Clef[Clef["Neutral"] = 0] = "Neutral";
/**
* C3 clef
*/
Clef[Clef["C3"] = 1] = "C3";
/**
* C4 clef
*/
Clef[Clef["C4"] = 2] = "C4";
/**
* F4 clef
*/
Clef[Clef["F4"] = 3] = "F4";
/**
* G2 clef
*/
Clef[Clef["G2"] = 4] = "G2";
})(Clef || (Clef = {}));
/**
* Lists all ottavia.
*/
var Ottavia;
(function (Ottavia) {
/**
* 2 octaves higher
*/
Ottavia[Ottavia["_15ma"] = 0] = "_15ma";
/**
* 1 octave higher
*/
Ottavia[Ottavia["_8va"] = 1] = "_8va";
/**
* Normal
*/
Ottavia[Ottavia["Regular"] = 2] = "Regular";
/**
* 1 octave lower
*/
Ottavia[Ottavia["_8vb"] = 3] = "_8vb";
/**
* 2 octaves lower.
*/
Ottavia[Ottavia["_15mb"] = 4] = "_15mb";
})(Ottavia || (Ottavia = {}));
/**
* Lists all simile mark types as they are assigned to bars.
*/
var SimileMark;
(function (SimileMark) {
/**
* No simile mark is applied
*/
SimileMark[SimileMark["None"] = 0] = "None";
/**
* A simple simile mark. The previous bar is repeated.
*/
SimileMark[SimileMark["Simple"] = 1] = "Simple";
/**
* A double simile mark. This value is assigned to the first
* bar of the 2 repeat bars.
*/
SimileMark[SimileMark["FirstOfDouble"] = 2] = "FirstOfDouble";
/**
* A double simile mark. This value is assigned to the second
* bar of the 2 repeat bars.
*/
SimileMark[SimileMark["SecondOfDouble"] = 3] = "SecondOfDouble";
})(SimileMark || (SimileMark = {}));
/**
* The different pedal marker types.
*/
var SustainPedalMarkerType;
(function (SustainPedalMarkerType) {
/**
* Indicates that the pedal should be pressed from this time on.
*/
SustainPedalMarkerType[SustainPedalMarkerType["Down"] = 0] = "Down";
/**
* Indicates that the pedal should be held on this marker (used when the pedal is held for the whole bar)
*/
SustainPedalMarkerType[SustainPedalMarkerType["Hold"] = 1] = "Hold";
/**
* indicates that the pedal should be lifted up at this time.
*/
SustainPedalMarkerType[SustainPedalMarkerType["Up"] = 2] = "Up";
})(SustainPedalMarkerType || (SustainPedalMarkerType = {}));
/**
* A marker on whether a sustain pedal starts or ends.
* @json
* @json_strict
*/
class SustainPedalMarker {
constructor() {
/**
* The relative position of pedal markers within the bar.
*/
this.ratioPosition = 0;
/**
* Whether what should be done with the pedal at this point
*/
this.pedalType = SustainPedalMarkerType.Down;
/**
* The next pedal marker for linking the related markers together to a "down -> hold -> up" or "down -> up" sequence.
* Always null for "up" markers.
* @json_ignore
*/
this.nextPedalMarker = null;
/**
* The previous pedal marker for linking the related markers together to a "down -> hold -> up" or "down -> up" sequence.
* Always null for "down" markers.
* @json_ignore
*/
this.previousPedalMarker = null;
}
}
/**
* A bar is a single block within a track, also known as Measure.
* @json
* @json_strict
*/
class Bar {
constructor() {
/**
* Gets or sets the unique id of this bar.
*/
this.id = Bar._globalBarId++;
/**
* Gets or sets the zero-based index of this bar within the staff.
* @json_ignore
*/
this.index = 0;
/**
* Gets or sets the next bar that comes after this bar.
* @json_ignore
*/
this.nextBar = null;
/**
* Gets or sets the previous bar that comes before this bar.
* @json_ignore
*/
this.previousBar = null;
/**
* Gets or sets the clef on this bar.
*/
this.clef = Clef.G2;
/**
* Gets or sets the ottava applied to the clef.
*/
this.clefOttava = Ottavia.Regular;
/**
* Gets or sets the list of voices contained in this bar.
* @json_add addVoice
*/
this.voices = [];
/**
* Gets or sets the simile mark on this bar.
*/
this.simileMark = SimileMark.None;
/**
* Gets a value indicating whether this bar contains multiple voices with notes.
* @json_ignore
*/
this.isMultiVoice = false;
/**
* A relative scale for the size of the bar when displayed. The scale is relative
* within a single line (system). The sum of all scales in one line make the total width,
* and then this individual scale gives the relative size.
*/
this.displayScale = 1;
/**
* An absolute width of the bar to use when displaying in single track display scenarios.
*/
this.displayWidth = -1;
/**
* The sustain pedal markers within this bar.
*/
this.sustainPedals = [];
}
get masterBar() {
return this.staff.track.score.masterBars[this.index];
}
get isEmpty() {
for (let i = 0, j = this.voices.length; i < j; i++) {
if (!this.voices[i].isEmpty) {
return false;
}
}
return true;
}
addVoice(voice) {
voice.bar = this;
voice.index = this.voices.length;
this.voices.push(voice);
}
finish(settings, sharedDataBag = null) {
this.isMultiVoice = false;
for (let i = 0, j = this.voices.length; i < j; i++) {
let voice = this.voices[i];
voice.finish(settings, sharedDataBag);
if (i > 0 && !voice.isEmpty) {
this.isMultiVoice = true;
}
}
// chain sustain pedal markers
if (this.sustainPedals.length > 0) {
let previousMarker = null;
if (this.previousBar && this.previousBar.sustainPedals.length > 0) {
previousMarker = this.previousBar.sustainPedals[this.previousBar.sustainPedals.length - 1];
}
for (const marker of this.sustainPedals) {
if (previousMarker && previousMarker.pedalType !== SustainPedalMarkerType.Up) {
previousMarker.nextPedalMarker = marker;
marker.previousPedalMarker = previousMarker;
}
marker.bar = this;
previousMarker = marker;
}
}
else if (this.previousBar && this.previousBar.sustainPedals.length > 0) {
const lastMarker = this.previousBar.sustainPedals[this.previousBar.sustainPedals.length - 1];
if (lastMarker.pedalType !== SustainPedalMarkerType.Up) {
// create hold marker if the last marker on the previous bar is not "up"
const holdMarker = new SustainPedalMarker();
holdMarker.ratioPosition = 0;
holdMarker.bar = this;
holdMarker.pedalType = SustainPedalMarkerType.Hold;
this.sustainPedals.push(holdMarker);
lastMarker.nextPedalMarker = holdMarker;
holdMarker.previousPedalMarker = lastMarker;
}
}
}
calculateDuration() {
let duration = 0;
for (let voice of this.voices) {
let voiceDuration = voice.calculateDuration();
if (voiceDuration > duration) {
duration = voiceDuration;
}
}
return duration;
}
}
Bar._globalBarId = 0;
class MidiUtils {
/**
* Converts the given midi tick duration into milliseconds.
* @param ticks The duration in midi ticks
* @param tempo The current tempo in BPM.
* @returns The converted duration in milliseconds.
*/
static ticksToMillis(ticks, tempo) {
return (ticks * (60000.0 / (tempo * MidiUtils.QuarterTime))) | 0;
}
/**
* Converts the given midi tick duration into milliseconds.
* @param millis The duration in milliseconds
* @param tempo The current tempo in BPM.
* @returns The converted duration in midi ticks.
*/
static millisToTicks(millis, tempo) {
return (millis / (60000.0 / (tempo * MidiUtils.QuarterTime))) | 0;
}
/**
* Converts a duration value to its ticks equivalent.
*/
static toTicks(duration) {
return MidiUtils.valueToTicks(duration);
}
/**
* Converts a numerical value to its ticks equivalent.
* @param duration the numerical proportion to convert. (i.E. timesignature denominator, note duration,...)
*/
static valueToTicks(duration) {
let denomninator = duration;
if (denomninator < 0) {
denomninator = 1 / -denomninator;
}
return (MidiUtils.QuarterTime * (4.0 / denomninator)) | 0;
}
static applyDot(ticks, doubleDotted) {
if (doubleDotted) {
return ticks + ((ticks / 4) | 0) * 3;
}
return ticks + ((ticks / 2) | 0);
}
static applyTuplet(ticks, numerator, denominator) {
return ((ticks * denominator) / numerator) | 0;
}
static removeTuplet(ticks, numerator, denominator) {
return ((ticks * numerator) / denominator) | 0;
}
static dynamicToVelocity(dynamicsSteps) {
return MidiUtils.MinVelocity + dynamicsSteps * MidiUtils.VelocityIncrement;
}
}
MidiUtils.QuarterTime = 960;
MidiUtils.MinVelocity = 15;
MidiUtils.VelocityIncrement = 16;
/**
* A single point of a bending graph. Used to
* describe WhammyBar and String Bending effects.
* @cloneable
* @json
* @json_strict
*/
class BendPoint {
/**
* Initializes a new instance of the {@link BendPoint} class.
* @param offset The offset.
* @param value The value.
*/
constructor(offset = 0, value = 0) {
this.offset = offset;
this.value = value;
}
}
BendPoint.MaxPosition = 60;
BendPoint.MaxValue = 12;
/**
* Lists the different bend styles
*/
var BendStyle;
(function (BendStyle) {
/**
* The bends are as described by the bend points
*/
BendStyle[BendStyle["Default"] = 0] = "Default";
/**
* The bends are gradual over the beat duration.
*/
BendStyle[BendStyle["Gradual"] = 1] = "Gradual";
/**
* The bends are done fast before the next note.
*/
BendStyle[BendStyle["Fast"] = 2] = "Fast";
})(BendStyle || (BendStyle = {}));
/**
* Lists all types of bends
*/
var BendType;
(function (BendType) {
/**
* No bend at all
*/
BendType[BendType["None"] = 0] = "None";
/**
* Individual points define the bends in a flexible manner.
* This system was mainly used in Guitar Pro 3-5
*/
BendType[BendType["Custom"] = 1] = "Custom";
/**
* Simple Bend from an unbended string to a higher note.
*/
BendType[BendType["Bend"] = 2] = "Bend";
/**
* Release of a bend that was started on an earlier note.
*/
BendType[BendType["Release"] = 3] = "Release";
/**
* A bend that starts from an unbended string,
* and also releases the bend after some time.
*/
BendType[BendType["BendRelease"] = 4] = "BendRelease";
/**
* Holds a bend that was started on an earlier note
*/
BendType[BendType["Hold"] = 5] = "Hold";
/**
* A bend that is already started before the note is played then it is held until the end.
*/
BendType[BendType["Prebend"] = 6] = "Prebend";
/**
* A bend that is already started before the note is played and
* bends even further, then it is held until the end.
*/
BendType[BendType["PrebendBend"] = 7] = "PrebendBend";
/**
* A bend that is already started before the note is played and
* then releases the bend to a lower note where it is held until the end.
*/
BendType[BendType["PrebendRelease"] = 8] = "PrebendRelease";
})(BendType || (BendType = {}));
/**
* Lists all types of how to brush multiple notes on a beat.
*/
var BrushType;
(function (BrushType) {
/**
* No brush.
*/
BrushType[BrushType["None"] = 0] = "None";
/**
* Normal brush up.
*/
BrushType[BrushType["BrushUp"] = 1] = "BrushUp";
/**
* Normal brush down.
*/
BrushType[BrushType["BrushDown"] = 2] = "BrushDown";
/**
* Arpeggio up.
*/
BrushType[BrushType["ArpeggioUp"] = 3] = "ArpeggioUp";
/**
* Arpeggio down.
*/
BrushType[BrushType["ArpeggioDown"] = 4] = "ArpeggioDown";
})(BrushType || (BrushType = {}));
/**
* Lists all Crescendo and Decrescendo types.
*/
var CrescendoType;
(function (CrescendoType) {
/**
* No crescendo applied.
*/
CrescendoType[CrescendoType["None"] = 0] = "None";
/**
* Normal crescendo applied.
*/
CrescendoType[CrescendoType["Crescendo"] = 1] = "Crescendo";
/**
* Normal decrescendo applied.
*/
CrescendoType[CrescendoType["Decrescendo"] = 2] = "Decrescendo";
})(CrescendoType || (CrescendoType = {}));
/**
* Lists all durations of a beat.
*/
var Duration;
(function (Duration) {
/**
* A quadruple whole note duration
*/
Duration[Duration["QuadrupleWhole"] = -4] = "QuadrupleWhole";
/**
* A double whole note duration
*/
Duration[Duration["DoubleWhole"] = -2] = "DoubleWhole";
/**
* A whole note duration
*/
Duration[Duration["Whole"] = 1] = "Whole";
/**
* A 1/2 note duration
*/
Duration[Duration["Half"] = 2] = "Half";
/**
* A 1/4 note duration
*/
Duration[Duration["Quarter"] = 4] = "Quarter";
/**
* A 1/8 note duration
*/
Duration[Duration["Eighth"] = 8] = "Eighth";
/**
* A 1/16 note duration
*/
Duration[Duration["Sixteenth"] = 16] = "Sixteenth";
/**
* A 1/32 note duration
*/
Duration[Duration["ThirtySecond"] = 32] = "ThirtySecond";
/**
* A 1/64 note duration
*/
Duration[Duration["SixtyFourth"] = 64] = "SixtyFourth";
/**
* A 1/128 note duration
*/
Duration[Duration["OneHundredTwentyEighth"] = 128] = "OneHundredTwentyEighth";
/**
* A 1/256 note duration
*/
Duration[Duration["TwoHundredFiftySixth"] = 256] = "TwoHundredFiftySixth";
})(Duration || (Duration = {}));
/**
* Lists all dynamics.
*/
var DynamicValue;
(function (DynamicValue) {
/**
* pianississimo (very very soft)
*/
DynamicValue[DynamicValue["PPP"] = 0] = "PPP";
/**
* pianissimo (very soft)
*/
DynamicValue[DynamicValue["PP"] = 1] = "PP";
/**
* piano (soft)
*/
DynamicValue[DynamicValue["P"] = 2] = "P";
/**
* mezzo-piano (half soft)
*/
DynamicValue[DynamicValue["MP"] = 3] = "MP";
/**
* mezzo-forte (half loud)
*/
DynamicValue[DynamicValue["MF"] = 4] = "MF";
/**
* forte (loud)
*/
DynamicValue[DynamicValue["F"] = 5] = "F";
/**
* fortissimo (very loud)
*/
DynamicValue[DynamicValue["FF"] = 6] = "FF";
/**
* fortississimo (very very loud)
*/
DynamicValue[DynamicValue["FFF"] = 7] = "FFF";
})(DynamicValue || (DynamicValue = {}));
/**
* Lists all types of grace notes
*/
var GraceType;
(function (GraceType) {
/**
* No grace, normal beat.
*/
GraceType[GraceType["None"] = 0] = "None";
/**
* The beat contains on-beat grace notes.
*/
GraceType[GraceType["OnBeat"] = 1] = "OnBeat";
/**
* The beat contains before-beat grace notes.
*/
GraceType[GraceType["BeforeBeat"] = 2] = "BeforeBeat";
/**
* The beat contains very special bend-grace notes used in SongBook style displays.
*/
GraceType[GraceType["BendGrace"] = 3] = "BendGrace";
})(GraceType || (GraceType = {}));
/**
* Lists all fingers.
*/
var Fingers;
(function (Fingers) {
/**
* Unknown type (not documented)
*/
Fingers[Fingers["Unknown"] = -2] = "Unknown";
/**
* No finger, dead note
*/
Fingers[Fingers["NoOrDead"] = -1] = "NoOrDead";
/**
* The thumb
*/
Fingers[Fingers["Thumb"] = 0] = "Thumb";
/**
* The index finger
*/
Fingers[Fingers["IndexFinger"] = 1] = "IndexFinger";
/**
* The middle finger
*/
Fingers[Fingers["MiddleFinger"] = 2] = "MiddleFinger";
/**
* The annular finger
*/
Fingers[Fingers["AnnularFinger"] = 3] = "AnnularFinger";
/**
* The little finger
*/
Fingers[Fingers["LittleFinger"] = 4] = "LittleFinger";
})(Fingers || (Fingers = {}));
/**
* Lists all harmonic types.
*/
var HarmonicType;
(function (HarmonicType) {
/**
* No harmonics.
*/
HarmonicType[HarmonicType["None"] = 0] = "None";
/**
* Natural harmonic
*/
HarmonicType[HarmonicType["Natural"] = 1] = "Natural";
/**
* Artificial harmonic
*/
HarmonicType[HarmonicType["Artificial"] = 2] = "Artificial";
/**
* Pinch harmonics
*/
HarmonicType[HarmonicType["Pinch"] = 3] = "Pinch";
/**
* Tap harmonics
*/
HarmonicType[HarmonicType["Tap"] = 4] = "Tap";
/**
* Semi harmonics
*/
HarmonicType[HarmonicType["Semi"] = 5] = "Semi";
/**
* Feedback harmonics
*/
HarmonicType[HarmonicType["Feedback"] = 6] = "Feedback";
})(HarmonicType || (HarmonicType = {}));
/**
* Lists the modes how accidentals are handled for notes
*/
var NoteAccidentalMode;
(function (NoteAccidentalMode) {
/**
* Accidentals are calculated automatically.
*/
NoteAccidentalMode[NoteAccidentalMode["Default"] = 0] = "Default";
/**
* This will try to ensure that no accidental is shown.
*/
NoteAccidentalMode[NoteAccidentalMode["ForceNone"] = 1] = "ForceNone";
/**
* This will move the note one line down and applies a Naturalize.
*/
NoteAccidentalMode[NoteAccidentalMode["ForceNatural"] = 2] = "ForceNatural";
/**
* This will move the note one line down and applies a Sharp.
*/
NoteAccidentalMode[NoteAccidentalMode["ForceSharp"] = 3] = "ForceSharp";
/**
* This will move the note to be shown 2 half-notes deeper with a double sharp symbol
*/
NoteAccidentalMode[NoteAccidentalMode["ForceDoubleSharp"] = 4] = "ForceDoubleSharp";
/**
* This will move the note one line up and applies a Flat.
*/
NoteAccidentalMode[NoteAccidentalMode["ForceFlat"] = 5] = "ForceFlat";
/**
* This will move the note two half notes up with a double flag symbol.
*/
NoteAccidentalMode[NoteAccidentalMode["ForceDoubleFlat"] = 6] = "ForceDoubleFlat";
})(NoteAccidentalMode || (NoteAccidentalMode = {}));
/**
* This public enum lists all different types of finger slide-ins on a string.
*/
var SlideInType;
(function (SlideInType) {
/**
* No slide.
*/
SlideInType[SlideInType["None"] = 0] = "None";
/**
* Slide into the note from below on the same string.
*/
SlideInType[SlideInType["IntoFromBelow"] = 1] = "IntoFromBelow";
/**
* Slide into the note from above on the same string.
*/
SlideInType[SlideInType["IntoFromAbove"] = 2] = "IntoFromAbove";
})(SlideInType || (SlideInType = {}));
/**
* This public enum lists all different types of finger slide-outs on a string.
*/
var SlideOutType;
(function (SlideOutType) {
/**
* No slide.
*/
SlideOutType[SlideOutType["None"] = 0] = "None";
/**
* Shift slide to next note on same string
*/
SlideOutType[SlideOutType["Shift"] = 1] = "Shift";
/**
* Legato slide to next note on same string.
*/
SlideOutType[SlideOutType["Legato"] = 2] = "Legato";
/**
* Slide out from the note from upwards on the same string.
*/
SlideOutType[SlideOutType["OutUp"] = 3] = "OutUp";
/**
* Slide out from the note from downwards on the same string.
*/
SlideOutType[SlideOutType["OutDown"] = 4] = "OutDown";
/**
* Pickslide down on this note
*/
SlideOutType[SlideOutType["PickSlideDown"] = 5] = "PickSlideDown";
/**
* Pickslide up on this note
*/
SlideOutType[SlideOutType["PickSlideUp"] = 6] = "PickSlideUp";
})(SlideOutType || (SlideOutType = {}));
/**
* This public enum lists all vibrato types that can be performed.
*/
var VibratoType;
(function (VibratoType) {
/**
* No vibrato.
*/
VibratoType[VibratoType["None"] = 0] = "None";
/**
* A slight vibrato.
*/
VibratoType[VibratoType["Slight"] = 1] = "Slight";
/**
* A wide vibrato.
*/
VibratoType[VibratoType["Wide"] = 2] = "Wide";
})(VibratoType || (VibratoType = {}));
/**
* Lists the different modes on how rhythm notation is shown on the tab staff.
*/
exports.TabRhythmMode = void 0;
(function (TabRhythmMode) {
/**
* Rhythm notation is hidden.
*/
TabRhythmMode[TabRhythmMode["Hidden"] = 0] = "Hidden";
/**
* Rhythm notation is shown with individual beams per beat.
*/
TabRhythmMode[TabRhythmMode["ShowWithBeams"] = 1] = "ShowWithBeams";
/**
* Rhythm notation is shown and behaves like normal score notation with connected bars.
*/
TabRhythmMode[TabRhythmMode["ShowWithBars"] = 2] = "ShowWithBars";
/**
* Automatic detection whether the tabs should show rhythm based on hidden standard notation.
*/
TabRhythmMode[TabRhythmMode["Automatic"] = 3] = "Automatic";
})(exports.TabRhythmMode || (exports.TabRhythmMode = {}));
/**
* Lists all modes on how fingerings should be displayed.
*/
exports.FingeringMode = void 0;
(function (FingeringMode) {
/**
* Fingerings will be shown in the standard notation staff.
*/
FingeringMode[FingeringMode["ScoreDefault"] = 0] = "ScoreDefault";
/**
* Fingerings will be shown in the standard notation staff. Piano finger style is enforced, where
* fingers are rendered as 1-5 instead of p,i,m,a,c and T,1,2,3,4.
*/
FingeringMode[FingeringMode["ScoreForcePiano"] = 1] = "ScoreForcePiano";
/**
* Fingerings will be shown in a effect band above the tabs in case
* they have only a single note on the beat.
*/
FingeringMode[FingeringMode["SingleNoteEffectBand"] = 2] = "SingleNoteEffectBand";
/**
* Fingerings will be shown in a effect band above the tabs in case
* they have only a single note on the beat. Piano finger style is enforced, where
* fingers are rendered as 1-5 instead of p,i,m,a,c and T,1,2,3,4.
*/
FingeringMode[FingeringMode["SingleNoteEffectBandForcePiano"] = 3] = "SingleNoteEffectBandForcePiano";
})(exports.FingeringMode || (exports.FingeringMode = {}));
/**
* Lists all modes on how alphaTab can handle the display and playback of music notation.
*/
exports.NotationMode = void 0;
(function (NotationMode) {
/**
* Music elements will be displayed and played as in Guitar Pro.
*/
NotationMode[NotationMode["GuitarPro"] = 0] = "GuitarPro";
/**
* Music elements will be displayed and played as in traditional songbooks.
* Changes:
* 1. Bends
* For bends additional grace beats are introduced.
* Bends are categorized into gradual and fast bends.
* - Gradual bends are indicated by beat text "grad" or "grad.". Bend will sound along the beat duration.
* - Fast bends are done right before the next note. If the next note is tied even on-beat of the next note.
* 2. Whammy Bars
* Dips are shown as simple annotation over the beats
* Whammy Bars are categorized into gradual and fast.
* - Gradual whammys are indicated by beat text "grad" or "grad.". Whammys will sound along the beat duration.
* - Fast whammys are done right the beat.
* 3. Let Ring
* Tied notes with let ring are not shown in standard notation
* Let ring does not cause a longer playback, duration is defined via tied notes.
*/
NotationMode[NotationMode["SongBook"] = 1] = "SongBook";
})(exports.NotationMode || (exports.NotationMode = {}));
/**
* Lists all major music notation elements that are part
* of the music sheet and can be dynamically controlled to be shown
* or hidden.
*/
var NotationElement;
(function (NotationElement) {
/**
* The score title shown at the start of the music sheet.
*/
NotationElement[NotationElement["ScoreTitle"] = 0] = "ScoreTitle";
/**
* The score subtitle shown at the start of the music sheet.
*/
NotationElement[NotationElement["ScoreSubTitle"] = 1] = "ScoreSubTitle";
/**
* The score artist shown at the start of the music sheet.
*/
NotationElement[NotationElement["ScoreArtist"] = 2] = "ScoreArtist";
/**
* The score album shown at the start of the music sheet.
*/
NotationElement[NotationElement["ScoreAlbum"] = 3] = "ScoreAlbum";
/**
* The score words author shown at the start of the music sheet.
*/
NotationElement[NotationElement["ScoreWords"] = 4] = "ScoreWords";
/**
* The score music author shown at the start of the music sheet.
*/
NotationElement[NotationElement["ScoreMusic"] = 5] = "ScoreMusic";
/**
* The score words&music author shown at the start of the music sheet.
*/
NotationElement[NotationElement["ScoreWordsAndMusic"] = 6] = "ScoreWordsAndMusic";
/**
* The score copyright owner shown at the start of the music sheet.
*/
NotationElement[NotationElement["ScoreCopyright"] = 7] = "ScoreCopyright";
/**
* The tuning information of the guitar shown
* above the staves.
*/
NotationElement[NotationElement["GuitarTuning"] = 8] = "GuitarTuning";
/**
* The track names which are shown in the accolade.
*/
NotationElement[NotationElement["TrackNames"] = 9] = "TrackNames";
/**
* The chord diagrams for guitars. Usually shown
* below the score info.
*/
NotationElement[NotationElement["ChordDiagrams"] = 10] = "ChordDiagrams";
/**
* Parenthesis that are shown for tied bends
* if they are preceeded by bends.
*/
NotationElement[NotationElement["ParenthesisOnTiedBends"] = 11] = "ParenthesisOnTiedBends";
/**
* The tab number for tied notes if the
* bend of a note is increased at that point.
*/
NotationElement[NotationElement["TabNotesOnTiedBends"] = 12] = "TabNotesOnTiedBends";
/**
* Zero tab numbers on "dive whammys".
*/
NotationElement[NotationElement["ZerosOnDiveWhammys"] = 13] = "ZerosOnDiveWhammys";
/**
* The alternate endings information on repeats shown above the staff.
*/
NotationElement[NotationElement["EffectAlternateEndings"] = 14] = "EffectAlternateEndings";
/**
* The information about the fret on which the capo is placed shown above the staff.
*/
NotationElement[NotationElement["EffectCapo"] = 15] = "EffectCapo";
/**
* The chord names shown above beats shown above the staff.
*/
NotationElement[NotationElement["EffectChordNames"] = 16] = "EffectChordNames";
/**
* The crescendo/decrescendo angle shown above the staff.
*/
NotationElement[NotationElement["EffectCrescendo"] = 17] = "EffectCrescendo";
/**
* The beat dynamics shown above the staff.
*/
NotationElement[NotationElement["EffectDynamics"] = 18] = "EffectDynamics";
/**
* The curved angle for fade in/out effects shown above the staff.
*/
NotationElement[NotationElement["EffectFadeIn"] = 19] = "EffectFadeIn";
/**
* The fermata symbol shown above the staff.
*/
NotationElement[NotationElement["EffectFermata"] = 20] = "EffectFermata";
/**
* The fingering information.
*/
NotationElement[NotationElement["EffectFingering"] = 21] = "EffectFingering";
/**
* The harmonics names shown above the staff.
* (does not represent the harmonic note heads)
*/
NotationElement[NotationElement["EffectHarmonics"] = 22] = "EffectHarmonics";
/**
* The let ring name and line above the staff.
*/
NotationElement[NotationElement["EffectLetRing"] = 23] = "EffectLetRing";
/**
* The lyrics of the track shown above the staff.
*/
NotationElement[NotationElement["EffectLyrics"] = 24] = "EffectLyrics";
/**
* The section markers shown above the staff.
*/
NotationElement[NotationElement["EffectMarker"] = 25] = "EffectMarker";
/**
* The ottava symbol and lines shown above the staff.
*/
NotationElement[NotationElement["EffectOttavia"] = 26] = "EffectOttavia";
/**
* The palm mute name and line shown above the staff.
*/
NotationElement[NotationElement["EffectPalmMute"] = 27] = "EffectPalmMute";
/**
* The pick slide information shown above the staff.
* (does not control the pick slide lines)
*/
NotationElement[NotationElement["EffectPickSlide"] = 28] = "EffectPickSlide";
/**
* The pick stroke symbols shown above the staff.
*/
NotationElement[NotationElement["EffectPickStroke"] = 29] = "EffectPickStroke";
/**
* The slight beat vibrato waves shown above the staff.
*/
NotationElement[NotationElement["EffectSlightBeatVibrato"] = 30] = "EffectSlightBeatVibrato";
/**
* The slight note vibrato waves shown above the staff.
*/
NotationElement[NotationElement["EffectSlightNoteVibrato"] = 31] = "EffectSlightNoteVibrato";
/**
* The tap/slap/pop effect names shown above the staff.
*/
NotationElement[NotationElement["EffectTap"] = 32] = "EffectTap";
/**
* The tempo information shown above the staff.
*/
NotationElement[NotationElement["EffectTempo"] = 33] = "EffectTempo";
/**
* The additional beat text shown above the staff.
*/
NotationElement[NotationElement["EffectText"] = 34] = "EffectText";
/**
* The trill name and waves shown above the staff.
*/
NotationElement[NotationElement["EffectTrill"] = 35] = "EffectTrill";
/**
* The triplet feel symbol shown above the staff.
*/
NotationElement[NotationElement["EffectTripletFeel"] = 36] = "EffectTripletFeel";
/**
* The whammy bar information shown above the staff.
* (does not control the whammy lines shown within the staff)
*/
NotationElement[NotationElement["EffectWhammyBar"] = 37] = "EffectWhammyBar";
/**
* The wide beat vibrato waves shown above the staff.
*/
NotationElement[NotationElement["EffectWideBeatVibrato"] = 38] = "EffectWideBeatVibrato";
/**
* The wide note vibrato waves shown above the staff.
*/
NotationElement[NotationElement["EffectWideNoteVibrato"] = 39] = "EffectWideNoteVibrato";
/**
* The left hand tap symbol shown above the staff.
*/
NotationElement[NotationElement["EffectLeftHandTap"] = 40] = "EffectLeftHandTap";
/**
* The "Free time" text shown above the staff.
*/
NotationElement[NotationElement["EffectFreeTime"] = 41] = "EffectFreeTime";
/**
* The Sustain pedal effect shown above the staff "Ped.____*"
*/
NotationElement[NotationElement["EffectSustainPedal"] = 42] = "EffectSustainPedal";
/**
* The Golpe effect signs above and below the staff.
*/
NotationElement[NotationElement["EffectGolpe"] = 43] = "EffectGolpe";
/**
* The Wah effect signs above and below the staff.
*/
NotationElement[NotationElement["EffectWahPedal"] = 44] = "EffectWahPedal";
/**
* The Beat barre effect signs above and below the staff "1/2B IV โโโโโโ"
*/
NotationElement[NotationElement["EffectBeatBarre"] = 45] = "EffectBeatBarre";
/**
* The note ornaments like turns and mordents.
*/
NotationElement[NotationElement["EffectNoteOrnament"] = 46] = "EffectNoteOrnament";
/**
* The Rasgueado indicator above the staff Rasg. ----|"
*/
NotationElement[NotationElement["EffectRasgueado"] = 47] = "EffectRasgueado";
})(NotationElement || (NotationElement = {}));
/**
* The notation settings control how various music notation elements are shown and behaving
* @json
* @json_declaration
*/
class NotationSettings {
constructor() {
/**
* Gets or sets the mode to use for display and play music notation elements.
*/
this.notationMode = exports.NotationMode.GuitarPro;
/**
* Gets or sets the fingering mode to use.
*/
this.fingeringMode = exports.FingeringMode.ScoreDefault;
/**
* Gets or sets the configuration on whether music notation elements are visible or not.
* If notation elements are not specified, the default configuration will be applied.
*/
this.elements = new Map();
/**
* Whether to show rhythm notation in the guitar tablature.
*/
this.rhythmMode = exports.TabRhythmMode.Automatic;