Since: 0.9.4

loadSoundFont

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)JavaScriptLoad the soundfont from the given raw bytes.
function loadSoundFont(uint8array, append)JavaScriptLoad the soundfont from the given raw bytes.
function loadSoundFont(url, append)JavaScriptLoad the soundfont from the given URL via AJAX.
alphaTab('loadSoundFont', arraybuffer, append)JavaScriptLoad the soundfont from the given raw bytes.
alphaTab('loadSoundFont', uint8array, append)JavaScriptLoad the soundfont from the given raw bytes.
alphaTab('loadSoundFont', url, append)JavaScriptLoad the soundfont from the given URL via AJAX.
bool LoadSoundFont(byte[] raw, append).netLoad the soundfont from the given raw bytes.
bool LoadSoundFont(Stream raw, append).netLoad the soundfont from the given stream.

Parameters

ParametersTypeSummary
arraybufferJavaScript & jQueryArrayBufferThe arraybuffer containing the raw bytes of a SoundFont2 file
uint8arrayJavaScript & jQueryUint8ArrayThe Uint8Array containing the raw bytes of a SoundFont2 file
urlJavaScript & jQuerystringA URL pointing to a SoundFont2 file that should be loaded via AJAX.
raw.netbyte[]The raw bytes containing a SoundFont2 file.
raw.netSystem.IO.StreamThe stream containing a SoundFont2 file.
appendAllboolean

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

Since: 1.1.0-alpha.34

Returns

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

Examples

var api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
api.loadSoundFont('/assets/MyFile.sf2');
$('#alphaTab').alphaTab('loadSoundFont', '/assets/MyFile.sf2');
var api = new AlphaTabApi<MyControl>(...);
api.LoadSoundFont(System.IO.File.OpenRead("MyFile.sf2"));