Maestro - Midi Player Tool Kit for Unity Version 2.18.2
Loading...
Searching...
No Matches
Runtime SoundFont Loading

Load SoundFonts dynamically while the application is running.

Runtime loading allows a SoundFont to be selected without packaging it directly in the application build.

This is useful for:

  • downloadable content,
  • optional SoundFont packs,
  • user-selected SoundFonts,
  • remote distribution of SoundFont assets.

Typical Workflow

A common runtime loading workflow is:

  • configure cache options,
  • assign ProgressCallback,
  • assign LoadedCallback,
  • call Load(),
  • wait until the SoundFont is ready.
midiSynth.MPTK_SoundFont.ProgressCallback = progress =>
{
Debug.Log($"Loading SoundFont: {progress * 100f:F0}%");
};
midiSynth.MPTK_SoundFont.LoadedCallback = synth =>
{
Debug.Log($"SoundFont ready: {synth.MPTK_SoundFont.SoundFontName}");
};
midiSynth.MPTK_SoundFont.Load("https://example.com/MySoundFont.sf2");

Supported Sources

SoundFonts can be loaded from:

Completion Model

Load() starts the loading process. Depending on the source, the operation may complete asynchronously. Use LoadedCallback to know when the SoundFont is ready. Use StatusSoundFont to inspect the current loading result.

See also
MidiPlayerTK.MPTKSoundFont.Load
MidiPlayerTK.MPTKSoundFont.LoadedCallback
MidiPlayerTK.MPTKSoundFont.ProgressCallback
MidiPlayerTK.MPTKSoundFont.StatusSoundFont