Skip to main content

loadSoundFont

since 0.9.4

Description​

This function initiates a load of the soundfont using the given data. The supported data types is depending on the platform. AlphaTab only supports SoundFont2 encoded soundfonts for loading. To load a soundfont the player must be enabled in advance.

Signatures​

TypeValues
function loadSoundFont(arraybuffer, append)JavaScript

Load the soundfont from the given raw bytes.

function loadSoundFont(uint8array, append)JavaScript

Load the soundfont from the given raw bytes.

function loadSoundFont(url, append)JavaScript

Load the soundfont from the given URL via AJAX.

alphaTab('loadSoundFont', arraybuffer, append)JavaScript

Load the soundfont from the given raw bytes.

alphaTab('loadSoundFont', uint8array, append)JavaScript

Load the soundfont from the given raw bytes.

alphaTab('loadSoundFont', url, append)JavaScript

Load the soundfont from the given URL via AJAX.

bool LoadSoundFont(byte[] raw, append).net

Load the soundfont from the given raw bytes.

bool LoadSoundFont(Stream raw, append).net

Load the soundfont from the given stream.

fun loadSoundFont(raw: ByteArray, append: Boolean = false): BooleanAndroid

Load the soundfont from the given raw bytes.

fun loadSoundFont(raw: UByteArray, append: Boolean = false): BooleanAndroid

Load the soundfont from the given raw bytes.

fun loadSoundFont(stream: java.io.InputStream, append: Boolean = false): BooleanAndroid

Load the soundfont from the given stream.

Parameters​

ParametersTypeSummary
arraybufferJavaScript & jQueryArrayBuffer

The arraybuffer containing the raw bytes of a SoundFont2 file

uint8arrayJavaScript & jQueryUint8Array

The Uint8Array containing the raw bytes of a SoundFont2 file

urlJavaScript & jQuerystring

A URL pointing to a SoundFont2 file that should be loaded via AJAX.

raw.netbyte[]

The raw bytes containing a SoundFont2 file.

raw.netSystem.IO.Stream

The stream containing a SoundFont2 file.

rawAndroidByteArray

The raw bytes containing a SoundFont2 file.

rawAndroidByteArray

The raw bytes containing a SoundFont2 file.

rawAndroidUByteArray

The raw bytes containing a SoundFont2 file.

streamAndroidjava.io.InputStream

The stream containing a SoundFont2 file.

appendAllboolean

Whether to append the presets of the new soundfont to the already loaded ones. Since: 1.1.0

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');