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 and SoundFont3 (since 1.4.0) 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 SoundFont file

uint8arrayJavaScript & jQueryUint8Array

The Uint8Array containing the raw bytes of a SoundFont file

urlJavaScript & jQuerystring

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

raw.netbyte[]

The raw bytes containing a SoundFont file.

raw.netSystem.IO.Stream

The stream containing a SoundFont file.

rawAndroidByteArray

The raw bytes containing a SoundFont file.

rawAndroidByteArray

The raw bytes containing a SoundFont file.

rawAndroidUByteArray

The raw bytes containing a SoundFont file.

streamAndroidjava.io.InputStream

The stream containing a SoundFont 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');