UNPKG

@coderline/alphatab

Version:

alphaTab is a music notation and guitar tablature rendering library

1,385 lines (1,360 loc) 3.29 MB
/*! * alphaTab v1.7.1 (, build 24) * * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Integrated Libraries: * * Library: TinySoundFont * License: MIT * Copyright: Copyright (C) 2017, 2018 Bernhard Schelling * URL: https://github.com/schellingb/TinySoundFont * Purpose: SoundFont loading and Audio Synthesis * * Library: SFZero * License: MIT * Copyright: Copyright (C) 2012 Steve Folta () * URL: https://github.com/stevefolta/SFZero * Purpose: TinySoundFont is based on SFZEro * * Library: Haxe Standard Library * License: MIT * Copyright: Copyright (C)2005-2025 Haxe Foundation * URL: https://github.com/HaxeFoundation/haxe/tree/development/std * Purpose: XML Parser & Zip Inflate Algorithm * * Library: SharpZipLib * License: MIT * Copyright: Copyright © 2000-2018 SharpZipLib Contributors * URL: https://github.com/icsharpcode/SharpZipLib * Purpose: Zip Deflate Algorithm for writing compressed Zips * * Library: NVorbis * License: MIT * Copyright: Copyright (c) 2020 Andrew Ward * URL: https://github.com/NVorbis/NVorbis * Purpose: Vorbis Stream Decoding * * Library: libvorbis * License: BSD-3-Clause * Copyright: Copyright (c) 2002-2020 Xiph.org Foundation * URL: https://github.com/xiph/vorbis * Purpose: NVorbis adopted some code from libvorbis. * * @preserve * @license */ (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.alphaTab = {})); })(this, (function (exports) { 'use strict'; /** * A very basic polyfill of the ResizeObserver which triggers * a the callback on window resize for all registered targets. * @target web * @internal */ class ResizeObserverPolyfill { _callback; _targets = new Set(); constructor(callback) { this._callback = callback; window.addEventListener('resize', this._onWindowResize.bind(this), false); } observe(target) { this._targets.add(target); } unobserve(target) { this._targets.delete(target); } disconnect() { this._targets.clear(); } _onWindowResize() { const entries = []; for (const t of this._targets) { entries.push({ target: t, // not used by alphaTab contentRect: undefined, borderBoxSize: undefined, contentBoxSize: [], devicePixelContentBoxSize: [] }); } this._callback(entries, this); } } /** * A polyfill of the InsersectionObserver * @target web * @internal */ class IntersectionObserverPolyfill { _callback; _elements = []; _timer = null; constructor(callback) { this._callback = callback; window.addEventListener('resize', () => this._check, true); document.addEventListener('scroll', () => this._check, true); } _check() { if (!this._timer) { this._timer = setTimeout(() => { this._doCheck(); this._timer = null; }, 100); } } observe(target) { if (this._elements.indexOf(target) >= 0) { return; } this._elements.push(target); this._check(); } unobserve(target) { this._elements = this._elements.filter(item => { return item !== target; }); } _doCheck() { const entries = []; for (const element of this._elements) { const rect = element.getBoundingClientRect(); const isVisible = rect.top + rect.height >= 0 && rect.top <= window.innerHeight && rect.left + rect.width >= 0 && rect.left <= window.innerWidth; if (isVisible) { entries.push({ target: element, isIntersecting: true }); } } if (entries.length) { this._callback(entries, this); } } } /*@target web*/ (() => { if (typeof Symbol.dispose === 'undefined') { Symbol.dispose = Symbol('Symbol.dispose'); } if (typeof window !== 'undefined') { // ResizeObserver API does not yet exist so long on Safari (only start 2020 with iOS Safari 13.7 and Desktop 13.1) // so we better add a polyfill for it if (!('ResizeObserver' in globalThis)) { globalThis.ResizeObserver = ResizeObserverPolyfill; } // IntersectionObserver API does not on older iOS versions // so we better add a polyfill for it if (!('IntersectionObserver' in globalThis)) { globalThis.IntersectionObserver = IntersectionObserverPolyfill; } if (!('replaceChildren' in Element.prototype)) { Element.prototype.replaceChildren = function (...nodes) { this.innerHTML = ''; this.append(...nodes); }; Document.prototype.replaceChildren = Element.prototype.replaceChildren; DocumentFragment.prototype.replaceChildren = Element.prototype.replaceChildren; } } if (!('replaceAll' in String.prototype)) { String.prototype.replaceAll = function (str, newStr) { return this.replace(new RegExp(str, 'g'), newStr); }; } })(); /** * @public */ exports.AlphaTabErrorType = void 0; (function (AlphaTabErrorType) { AlphaTabErrorType[AlphaTabErrorType["General"] = 0] = "General"; AlphaTabErrorType[AlphaTabErrorType["Format"] = 1] = "Format"; AlphaTabErrorType[AlphaTabErrorType["AlphaTex"] = 2] = "AlphaTex"; })(exports.AlphaTabErrorType || (exports.AlphaTabErrorType = {})); /** * @public */ class AlphaTabError extends Error { type; constructor(type, message = '', inner) { super(message ?? '', { cause: inner }); this.type = type; } } // <auto-generated> // This code was auto-generated. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> /** * @internal */ class VersionInfo { static version = '1.7.1'; static date = '2025-12-02T16:54:46.381Z'; static commit = 'e487b958158892679a115693547661dc49a78e16'; static print(print) { print(`alphaTab ${VersionInfo.version}`); print(`commit: ${VersionInfo.commit}`); print(`build date: ${VersionInfo.date}`); } } /** * Lists all dynamics. * @public */ var DynamicValue; (function (DynamicValue) { // common dynamics /** * 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"; // special dynamics DynamicValue[DynamicValue["PPPP"] = 8] = "PPPP"; DynamicValue[DynamicValue["PPPPP"] = 9] = "PPPPP"; DynamicValue[DynamicValue["PPPPPP"] = 10] = "PPPPPP"; DynamicValue[DynamicValue["FFFF"] = 11] = "FFFF"; DynamicValue[DynamicValue["FFFFF"] = 12] = "FFFFF"; DynamicValue[DynamicValue["FFFFFF"] = 13] = "FFFFFF"; /** * Sforzando */ DynamicValue[DynamicValue["SF"] = 14] = "SF"; /** * SforzandoPiano */ DynamicValue[DynamicValue["SFP"] = 15] = "SFP"; /** * SforzandoPianissimo */ DynamicValue[DynamicValue["SFPP"] = 16] = "SFPP"; /** * FortePiano */ DynamicValue[DynamicValue["FP"] = 17] = "FP"; /** * Rinforzando 1 */ DynamicValue[DynamicValue["RF"] = 18] = "RF"; /** * Rinforzando 2 */ DynamicValue[DynamicValue["RFZ"] = 19] = "RFZ"; /** * Sforzato */ DynamicValue[DynamicValue["SFZ"] = 20] = "SFZ"; /** * SforzatoFF */ DynamicValue[DynamicValue["SFFZ"] = 21] = "SFFZ"; /** * Forzando */ DynamicValue[DynamicValue["FZ"] = 22] = "FZ"; /** * Niente */ DynamicValue[DynamicValue["N"] = 23] = "N"; /** * Poco forte */ DynamicValue[DynamicValue["PF"] = 24] = "PF"; /** * SforzatoPiano */ DynamicValue[DynamicValue["SFZP"] = 25] = "SFZP"; })(DynamicValue || (DynamicValue = {})); /** * @internal */ class MidiUtils { static QuarterTime = 960; static _minVelocity = 15; static VelocityIncrement = 16; /** * 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(dynamicValue, adjustment = 0) { let velocity = 1; switch (dynamicValue) { case DynamicValue.PPP: velocity = MidiUtils._minVelocity + 0 * MidiUtils.VelocityIncrement; break; case DynamicValue.PP: velocity = MidiUtils._minVelocity + 1 * MidiUtils.VelocityIncrement; break; case DynamicValue.P: velocity = MidiUtils._minVelocity + 2 * MidiUtils.VelocityIncrement; break; case DynamicValue.MP: velocity = MidiUtils._minVelocity + 3 * MidiUtils.VelocityIncrement; break; case DynamicValue.MF: velocity = MidiUtils._minVelocity + 4 * MidiUtils.VelocityIncrement; break; case DynamicValue.F: velocity = MidiUtils._minVelocity + 5 * MidiUtils.VelocityIncrement; break; case DynamicValue.FF: velocity = MidiUtils._minVelocity + 6 * MidiUtils.VelocityIncrement; break; case DynamicValue.FFF: velocity = MidiUtils._minVelocity + 7 * MidiUtils.VelocityIncrement; break; // special case DynamicValue.PPPP: velocity = 10; break; case DynamicValue.PPPPP: velocity = 5; break; case DynamicValue.PPPPPP: velocity = 3; break; case DynamicValue.FFFF: velocity = MidiUtils._minVelocity + 8 * MidiUtils.VelocityIncrement; break; case DynamicValue.FFFFF: velocity = MidiUtils._minVelocity + 9 * MidiUtils.VelocityIncrement; break; case DynamicValue.FFFFFF: velocity = MidiUtils._minVelocity + 10 * MidiUtils.VelocityIncrement; break; // "forced" variants -> a bit louder than normal, same as FF for us case DynamicValue.SF: case DynamicValue.SFP: case DynamicValue.SFZP: case DynamicValue.SFPP: case DynamicValue.SFZ: case DynamicValue.FZ: velocity = MidiUtils._minVelocity + 6 * MidiUtils.VelocityIncrement; break; // force -> piano, same as F for us case DynamicValue.FP: velocity = MidiUtils._minVelocity + 5 * MidiUtils.VelocityIncrement; break; // "rinforced" varaints -> like "forced" but typically for a whole passage // not a single note, same as FF for us case DynamicValue.RF: case DynamicValue.RFZ: case DynamicValue.SFFZ: velocity = MidiUtils._minVelocity + 5 * MidiUtils.VelocityIncrement; break; // almost not hearable but still a value case DynamicValue.N: velocity = 1; break; // A bit weaker than standard F but stronger than MF case DynamicValue.PF: velocity = MidiUtils._minVelocity + ((4.5 * MidiUtils.VelocityIncrement) | 0); break; } // 0 would means note-off (not played) so we need a minimum of 1 to have still a note played velocity += adjustment * MidiUtils.VelocityIncrement; return Math.min(Math.max(velocity, 1), 127); } } /** * This public enumeration lists all types of automations. * @public */ 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"; /** * A sync point for synchronizing the internal time axis with an external audio track. */ AutomationType[AutomationType["SyncPoint"] = 4] = "SyncPoint"; /** * Midi Bank change. */ AutomationType[AutomationType["Bank"] = 4] = "Bank"; })(AutomationType || (AutomationType = {})); /** * Represents the data of a sync point for synchronizing the internal time axis with * an external audio file. * @cloneable * @json * @json_strict * @public */ class SyncPointData { /** * Indicates for which repeat occurence this sync point is valid (e.g. 0 on the first time played, 1 on the second time played) */ barOccurence = 0; /** * The audio offset marking the position within the audio track in milliseconds. * This information is used to regularly sync (or on seeking) to match a given external audio time axis with the internal time axis. */ millisecondOffset = 0; } /** * Automations are used to change the behaviour of a song. * @cloneable * @json * @json_strict * @public */ class Automation { /** * Gets or sets whether the automation is applied linear. */ isLinear = false; /** * Gets or sets the type of the automation. */ type = AutomationType.Tempo; /** * Gets or sets the target value of the automation. */ value = 0; /** * The sync point data in case of {@link AutomationType.SyncPoint} */ syncPointValue; /** * Gets or sets the relative position of of the automation. */ ratioPosition = 0; /** * Gets or sets the additional text of the automation. */ text = ''; /** * Whether this automation should be visible. (not all automation types are shown, * e.g. tempo changes shown in the score while volume changes are not). */ isVisible = true; static buildTempoAutomation(isLinear, ratioPosition, value, reference, isVisible = true) { if (reference < 1 || reference > 5) { reference = 2; } const references = new Float32Array([1, 0.5, 1.0, 1.5, 2.0, 3.0]); const automation = new Automation(); automation.type = AutomationType.Tempo; automation.isLinear = isLinear; automation.ratioPosition = ratioPosition; automation.value = value * references[reference]; automation.isVisible = isVisible; return automation; } static buildInstrumentAutomation(isLinear, ratioPosition, value) { const automation = new Automation(); automation.type = AutomationType.Instrument; automation.isLinear = isLinear; automation.ratioPosition = ratioPosition; automation.value = value; return automation; } } /** * A single point of a bending graph. Used to * describe WhammyBar and String Bending effects. * @cloneable * @json * @json_strict * @public */ class BendPoint { static MaxPosition = 60; static MaxValue = 12; /** * Gets or sets offset of the point relative to the note duration (0-60) */ offset; /** * Gets or sets the 1/4 note value offsets for the bend. */ value; /** * 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; } } /** * Lists the different bend styles * @public */ 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 * @public */ 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. * @public */ 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. * @public */ 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. * @public */ 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 types of grace notes * @public */ 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 types of note acceuntations * @public */ 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 = {})); /** * Lists all fingers. * @public */ 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. * @public */ 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 * @public */ 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 = {})); /** * Lists all ottavia. * @public */ 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 = {})); /** * This public enum lists all different types of finger slide-ins on a string. * @public */ 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. * @public */ 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. * @public */ 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. * @public */ 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. * @since 1.4.0 */ TabRhythmMode[TabRhythmMode["Automatic"] = 3] = "Automatic"; })(exports.TabRhythmMode || (exports.TabRhythmMode = {})); /** * Lists all modes on how fingerings should be displayed. * @public */ 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. * @public */ 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. * @public */ exports.NotationElement = void 0; (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"; /** * The directions indicators like coda and segno. */ NotationElement[NotationElement["EffectDirections"] = 48] = "EffectDirections"; /** * The absolute playback time of beats. */ NotationElement[NotationElement["EffectBeatTimer"] = 49] = "EffectBeatTimer"; })(exports.NotationElement || (exports.NotationElement = {})); /** * The notation settings control how various music notation elements are shown and behaving * @json * @json_declaration * @public */ class NotationSettings { /** * The mode to use for display and play music notation elements. * @since 0.9.6 * @category Notation * @defaultValue `NotationMode.GuitarPro` * @remarks * AlphaTab provides 2 main music notation display modes `GuitarPro` and `SongBook`. * As the names indicate they adjust the overall music notation rendering either to be more in line how [Arobas Guitar Pro](https://www.guitar-pro.com) displays it, * or more like the common practice in paper song books practices the display. * * The main differences in the Songbook display mode are: * * 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. * * 4. **Settings** * Following default setting values are applied: * ```js * { * notation: { * smallGraceTabNotes: false, * fingeringMode: alphaTab.FingeringMode.SingleNoteEffectBandm * extendBendArrowsOnTiedNotes: false * }, * elements: { * parenthesisOnTiedBends: false, * tabNotesOnTiedBends: false, * zerosOnDiveWhammys: true * } * } * ``` */ notationMode = exports.NotationMode.GuitarPro; /** * The fingering mode to use. * @since 0.9.6 * @category Notation * @defaultValue `FingeringMode.ScoreDefault` * @remarks * AlphaTab supports multiple modes on how to display fingering information in the music sheet. This setting controls how they should be displayed. The default behavior is to show the finger information * directly in the score along the notes. For some use cases of training courses and for beginners this notation might be hard to read. The effect band mode allows to show a single finger information above the staff. * * | Score | Effect Band | * |-------------------------------------------------------------|-------------------------------------------------------------------| * | ![Enabled](https://alphatab.net/img/reference/property/fingeringmode-score.png) | ![Disabled](https://alphatab.net/img/reference/property/fingeringmode-effectband.png) | */ fingeringMode = exports.FingeringMode.ScoreDefault; /** * Whether music notation elements are visible or not. * @since 0.9.8 * @category Notation * @defaultValue `[[NotationElement.ZerosOnDiveWhammys, false]]` * @rem