Skip to main content

loadSoundFont

since 0.9.4

Description​

Triggers a load of the soundfont from the given data. AlphaTab only supports SoundFont2 and SoundFont3 since 1.4.0 encoded soundfonts for loading. To load a soundfont the player must be enabled in advance.

loadSoundFont(data: unknown, append?: boolean): boolean
ParameterSummary
dataAll

The data object to decode. The supported data types is depending on the platform.

  • A ArrayBuffer or Uint8Array (all platforms, native byte array or input streams on other platforms)
  • A url from where to download the binary data of one of the supported file formats (browser only)
appendAll

Whether to fully replace or append the data from the given soundfont.

Returns​

true if the passed in object is a supported format and loading was initiated, otherwise false.

Examples​

const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
api.loadSoundFont('/assets/MyFile.sf2');