UNPKG

alphatab-pd

Version:

alphaTab is a music notation and guitar tablature rendering library

1,934 lines (1,895 loc) 216 kB
/** * Defines all loglevels. * @json */ declare enum LogLevel { /** * No logging */ None = 0, /** * Debug level (internal details are displayed). */ Debug = 1, /** * Info level (only important details are shown) */ Info = 2, /** * Warning level */ Warning = 3, /** * Error level. */ Error = 4 } /** * @json */ declare class CoreSettings { /** * Gets or sets the script file url that will be used to spawn the workers. * @target web */ scriptFile: string | null; /** * Gets or sets the url to the fonts that will be used to generate the alphaTab font style. * @target web */ fontDirectory: string | null; /** * Gets or sets the file to load directly after initializing alphaTab. * @target web */ file: string | null; /** * Gets or sets whether the UI element contains alphaTex code that should be * used to initialize alphaTab. * @target web */ tex: boolean; /** * Gets or sets the initial tracks that should be loaded for the score. * @target web */ tracks: unknown; /** * Gets or sets whether lazy loading for displayed elements is enabled. */ enableLazyLoading: boolean; /** * The engine which should be used to render the the tablature. * * - **default**- Platform specific default engine * - **html5**- HTML5 Canvas * - **svg**- SVG */ engine: string; /** * The log level to use within alphaTab */ logLevel: LogLevel; /** * Gets or sets whether the rendering should be done in a worker if possible. */ useWorkers: boolean; /** * Gets or sets whether in the {@link BoundsLookup} also the * position and area of each individual note is provided. */ includeNoteBounds: boolean; /** * @target web */ constructor(); /** * @target web */ static ensureFullUrl(relativeUrl: string | null): string; private static appendScriptName; } /** * @json_immutable */ declare class Color { static readonly BlackRgb: string; /** * Initializes a new instance of the {@link Color} class. * @param r The red component. * @param g The green component. * @param b The blue component. * @param a The alpha component. */ constructor(r: number, g: number, b: number, a?: number); updateRgba(): void; /** * Gets or sets the raw RGBA value. */ raw: number; get a(): number; get r(): number; get g(): number; get b(): number; /** * Gets the RGBA hex string to use in CSS areas. */ rgba: string; static random(opacity?: number): Color; static fromJson(v: unknown): Color | null; static toJson(obj: Color): number; } /** * Lists all flags for font styles. */ declare enum FontStyle { /** * No flags. */ Plain = 0, /** * Font is italic. */ Italic = 1 } /** * Lists all font weight values. */ declare enum FontWeight { /** * Not bold */ Regular = 0, /** * Font is bold */ Bold = 1 } /** * @json_immutable */ declare class Font { private _css; private _cssScale; private _families; private _style; private _weight; private _size; private reset; /** * Gets the first font family name. * @deprecated Consider using {@link families} for multi font family support. */ get family(): string; /** * Sets the font family list. * @deprecated Consider using {@link families} for multi font family support. */ set family(value: string); /** * Gets the font family name. */ get families(): string[]; /** * Sets the font family name. */ set families(value: string[]); /** * Gets the font size in pixels. */ get size(): number; /** * Sets the font size in pixels. */ set size(value: number); /** * Gets the font style. */ get style(): FontStyle; /** * Sets the font style. */ set style(value: FontStyle); /** * Gets the font weight. */ get weight(): FontWeight; /** * Gets or sets the font weight. */ set weight(value: FontWeight); get isBold(): boolean; get isItalic(): boolean; /** * Initializes a new instance of the {@link Font} class. * @param family The family. * @param size The size. * @param style The style. * @param weight The weight. */ constructor(family: string, size: number, style?: FontStyle, weight?: FontWeight); /** * Initializes a new instance of the {@link Font} class. * @param families The families. * @param size The size. * @param style The style. * @param weight The weight. */ static withFamilyList(families: string[], size: number, style?: FontStyle, weight?: FontWeight): Font; toCssString(scale?: number): string; static fromJson(v: unknown): Font | null; static toJson(font: Font): Map<string, unknown>; } /** * This public class contains central definitions for controlling the visual appearance. * @json */ declare class RenderingResources { private static sansFont; private static serifFont; /** * Gets or sets the font to use for displaying the songs copyright information in the header of the music sheet. */ copyrightFont: Font; /** * Gets or sets the font to use for displaying the songs title in the header of the music sheet. */ titleFont: Font; /** * Gets or sets the font to use for displaying the songs subtitle in the header of the music sheet. */ subTitleFont: Font; /** * Gets or sets the font to use for displaying the lyrics information in the header of the music sheet. */ wordsFont: Font; /** * Gets or sets the font to use for displaying certain effect related elements in the music sheet. */ effectFont: Font; /** * Gets or sets the font to use for displaying the fretboard numbers in chord diagrams. */ fretboardNumberFont: Font; /** * Gets or sets the font to use for displaying the guitar tablature numbers in the music sheet. */ tablatureFont: Font; /** * Gets or sets the font to use for grace notation related texts in the music sheet. */ graceFont: Font; /** * Gets or sets the color to use for rendering the lines of staves. */ staffLineColor: Color; /** * Gets or sets the color to use for rendering bar separators, the accolade and repeat signs. */ barSeparatorColor: Color; /** * Gets or sets the font to use for displaying the bar numbers above the music sheet. */ barNumberFont: Font; /** * Gets or sets the color to use for displaying the bar numbers above the music sheet. */ barNumberColor: Color; /** * Gets or sets the font to use for displaying finger information in the music sheet. */ fingeringFont: Font; /** * Gets or sets the font to use for section marker labels shown above the music sheet. */ markerFont: Font; /** * Gets or sets the color to use for music notation elements of the primary voice. */ mainGlyphColor: Color; /** * Gets or sets the color to use for music notation elements of the secondary voices. */ secondaryGlyphColor: Color; /** * Gets or sets the color to use for displaying the song information above the music sheet. */ scoreInfoColor: Color; } /** * Lists all layout modes that are supported. */ declare enum LayoutMode { /** * Bars are aligned in rows using a fixed width. */ Page = 0, /** * Bars are aligned horizontally in one row */ Horizontal = 1 } /** * Lists all stave profiles controlling which staves are shown. */ declare enum StaveProfile { /** * The profile is auto detected by the track configurations. */ Default = 0, /** * Standard music notation and guitar tablature are rendered. */ ScoreTab = 1, /** * Only standard music notation is rendered. */ Score = 2, /** * Only guitar tablature is rendered. */ Tab = 3, /** * Only guitar tablature is rendered, but also rests and time signatures are not shown. * This profile is typically used in multi-track scenarios. */ TabMixed = 4 } /** * Lists the different modes in which the staves and systems are arranged. */ declare enum SystemsLayoutMode { /** * Use the automatic alignment system provided by alphaTab (default) */ Automatic = 0, /** * Use the systems layout and sizing information stored from the score model. */ UseModelLayout = 1 } /** * The display settings control how the general layout and display of alphaTab is done. * @json */ declare class DisplaySettings { /** * Sets the zoom level of the rendered notation */ scale: number; /** * The default stretch force to use for layouting. */ stretchForce: number; /** * The layouting mode used to arrange the the notation. */ layoutMode: LayoutMode; /** * The stave profile to use. */ staveProfile: StaveProfile; /** * Limit the displayed bars per row. */ barsPerRow: number; /** * The bar start number to start layouting with. Note that this is the bar number and not an index! */ startBar: number; /** * The amount of bars to render overall. */ barCount: number; /** * The number of bars that should be rendered per partial. This setting is not used by all layouts. */ barCountPerPartial: number; /** * Gets or sets the resources used during rendering. This defines all fonts and colors used. * @json_partial_names */ resources: RenderingResources; /** * Gets or sets the padding between the music notation and the border. */ padding: number[] | null; /** * Gets how the systems should be layed out. */ systemsLayoutMode: SystemsLayoutMode; } /** * All settings related to importers that decode file formats. * @json */ declare class ImporterSettings { /** * The text encoding to use when decoding strings. By default UTF-8 is used. */ encoding: string; /** * If part-groups should be merged into a single track. */ mergePartGroupsInMusicXml: boolean; /** * If set to true, text annotations on beats are attempted to be parsed as * lyrics considering spaces as separators and removing underscores. * If a track/staff has explicit lyrics the beat texts will not be detected as lyrics. */ beatTextAsLyrics: boolean; } /** * Lists the different modes on how rhythm notation is shown on the tab staff. */ declare enum TabRhythmMode { /** * Rhythm notation is hidden. */ Hidden = 0, /** * Rhythm notation is shown with individual beams per beat. */ ShowWithBeams = 1, /** * Rhythm notation is shown and behaves like normal score notation with connected bars. */ ShowWithBars = 2 } /** * Lists all modes on how fingerings should be displayed. */ declare enum FingeringMode { /** * Fingerings will be shown in the standard notation staff. */ ScoreDefault = 0, /** * 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. */ ScoreForcePiano = 1, /** * Fingerings will be shown in a effect band above the tabs in case * they have only a single note on the beat. */ SingleNoteEffectBand = 2, /** * 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. */ SingleNoteEffectBandForcePiano = 3 } /** * Lists all modes on how alphaTab can handle the display and playback of music notation. */ declare enum NotationMode { /** * Music elements will be displayed and played as in Guitar Pro. */ GuitarPro = 0, /** * 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. */ SongBook = 1 } /** * Lists all major music notation elements that are part * of the music sheet and can be dynamically controlled to be shown * or hidden. */ declare enum NotationElement { /** * The score title shown at the start of the music sheet. */ ScoreTitle = 0, /** * The score subtitle shown at the start of the music sheet. */ ScoreSubTitle = 1, /** * The score artist shown at the start of the music sheet. */ ScoreArtist = 2, /** * The score album shown at the start of the music sheet. */ ScoreAlbum = 3, /** * The score words author shown at the start of the music sheet. */ ScoreWords = 4, /** * The score music author shown at the start of the music sheet. */ ScoreMusic = 5, /** * The score words&music author shown at the start of the music sheet. */ ScoreWordsAndMusic = 6, /** * The score copyright owner shown at the start of the music sheet. */ ScoreCopyright = 7, /** * The tuning information of the guitar shown * above the staves. */ GuitarTuning = 8, /** * The track names which are shown in the accolade. */ TrackNames = 9, /** * The chord diagrams for guitars. Usually shown * below the score info. */ ChordDiagrams = 10, /** * Parenthesis that are shown for tied bends * if they are preceeded by bends. */ ParenthesisOnTiedBends = 11, /** * The tab number for tied notes if the * bend of a note is increased at that point. */ TabNotesOnTiedBends = 12, /** * Zero tab numbers on "dive whammys". */ ZerosOnDiveWhammys = 13, /** * The alternate endings information on repeats shown above the staff. */ EffectAlternateEndings = 14, /** * The information about the fret on which the capo is placed shown above the staff. */ EffectCapo = 15, /** * The chord names shown above beats shown above the staff. */ EffectChordNames = 16, /** * The crescendo/decrescendo angle shown above the staff. */ EffectCrescendo = 17, /** * The beat dynamics shown above the staff. */ EffectDynamics = 18, /** * The curved angle for fade in/out effects shown above the staff. */ EffectFadeIn = 19, /** * The fermata symbol shown above the staff. */ EffectFermata = 20, /** * The fingering information. */ EffectFingering = 21, /** * The harmonics names shown above the staff. * (does not represent the harmonic note heads) */ EffectHarmonics = 22, /** * The let ring name and line above the staff. */ EffectLetRing = 23, /** * The lyrics of the track shown above the staff. */ EffectLyrics = 24, /** * The section markers shown above the staff. */ EffectMarker = 25, /** * The ottava symbol and lines shown above the staff. */ EffectOttavia = 26, /** * The palm mute name and line shown above the staff. */ EffectPalmMute = 27, /** * The pick slide information shown above the staff. * (does not control the pick slide lines) */ EffectPickSlide = 28, /** * The pick stroke symbols shown above the staff. */ EffectPickStroke = 29, /** * The slight beat vibrato waves shown above the staff. */ EffectSlightBeatVibrato = 30, /** * The slight note vibrato waves shown above the staff. */ EffectSlightNoteVibrato = 31, /** * The tap/slap/pop effect names shown above the staff. */ EffectTap = 32, /** * The tempo information shown above the staff. */ EffectTempo = 33, /** * The additional beat text shown above the staff. */ EffectText = 34, /** * The trill name and waves shown above the staff. */ EffectTrill = 35, /** * The triplet feel symbol shown above the staff. */ EffectTripletFeel = 36, /** * The whammy bar information shown above the staff. * (does not control the whammy lines shown within the staff) */ EffectWhammyBar = 37, /** * The wide beat vibrato waves shown above the staff. */ EffectWideBeatVibrato = 38, /** * The wide note vibrato waves shown above the staff. */ EffectWideNoteVibrato = 39, /** * The left hand tap symbol shown above the staff. */ EffectLeftHandTap = 40 } /** * The notation settings control how various music notation elements are shown and behaving * @json */ declare class NotationSettings { /** * Gets or sets the mode to use for display and play music notation elements. */ notationMode: NotationMode; /** * Gets or sets the fingering mode to use. */ fingeringMode: FingeringMode; /** * 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. */ elements: Map<NotationElement, boolean>; /** * Gets the default configuration of the {@see notationElements} setting. Do not modify * this map as it might not result in the expected side effects. * If items are not listed explicitly in this list, they are considered visible. */ static defaultElements: Map<NotationElement, boolean>; /** * Whether to show rhythm notation in the guitar tablature. */ rhythmMode: TabRhythmMode; /** * The height of the rythm bars. */ rhythmHeight: number; /** * The transposition pitch offsets for the individual tracks. * They apply to rendering and playback. */ transpositionPitches: number[]; /** * The transposition pitch offsets for the individual tracks. * They apply to rendering only. */ displayTranspositionPitches: number[]; /** * If set to true the guitar tabs on grace beats are rendered smaller. */ smallGraceTabNotes: boolean; /** * If set to true bend arrows expand to the end of the last tied note * of the string. Otherwise they end on the next beat. */ extendBendArrowsOnTiedNotes: boolean; /** * If set to true, line effects (like w/bar, let-ring etc) * are drawn until the end of the beat instead of the start. */ extendLineEffectsToBeatEnd: boolean; /** * Gets or sets the height for slurs. The factor is multiplied with the a logarithmic distance * between slur start and end. */ slurHeight: number; /** * Gets whether the given music notation element should be shown * @param element the element to check * @returns true if the element should be shown, otherwise false. */ isNotationElementVisible(element: NotationElement): boolean; } /** * Lists all modes how alphaTab can scroll the container during playback. */ declare enum ScrollMode { /** * Do not scroll automatically */ Off = 0, /** * Scrolling happens as soon the offsets of the cursors change. */ Continuous = 1, /** * Scrolling happens as soon the cursors exceed the displayed range. */ OffScreen = 2 } /** * This object defines the details on how to generate the vibrato effects. * @json */ declare class VibratoPlaybackSettings { /** * Gets or sets the wavelength of the note-wide vibrato in midi ticks. */ noteWideLength: number; /** * Gets or sets the amplitude for the note-wide vibrato in semitones. */ noteWideAmplitude: number; /** * Gets or sets the wavelength of the note-slight vibrato in midi ticks. */ noteSlightLength: number; /** * Gets or sets the amplitude for the note-slight vibrato in semitones. */ noteSlightAmplitude: number; /** * Gets or sets the wavelength of the beat-wide vibrato in midi ticks. */ beatWideLength: number; /** * Gets or sets the amplitude for the beat-wide vibrato in semitones. */ beatWideAmplitude: number; /** * Gets or sets the wavelength of the beat-slight vibrato in midi ticks. */ beatSlightLength: number; /** * Gets or sets the amplitude for the beat-slight vibrato in semitones. */ beatSlightAmplitude: number; } /** * This object defines the details on how to generate the slide effects. * @json */ declare class SlidePlaybackSettings { /** * Gets or sets 1/4 tones (bend value) offset that * simple slides like slide-out-below or slide-in-above use. */ simpleSlidePitchOffset: number; /** * Gets or sets the percentage which the simple slides should take up * from the whole note. for "slide into" effects the slide will take place * from time 0 where the note is plucked to 25% of the overall note duration. * For "slide out" effects the slide will start 75% and finish at 100% of the overall * note duration. */ simpleSlideDurationRatio: number; /** * Gets or sets the percentage which the legato and shift slides should take up * from the whole note. For a value 0.5 the sliding will start at 50% of the overall note duration * and finish at 100% */ shiftSlideDurationRatio: number; } /** * The player settings control how the audio playback and UI is behaving. * @json */ declare class PlayerSettings { /** * Gets or sets the URL of the sound font to be loaded. */ soundFont: string | null; /** * Gets or sets the element that should be used for scrolling. * @target web * @json_read_only */ scrollElement: string | HTMLElement; /** * Gets or sets whether the player should be enabled. */ enablePlayer: boolean; /** * Gets or sets whether playback cursors should be displayed. */ enableCursor: boolean; /** * Gets or sets whether the beat cursor should be animated or just ticking. */ enableAnimatedBeatCursor: boolean; /** * Gets or sets whether the notation elements of the currently played beat should be * highlighted. */ enableElementHighlighting: boolean; /** * Gets or sets alphaTab should provide user interaction features to * select playback ranges and jump to the playback position by click (aka. seeking). */ enableUserInteraction: boolean; /** * Gets or sets the X-offset to add when scrolling. */ scrollOffsetX: number; /** * Gets or sets the Y-offset to add when scrolling */ scrollOffsetY: number; /** * Gets or sets the mode how to scroll. */ scrollMode: ScrollMode; /** * Gets or sets how fast the scrolling to the new position should happen (in milliseconds) */ scrollSpeed: number; /** * Gets or sets whether the native browser smooth scroll mechanism should be used over a custom animation. * @target web */ nativeBrowserSmoothScroll: boolean; /** * Gets or sets the bend duration in milliseconds for songbook bends. */ songBookBendDuration: number; /** * Gets or sets the duration of whammy dips in milliseconds for songbook whammys. */ songBookDipDuration: number; /** * Gets or sets the settings on how the vibrato audio is generated. * @json_partial_names */ readonly vibrato: VibratoPlaybackSettings; /** * Gets or sets the setitngs on how the slide audio is generated. * @json_partial_names */ readonly slide: SlidePlaybackSettings; /** * Gets or sets whether the triplet feel should be applied/played during audio playback. */ playTripletFeel: boolean; /** * Gets or sets how many milliseconds of audio samples should be buffered in total. * Larger buffers cause a delay from when audio settings like volumes will be applied. * Smaller buffers can cause audio crackling due to constant buffering that is happening. */ bufferTimeInMilliseconds: number; } /** * Represents the progress of any data being loaded. */ declare class ProgressEventArgs { /** * Gets the currently loaded bytes. */ readonly loaded: number; /** * Gets the total number of bytes to load. */ readonly total: number; /** * Initializes a new instance of the {@link ProgressEventArgs} class. * @param loaded * @param total */ constructor(loaded: number, total: number); } /** * This public class contains instance specific settings for alphaTab * @json */ declare class Settings { /** * The core settings control the general behavior of alphatab like * what modules are active. * @json_on_parent * @json_partial_names */ readonly core: CoreSettings; /** * The display settings control how the general layout and display of alphaTab is done. * @json_on_parent * @json_partial_names */ readonly display: DisplaySettings; /** * The notation settings control how various music notation elements are shown and behaving. * @json_partial_names */ readonly notation: NotationSettings; /** * All settings related to importers that decode file formats. * @json_partial_names */ readonly importer: ImporterSettings; /** * Contains all player related settings * @json_partial_names */ player: PlayerSettings; setSongBookModeSettings(): void; static get songBook(): Settings; /** * @target web */ fillFromJson(json: any): void; } /** * Represents the information related to a resize event. */ declare class ResizeEventArgs { /** * Gets the size before the resizing happened. */ oldWidth: number; /** * Gets the size after the resize was complete. */ newWidth: number; /** * Gets the settings currently used for rendering. */ settings: Settings | null; core(): CoreSettings; private causeIssue; } declare enum AlphaTabErrorType { General = 0, Format = 1, AlphaTex = 2 } declare class AlphaTabError extends Error { inner: Error | null; type: AlphaTabErrorType; constructor(type: AlphaTabErrorType, message?: string | null, inner?: Error); } /** * An invalid input format was detected (e.g. invalid setting values, file formats,...) */ declare class FormatError extends AlphaTabError { constructor(message: string); } interface ILogger { debug(category: string, msg: string, ...details: unknown[]): void; warning(category: string, msg: string, ...details: unknown[]): void; info(category: string, msg: string, ...details: unknown[]): void; error(category: string, msg: string, ...details: unknown[]): void; } declare class Logger { static logLevel: LogLevel; static log: ILogger; private static shouldLog; static debug(category: string, msg: string, ...details: unknown[]): void; static warning(category: string, msg: string, ...details: unknown[]): void; static info(category: string, msg: string, ...details: unknown[]): void; static error(category: string, msg: string, ...details: unknown[]): void; } /** * @target web */ declare class FileLoadError extends AlphaTabError { xhr: XMLHttpRequest; constructor(message: string, xhr: XMLHttpRequest); } /** * Represents a writer where binary data can be written to. */ interface IWriteable { /** * Gets the current number of written bytes. */ readonly bytesWritten: number; /** * Write a single byte to the stream. * @param value The value to write. */ writeByte(value: number): void; /** * Write data from the given buffer. * @param buffer The buffer to get the data from. * @param offset The offset where to start reading the data. * @param count The number of bytes to write */ write(buffer: Uint8Array, offset: number, count: number): void; } /** * Lists all midi events. */ declare enum MidiEventType { /** * A per note pitch bend. (Midi 2.0) */ PerNotePitchBend = 96, /** * A note is released. */ NoteOff = 128, /** * A note is started. */ NoteOn = 144, /** * The pressure that was used to play the note. */ NoteAftertouch = 160, /** * Change of a midi controller */ Controller = 176, /** * Change of a midi program */ ProgramChange = 192, /** * The pressure that should be applied to the whole channel. */ ChannelAftertouch = 208, /** * A change of the audio pitch. */ PitchBend = 224, /** * A System Exclusive event. */ SystemExclusive = 240, /** * A System Exclusive event. */ SystemExclusive2 = 247, /** * A meta event. See `MetaEventType` for details. */ Meta = 255 } /** * Represents a midi event. */ declare class MidiEvent { /** * Gets or sets the track to which the midi event belongs. */ track: number; /** * Gets or sets the raw midi message. */ message: number; /** * Gets or sets the absolute tick of this midi event. */ tick: number; get channel(): number; get command(): MidiEventType; get data1(): number; set data1(value: number); get data2(): number; set data2(value: number); /** * Initializes a new instance of the {@link MidiEvent} class. * @param track The track this event belongs to. * @param tick The absolute midi ticks of this event. * @param status The status information of this event. * @param data1 The first data component of this midi event. * @param data2 The second data component of this midi event. */ constructor(track: number, tick: number, status: number, data1: number, data2: number); /** * Writes the midi event as binary into the given stream. * @param s The stream to write to. */ writeTo(s: IWriteable): void; } /** * Represents a midi file with a single track that can be played via {@link AlphaSynth} */ declare class MidiFile { /** * Gets or sets the division per quarter notes. */ division: number; /** * Gets a list of midi events sorted by time. */ readonly events: MidiEvent[]; /** * Adds the given midi event a the correct time position into the file. */ addEvent(e: MidiEvent): void; /** * Writes the midi file into a binary format. * @returns The binary midi file. */ toBinary(): Uint8Array; /** * Writes the midi file as binary into the given stream. * @returns The stream to write to. */ writeTo(s: IWriteable): void; static writeVariableInt(s: IWriteable, value: number): void; } /** * This public enumeration lists all types of automations. */ declare enum AutomationType { /** * Tempo change. */ Tempo = 0, /** * Colume change. */ Volume = 1, /** * Instrument change. */ Instrument = 2, /** * Balance change. */ Balance = 3 } /** * Automations are used to change the behaviour of a song. * @cloneable * @json * @json_strict */ declare class Automation { /** * Gets or sets whether the automation is applied linear. */ isLinear: boolean; /** * Gets or sets the type of the automation. */ type: AutomationType; /** * Gets or sets the target value of the automation. */ value: number; /** * Gets or sets the relative position of of the automation. */ ratioPosition: number; /** * Gets or sets the additional text of the automation. */ text: string; static buildTempoAutomation(isLinear: boolean, ratioPosition: number, value: number, reference: number): Automation; static buildInstrumentAutomation(isLinear: boolean, ratioPosition: number, value: number): Automation; } /** * A single point of a bending graph. Used to * describe WhammyBar and String Bending effects. * @cloneable * @json * @json_strict */ declare class BendPoint { static readonly MaxPosition: number; static readonly MaxValue: number; /** * Gets or sets offset of the point relative to the note duration (0-60) */ offset: number; /** * Gets or sets the 1/4 note value offsets for the bend. */ value: number; /** * Initializes a new instance of the {@link BendPoint} class. * @param offset The offset. * @param value The value. */ constructor(offset?: number, value?: number); } /** * Lists the different bend styles */ declare enum BendStyle { /** * The bends are as described by the bend points */ Default = 0, /** * The bends are gradual over the beat duration. */ Gradual = 1, /** * The bends are done fast before the next note. */ Fast = 2 } /** * Lists all types of how to brush multiple notes on a beat. */ declare enum BrushType { /** * No brush. */ None = 0, /** * Normal brush up. */ BrushUp = 1, /** * Normal brush down. */ BrushDown = 2, /** * Arpeggio up. */ ArpeggioUp = 3, /** * Arpeggio down. */ ArpeggioDown = 4 } /** * This public enumeration lists all supported Clefs. */ declare enum Clef { /** * Neutral clef. */ Neutral = 0, /** * C3 clef */ C3 = 1, /** * C4 clef */ C4 = 2, /** * F4 clef */ F4 = 3, /** * G2 clef */ G2 = 4 } /** * Lists all types of fermatas */ declare enum FermataType { /** * A short fermata (triangle symbol) */ Short = 0, /** * A medium fermata (round symbol) */ Medium = 1, /** * A long fermata (rectangular symbol) */ Long = 2 } /** * Represents a fermata. * @json * @json_strict */ declare class Fermata { /** * Gets or sets the type of fermata. */ type: FermataType; /** * Gets or sets the actual lenght of the fermata. */ length: number; } /** * This public enumeration lists all available key signatures */ declare enum KeySignature { /** * Cb (7 flats) */ Cb = -7, /** * Gb (6 flats) */ Gb = -6, /** * Db (5 flats) */ Db = -5, /** * Ab (4 flats) */ Ab = -4, /** * Eb (3 flats) */ Eb = -3, /** * Bb (2 flats) */ Bb = -2, /** * F (1 flat) */ F = -1, /** * C (no signs) */ C = 0, /** * G (1 sharp) */ G = 1, /** * D (2 sharp) */ D = 2, /** * A (3 sharp) */ A = 3, /** * E (4 sharp) */ E = 4, /** * B (5 sharp) */ B = 5, /** * F# (6 sharp) */ FSharp = 6, /** * C# (7 sharp) */ CSharp = 7 } /** * This public enumeration lists all available types of KeySignatures */ declare enum KeySignatureType { /** * Major */ Major = 0, /** * Minor */ Minor = 1 } /** * This public class can store the information about a group of measures which are repeated */ declare class RepeatGroup { /** * All masterbars repeated within this group */ masterBars: MasterBar[]; /** * the masterbars which opens the group. */ opening: MasterBar | null; /** * a list of masterbars which open the group. * @deprecated There can only be one opening, use the opening property instead */ get openings(): MasterBar[]; /** * a list of masterbars which close the group. */ closings: MasterBar[]; /** * Gets whether this repeat group is really opened as a repeat. */ get isOpened(): boolean; /** * true if the repeat group was closed well */ isClosed: boolean; addMasterBar(masterBar: MasterBar): void; } /** * This class represents the rendering stylesheet. * It contains settings which control the display of the score when rendered. * @json * @json_strict */ declare class RenderStylesheet { /** * Gets or sets whether dynamics are hidden. */ hideDynamics: boolean; } /** * Represents the lyrics of a song. */ declare class Lyrics { private static readonly CharCodeLF; private static readonly CharCodeTab; private static readonly CharCodeCR; private static readonly CharCodeSpace; private static readonly CharCodeBrackedClose; private static readonly CharCodeBrackedOpen; private static readonly CharCodeDash; /** * Gets or sets he start bar on which the lyrics should begin. */ startBar: number; /** * Gets or sets the raw lyrics text in Guitar Pro format. * (spaces split word syllables, plus merge syllables, [..] are comments) */ text: string; /** * Gets or sets the prepared chunks of the lyrics to apply to beats. */ chunks: string[]; finish(skipEmptyEntries?: boolean): void; private parse; private addChunk; private prepareChunk; } /** * This public class stores the midi specific information of a track needed * for playback. * @json * @json_strict */ declare class PlaybackInformation { /** * Gets or sets the volume (0-16) */ volume: number; /** * Gets or sets the balance (0-16; 8=center) */ balance: number; /** * Gets or sets the midi port to use. */ port: number; /** * Gets or sets the midi program to use. */ program: number; /** * Gets or sets the primary channel for all normal midi events. */ primaryChannel: number; /** * Gets or sets the secondary channel for special midi events. */ secondaryChannel: number; /** * Gets or sets whether the track is muted. */ isMute: boolean; /** * Gets or sets whether the track is playing alone. */ isSolo: boolean; } /** * Lists all music font symbols used within alphaTab. The names * and values are aligned with the SMuFL standard. */ declare enum MusicFontSymbol { None = -1, GClef = 57424, CClef = 57436, FClef = 57442, UnpitchedPercussionClef1 = 57449, SixStringTabClef = 57453, FourStringTabClef = 57454, TimeSig0 = 57472, TimeSig1 = 57473, TimeSig2 = 57474, TimeSig3 = 57475, TimeSig4 = 57476, TimeSig5 = 57477, TimeSig6 = 57478, TimeSig7 = 57479, TimeSig8 = 57480, TimeSig9 = 57481, TimeSigCommon = 57482, TimeSigCutCommon = 57483, NoteheadDoubleWholeSquare = 57505, NoteheadDoubleWhole = 57504, NoteheadWhole = 57506, NoteheadHalf = 57507, NoteheadBlack = 57508, NoteheadNull = 57509, NoteheadXOrnate = 57514, NoteheadTriangleUpWhole = 57531, NoteheadTriangleUpHalf = 57532, NoteheadTriangleUpBlack = 57534, NoteheadDiamondBlackWide = 57564, NoteheadDiamondWhite = 57565, NoteheadDiamondWhiteWide = 57566, NoteheadCircleX = 57523, NoteheadXWhole = 57511, NoteheadXHalf = 57512, NoteheadXBlack = 57513, NoteheadParenthesis = 57550, NoteheadSlashedBlack2 = 57552, NoteheadCircleSlash = 57591, NoteheadHeavyX = 57592, NoteheadHeavyXHat = 57593, NoteQuarterUp = 57813, NoteEighthUp = 57815, Tremolo3 = 57890, Tremolo2 = 57889, Tremolo1 = 57888, FlagEighthUp = 57920, FlagEighthDown = 57921, FlagSixteenthUp = 57922, FlagSixteenthDown = 57923, FlagThirtySecondUp = 57924, FlagThirtySecondDown = 57925, FlagSixtyFourthUp = 57926, FlagSixtyFourthDown = 57927, FlagOneHundredTwentyEighthUp = 57928, FlagOneHundredTwentyEighthDown = 57929, FlagTwoHundredFiftySixthUp = 57930, FlagTwoHundredFiftySixthDown = 57931, AccidentalFlat = 57952, AccidentalNatural = 57953, AccidentalSharp = 57954, AccidentalDoubleSharp = 57955, AccidentalDoubleFlat = 57956, AccidentalQuarterToneFlatArrowUp = 57968, AccidentalQuarterToneSharpArrowUp = 57972, AccidentalQuarterToneNaturalArrowUp = 57970, ArticAccentAbove = 58528, ArticStaccatoAbove = 58530, ArticMarcatoAbove = 58540, FermataAbove = 58560, FermataShortAbove = 58564, FermataLongAbove = 58566, RestLonga = 58593, RestDoubleWhole = 58594, RestWhole = 58595, RestHalf = 58596, RestQuarter = 58597, RestEighth = 58598, RestSixteenth = 58599, RestThirtySecond = 58600, RestSixtyFourth = 58601, RestOneHundredTwentyEighth = 58602, RestTwoHundredFiftySixth = 58603, Repeat1Bar = 58624, Repeat2Bars = 58625, Ottava = 58640, OttavaAlta = 58641, OttavaBassaVb = 58652, Quindicesima = 58644, QuindicesimaAlta = 58645, DynamicPPP = 58666, DynamicPP = 58667, DynamicPiano = 58656, DynamicMP = 58668, DynamicMF = 58669, DynamicForte = 58658, DynamicFF = 58671, DynamicFFF = 58672, OrnamentTrill = 58726, StringsDownBow = 58896, StringsUpBow = 58898, PictEdgeOfCymbal = 59177, GuitarString0 = 59443, GuitarString1 = 59444, GuitarString2 = 59445, GuitarString3 = 59446, GuitarString4 = 59447, GuitarString5 = 59448, GuitarString6 = 59449, GuitarString7 = 59450, GuitarString8 = 59451, GuitarString9 = 59452, GuitarGolpe = 59458, FretboardX = 59481, FretboardO = 59482, WiggleTrill = 60068, WiggleVibratoMediumFast = 60126, OctaveBaselineM = 60565, OctaveBaselineB = 60563 } /** * This public enum lists all different text alignments */ declare enum TextAlign { /** * Text is left aligned. */ Left = 0, /** * Text is centered. */ Center = 1, /** * Text is right aligned. */ Right = 2 } /** * This public enum lists all base line modes */ declare enum TextBaseline { /** * Text is aligned on top. */ Top = 0, /** * Text is aligned middle */ Middle = 1, /** * Text is aligend on the bottom. */ Bottom = 2 } /** * This is the base public interface for canvas implementations on different plattforms. */ interface ICanvas { settings: Settings; color: Color; lineWidth: number; fillRect(x: number, y: number, w: number, h: number): void; strokeRect(x: number, y: number, w: number, h: number): void; fillCircle(x: number, y: number, radius: number): void; strokeCircle(x: number, y: number, radius: number): void; font: Font; textAlign: TextAlign; textBaseline: TextBaseline; beginGroup(identifier: string): void; endGroup(): void; fillText(text: string, x: number, y: number): void; measureText(text: string): number; fillMusicFontSymbol(x: number, y: number, scale: number, symbol: MusicFontSymbol, centerAtPosition?: boolean): void; fillMusicFontSymbols(x: number, y: number, scale: number, symbols: MusicFontSymbol[], centerAtPosition?: boolean): void; beginRender(width: number, height: number): void; endRender(): unknown; onRenderFinished(): unknown; beginRotate(centerX: number, centerY: number, angle: number): void; endRotate(): void; beginPath(): void; closePath(): void; fill(): void; stroke(): void; moveTo(x: number, y: number): void; lineTo(x: number, y: number): void; bezierCurveTo(cp1X: number, cp1Y: number, cp2X: number, cp2Y: number, x: number, y: number): void; quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; } /** * Lists all durations of a beat. */ declare enum Duration { /** * A quadruple whole note duration */ QuadrupleWhole = -4, /** * A double whole note duration */ DoubleWhole = -2, /** * A whole note duration */ Whole = 1, /** * A 1/2 note duration */ Half = 2, /** * A 1/4 note duration */ Quarter = 4, /** * A 1/8 note duration */ Eighth = 8, /** * A 1/16 note duration */ Sixteenth = 16, /** * A 1/32 note duration */ ThirtySecond = 32, /** * A 1/64 note duration */ SixtyFourth = 64, /** * A 1/128 note duration */ OneHundredTwentyEighth = 128, /** * A 1/256 note duration */ TwoHundredFiftySixth = 256 } /** * Describes an instrument articulation which is used for percussions. * @json * @json_strict */ declare class InstrumentArticulation { /** * Gets or sets the type of the element for which this articulation is for. */ elementType: string; /** * Gets or sets the line the note head should be shown for standard notation */ staffLine: number; /** * Gets or sets the note head to display by default. */ noteHeadDefault: MusicFontSymbol; /** * Gets or sets the note head to display for half duration notes. */ noteHeadHalf: MusicFontSymbol; /** * Gets or sets the note head to display for whole duration notes. */ noteHeadWhole: MusicFontSymbol; /** * Gets or sets which additional technique symbol should be placed for the note head. */ techniqueSymbol: MusicFontSymbol; /** * Gets or sets where the technique symbol should be placed. */ techniqueSymbolPlacement: TextBaseline; /** * Gets or sets which midi number to use when playing the note. */ outputMidiNumber: number; constructor(elementType?: string, staffLine?: number, outputMidiNumber?: number, noteHeadDefault?: MusicFontSymbol, noteHeadHalf?: MusicFontSymbol, noteHeadWhole?: MusicFontSymbol, techniqueSymbol?: MusicFontSymbol, techniqueSymbolPlacement?: TextBaseline); getSymbol(duration: Duration): MusicFontSymbol; } /** * This public class describes a single track or instrument of score. * It is bascially a list of staffs containing individual music notation kinds. * @json * @json_strict */ declare class Track { private static readonly ShortNameMaxLength; /** * Gets or sets the zero-based index of this track. * @json_ignore */ index: number; /** * Gets or sets the reference this track belongs to. * @json_ignore */ score: Score; /** * Gets or sets the list of staffs that are defined for this track. * @json_add addStaff */ staves: Staff[]; /** * Gets or sets the playback information for this track. */ playbackInfo: PlaybackInformation; /** * Gets or sets the display color defined for this track. */ color: Color; /** * Gets or sets the long name of this track. */ name: string; /** * Gets or sets the short name of this track. */ shortName: string; /** * Defines how many bars are placed into the systems (rows) when displaying * the track unless a value is set in the systemsLayout. */ defaultSystemsLayout: number; /** * Defines how many bars are placed into the systems (rows) when displaying * the track. */ systemsLayout: number[]; /** * Gets or sets a mapping on which staff liens particular percussion instruments * should be shown. */ percussionArticulations: InstrumentArticulation[]; ensureStaveCount(staveCount: number): void; addStaff(staff: Staff): void; finish(settings: Settings, sharedDataBag?: Map<string, unknown> | null): void; applyLyrics(lyrics: Lyrics[]): void; } /** * The score is the root node of the complete * model. It stores the basic information of * a song and stores the sub components. * @json * @json_strict */ declare class Score { private _currentRepeatGroup; private _openedRepeatGroups; private _properlyOpenedRepeatGroups; /** * The album of this song. */ album: string; /** * The artist who performs this song. */ artist: string; /** * The owner of the copyright of this song. */ copyright: string; /** * Additional instructions */ instructions: string; /** * The author of the music. */ music: string; /** * Some additional notes about the song. */ notices: string; /**