Creates an empty sound bank instance.
The value to initialize the BasicSoundBank.type property with.
If the sound bank has custom default modulators (DMOD).
Sound bank's default modulators.
An array of all instruments in the bank.
An array of all presets in the bank, ordered by bank and preset number.
An array of all samples in the bank.
The metadata of this sound bank.
ReadonlytypeThe type of the sound bank that was loaded.
Either sf2 for SoundFont2/SoundFont3 or dls for DownLoadable Sounds or sfe for SF-Enhanced.
StaticreadyA Promise object indicating if the SF3/SF2Pack decoder is ready. Make sure to await it if you are loading SF3/SF2Pack files. It only needs to be awaited once, globally. Then all banks can be loaded synchronously.
Checks for XG drum sets and considers if this sound bank is XG.
Adds complete presets along with their associated instruments and samples into this sound bank.
The presets to add.
Adds BasicInstruments to this sound bank.
The instruments to add.
Adds BasicPresets to this sound bank.
The presets to add.
Adds BasicSamples to this sound bank.
The samples to add.
Recursively clones an instrument into this sound bank, as well as its samples.
The instrument to copy.
The copied instrument.
Recursively clones a preset into this sound bank, as well as its instruments and samples.
The preset to copy.
The copied preset.
Clones a sample into this bank.
The sample to copy.
The copied sample.
Deletes a given instrument from the sound bank.
The instrument to delete.
Deletes a given preset from the sound bank.
The preset to delete.
Deletes a given sample from the sound bank.
The sample to delete.
Deletes everything irreversibly.
Updates internal values. Call after updating the preset list.
Returns the matching BasicPreset instance. This uses the MIDIPatchTools.selectPatch algorithm for selecting the optimal preset.
The patch to select.
The MIDI system to select for. If you're unsure, pick gs.
The selected preset.
ProtectedparseProtected
Parses the bank after loading is done
Removes all BasicSamples and BasicInstruments not used by any BasicPreset.
Sets the sound bank's sample format in place.
Options associated with setting the sample format.
Trims the sound bank in-place to only contain samples in a given MIDI file.
Absent presets will be removed from the sound bank, and samples that don't get activated in the remaining presets will be removed as well.
A Map: BasicPreset -> Set<"key-velocity">.
Absent presets will be removed from the sound bank,
and samples that don't get activated in the remaining presets will be removed as well.
Writes out a DLS Level 2 sound bank. This may not be 100% accurate. Samples data is always written in the S16LE PCM encoding.
Options for writing the file.
The binary representation of the file.
Writes the sound bank as an SF2 or SF3 file.
Options for writing the file.
The binary representation of the file.
Writes the sound bank as an SFE 4 file. This enables features such as bank LSB and RIFF64. Note that spessasynth is currently the only software that can read these files.
Options for writing the file.
The binary representation of the file.
StaticcopyCopies a given sound bank, deeply cloning all presets instruments and samples.
The sound bank to copy.
StaticgetCreates a simple sound bank with a single saw wave preset. Useful for testing synthesizer's functionality without providing a file.
StaticmergeMerges sound banks with the given order.
The sound banks to merge. The first is used as a base, and the rest are added on top.
This module handles parsing and writing SoundFont2 (
.sf2,.sf3and.sfogg) files. It represents a single sound bank.It also contains support for
.dlsfiles and experimental read and write support for 64-bit SFE.Specifications: