-
Notifications
You must be signed in to change notification settings - Fork 12
Preset Class
spessasus edited this page Oct 15, 2024
·
6 revisions
Represents a singe SoundFont2 preset.
Returns the samples and their generators (and modulators) for the given midiNote. The name is kept from the time that SpessaSynth did not support modulators.
const samplesAndGenerators = preset.getSampleAndGenerators(midiNote);
- midiNote - the note to get generators from. Ranges from 0 to 127.
The returned value is as follows:
const samplesAndGenerators = [
{
instrumentGenerators: [Generator, /*...*/ Generator], // only the instrument generators, local replace global
presetGenerators: [Generator, /*...*/ Generator], // only the preset generators, local replace global
modulators: [Modulator, /*...*/ Modulator], // summed and replaced modulators, ready to use
sample: Sample // the sample object
},
/*...*/
{
instrumentGenerators: [Generator, /*...*/ Generator],
presetGenerators: [Generator, /*...*/ Generator],
modulators: [Modulator, /*...*/ Modulator], // summed and replaced modulators, ready to use
sample: Sample
}
];
More info about the Generator
class is here
The preset's name as string.
console.log(preset.presetName); // for example: "Drawbar Organ"
The preset's bank number. Used in MIDI Bank Select
controller.
console.log(preset.bank); // for example: 0
The preset's MIDI program number. Used in MIDI Program Change
message.
console.log(preset.program); // for example: 16
Tip
If you encounter any errors in this documentation, please open an issue!
Warning
Make sure you always update worklet_processor.min.js
along with the npm package!