Skip to main content

API

On many platforms an alphaTab API object can be used to bootstrap alphaTab within your UI. It takes over all responsibilities of linking your actions to the UI. Namely this object is called AlphaTabApi (Web) or AlphaTabApiBase<> (.net). This page describes all methods, properties and events exposed by this API object.

NameSummary
Events - Core
errorAllThis event is fired when an error within alphatab occurred.
postRenderFinishedAllThis event is fired when the rendering of the whole music sheet is finished, and all handlers of `renderFinished` ran.
renderFinishedAllThis event is fired when the rendering of the whole music sheet is finished.
renderStartedAllThis event is fired when the rendering of the whole music sheet is starting.
resizeAllThis event is fired when alphaTab was resized and is about to rerender the music notation.
scoreLoadedAllThis event is fired whenever a new song is loaded.
Events - Player
activeBeatsChangedAllThis event is fired when the currently active beats across all tracks change.
beatMouseDownAllThis event is fired whenever a the user presses the mouse button on a beat.
beatMouseMoveAllThis event is fired whenever the user moves the mouse over a beat after the user already pressed the button on a beat.
beatMouseUpAllThis event is fired whenever the user releases the mouse after a mouse press on a beat.
midiEventsPlayedAllThis event is fired when the synthesizer played certain midi events.
midiLoadAllThis event is fired when a Midi file is being loaded.
midiLoadedAllThis event is fired when the Midi file needed for playback was loaded.
noteMouseDownAllThis event is fired whenever a the user presses the mouse button on a note head/number.
noteMouseMoveAllThis event is fired whenever the user moves the mouse over a note after the user already pressed the button on a note.
noteMouseUpAllThis event is fired whenever the user releases the mouse after a mouse press on a note.
playbackRangeChangedAllThis event is fired when the playback range changed.
playedBeatChangedAllThis event is fired when the played beat changed.
playerFinishedAllThis event is fired when the playback of the whole song finished.
playerPositionChangedAllThis event is fired when the current playback position of the song changed.
playerReadyAllThis event is fired when all required data for playback is loaded and ready.
playerStateChangedAllThis event is fired when the playback state changed.
soundFontLoadJavaScriptThis event is fired when the SoundFont is being loaded.
soundFontLoadedAllThis event is fired when the SoundFont needed for playback was loaded.
Methods - Core
destroyAllDestroys the alphaTab control and restores the initial state of the UI.
downloadMidiJavaScriptGenerates an SMF1.0 file and downloads it
printJavaScriptOpens a popup window with the rendered music notation for printing.
renderAllInitiates a re-rendering of the current setup.
renderScoreAllInitiates a rendering of the given score.
renderTracksAllRenders the given list of tracks.
texAllTells alphaTab to render the given alphaTex.
updateSettingsAllApplies any changes that were done to the settings object.
Methods - Player
changeTrackMuteAllChanges the given tracks to be muted or not.
changeTrackSoloAllChanges the given tracks to be played solo or not.
changeTrackTranspositionPitchAllChanges the pitch transpose applied to the given tracks.
changeTrackVolumeAllChanges the volume of the given tracks.
enumerateOutputDevicesAllLoads and lists the available output devices which can be used by the player.
getOutputDeviceAllThe currently configured output device if changed via <code style={{"color":"#393A34","backgroundColor":"#f6f8fa"}}><span style={{"color":"#36acaa"}}>{"setOutputDevice"}</span></code>.
loadAllInitiates a load of the score using the given data.
loadSoundFontAllTriggers a load of the soundfont from the given data.
loadSoundFontFromUrlJavaScriptTriggers a load of the soundfont from the given URL.
pauseAllPauses the playback of the current song.
playAllStarts the playback of the current song.
playBeatAllTriggers the play of the given beat.
playNoteAllTriggers the play of the given note.
playPauseAllToggles between play/pause depending on the current player state.
resetSoundFontsAllUnloads all presets from previously loaded SoundFonts.
scrollToCursorAllInitiates a scroll to the cursor.
setOutputDeviceAllChanges the output device which should be used for playing the audio (player must be enabled).
stopAllStops the playback of the current song, and moves the playback position back to the start.
Properties - Core
boundsLookupAllThe tick cache allowing lookup of midi ticks to beats.
canvasElementAllThe UI container that will hold all rendered results.
containerAllThe UI container that holds the whole alphaTab control.
rendererAllThe score renderer used for rendering the music sheet.
scoreAllThe score holding all information about the song being rendered
settingsAllThe settings that are used for rendering the music notation.
tracksAllThe list of the tracks that are currently rendered.
uiFacadeAllGets the UI facade to use for interacting with the user interface.
Properties - Player
countInVolumeAllThe volume of the count-in metronome ticks.
isLoopingAllWhether the playback should automatically restart after it finished.
isReadyForPlaybackAllWhether the player is ready for starting the playback.
masterVolumeAllThe current master volume as percentage (0-1).
metronomeVolumeAllThe metronome volume as percentage (0-1).
midiEventsPlayedFilterAllThe midi events which will trigger the `midiEventsPlayed` event
playbackRangeAllThe range of the song that should be played.
playbackSpeedAllThe current playback speed as percentage
playerAllThe alphaSynth player used for playback.
playerStateAllThe current player state.
tickCacheAllThe tick cache allowing lookup of midi ticks to beats.
tickPositionAllThe position within the song in midi ticks.
timePositionAllThe position within the song in milliseconds