Initializes a new MIDI Synthesizer engine.
The sample rate of the synthesizer, in Hertz.
Additional options when initializing the synthesizer.
ReadonlycurrentThe current time of the synthesizer, in seconds.
ReadonlymidiAll MIDI channels of the synthesizer.
ReadonlymidiThe global MIDI parameters of the synthesizer. These are only editable via MIDI messages.
OptionalonThis property can be defined as a function that listens for events.
All events are defined in SynthesizerEvent.
It is not called while the eventsEnabled system parameter is false.
The event that occurred.
ReadonlyreadyA Promise that must be awaited before
the processor can be used with a compressed sound bank.
ReadonlysampleThe sample rate, in Hertz.
ReadonlysoundThe sound bank manager, which manages all sound banks and presets.
ReadonlysystemThe global system parameters of the synthesizer. These are only editable via the API.
Use SpessaSynthProcessor.setSystemParameter to set them.
Current total amount of voices that are playing.
Applies the snapshot to this SpessaSynthProcessor instance.
The snapshot to apply.
Executes a MIDI Channel Pressure (Aftertouch) message on the specified channel.
The MIDI channel to send the channel pressure on. It usually ranges from 0 to 15, but it depends on the channel count.
The pressure value, from 0 to 127.
Clears the synthesizer's voice cache. This can be used to hear the changes after editing a BasicSoundBank
Executes a MIDI controller change message on the specified channel.
The MIDI channel to change the controller on. It usually ranges from 0 to 15, but it depends on the channel count.
The MIDI controller number (0-127). Refer to the MIDI Implementation for the list of controllers supported by default.
The value of the controller (0-127).
Creates a new MIDI channel and adds it to the synthesizer. Emits a SynthesizerEvent.channelAdded event.
Destroy the synthesizer processor, clearing all channels and voices.
Gets a synthesizer snapshot from this processor instance.
Locks or unlocks a given GlobalMIDIParameter. This prevents any changes to it until it's unlocked.
The Global MIDI Parameter to lock.
If the parameter should be locked.
Executes a MIDI Note Off message on the specified channel. Stops playing a note.
The MIDI channel to send the note off. It usually ranges from 0 to 15, but it depends on the channel count.
The MIDI note number to stop playing. Ranges from 0 to 127.
Executes a MIDI Note On message on the specified channel. Starts playing a note.
The MIDI channel to send the note on. It usually ranges from 0 to 15, but it depends on the channel count.
The MIDI note number to play. Ranges from 0 to 127.
The velocity of the note, from 0 to 127. Ranges from 0 to 127, where 127 is the loudest and 1 is the quietest. If the velocity is 0, it will be treated as a Note Off message.
A handler for missing presets during program change. By default, it warns to console. It may be useful for allowing the synthesizer to work without any sound banks.
The MIDI patch that was requested.
The MIDI System for the request.
If a BasicPreset instance is returned, it will be used by the channel as a fallback.
Executes a MIDI Pitch Wheel message on the specified channel.
The MIDI channel to send the pitch wheel on. It usually ranges from 0 to 15, but it depends on the channel count.
The new 14-bit MIDI pitch value (0-16,383). 8,192 is center.
The MIDI note number for the per-note pitch wheel mode. Leave unset or set it to -1 for the regular pitch wheel.
Executes a MIDI Poly Pressure (Aftertouch) message on the specified channel. This differs from the Channel Pressure in that it's per-note and not for the whole channel.
The MIDI channel to send the poly pressure on. It usually ranges from 0 to 15, but it depends on the channel count.
The MIDI note number to apply the pressure to. Ranges from 0 to 127.
The pressure value, from 0 to 127.
Renders Float32 PCM audio data to stereo outputs; buffer size must be equal or smaller than maxBufferSize.
All float arrays must have the same length.
The audio is added to the existing contents of the output arrays, so make sure to clear them when reusing them.
The left output buffer for PCM data.
The right output buffer for PCM data.
The offset at which to start rendering audio in the provided arrays. Default is 0.
The number of samples to render.
Default is the entire length, starting from startIndex.
OptionalchannelOutputs: Float32Array<ArrayBufferLike>[][]
optional stereo channel outputs with dry (no effects) PCM data of specific channels.
These shouldn't be added to the left and right outputs. Recommended use-case is visualization.
Processes a raw MIDI message and allows scheduling it at a specific time.
The binary MIDI message data to process.
The channel offset for the message. It will be added to message's channel number if applicable.
Additional options for scheduling the message.
Processes multiple MIDI messages and allows scheduling them at a specific time.
The binary MIDI messages to process.
The channel offset for the messages. It will be added to messages' channel numbers if applicable.
Additional options for scheduling the messages.
Executes a MIDI Program Change message on the specified channel.
The MIDI channel to send the program change on. It usually ranges from 0 to 15, but it depends on the channel count.
The program number to change to, from 0 to 127.
Executes a full system reset of the synthesizer. This will stop all notes and reset all controllers to their default values, except for the locked controllers.
The MIDI system to reset the synthesizer to. Defaults to gs.
Sets a GlobalSystemParameter of the synthesizer.
The type of the system parameter to set.
The value to set for the system parameter.
Stops all notes on all channels.
If true, all notes are stopped immediately, otherwise they are stopped gracefully.
Executes a system exclusive message for the synthesizer.
The system exclusive message as an array of bytes.
The channel offset for the message as they usually can only address the first 16 channels. For example, to send a system exclusive on channel 16, send a system exclusive for channel 0 and set an offset of 16.
The core synthesis engine of SpessaSynth. This module converts sound bank and MIDI data into PCM audio data. The internal synthesis system is modeled after SoundFont2 synthesis model, with additional extensions and functionality.
MIDI implementation of the synthesizer can be found here.
Effect processors reference
GS
These are active when GlobalMIDIParameter.system is set to
gm,gm2, orgs.XG
These are active when GlobalMIDIParameter.system is set to
xg.Managers