-
-
Notifications
You must be signed in to change notification settings - Fork 14
Synth Event Types
This is a more detailed explanation of the event types for the synthesizer event handler.
- Synthesizer Event Types
Important
If there's more than one property, the returned value is an object with the properties as keys.
Name | Description | Callback Properties |
---|---|---|
noteoff |
Key has been released | - midiNote : number - the note that was released- channel : number - the channel number which got the note released |
noteon |
Key has been pressed | - midiNote : number - the note that was pressed- channel : number - the channel that the note was played on- velocity : number - the velocity of the note |
pitchwheel |
Pitch wheel has been altered | - channel : number - the channel that was pitch bent- MSB : number - Most Significant byte of the message- LSB : number - least significant byte of the message |
controllerchange |
Controller has been changed | - channel : number - the channel that CC was changed on- controllerNumber : number - the number of the MIDI controller list- controllerValue : number - the new value of the controller |
programchange |
Program has been changed | - channel : number - the channel that had its program changed- program : number - the new MIDI program number- bank : number - the new bank number of the preset |
channelpressure |
Channel's pressure has been changed | - channel : number - the channel affected- pressure : number - the new pressure |
polypressure |
Note's pressure has been changed | - midiNote : number - the note that was affected- channel : number - the channel affected- pressure : number - the new pressure |
drumchange |
Channel's drum mode was changed | - channel : number - the channel- isDrumChannel : boolean - if the channel is now a drum channel or not |
stopall |
All voices were stopped | None |
newchannel |
A new channel was added to the synth | None |
mutechannel |
A channel has been muted/unmuted | - channel : number - the channel that was altered- isMuted : boolean - if the channel is muted or unmuted |
presetlistchange |
The preset list has been changed/initialized | - presetList : array - The soundfont preset list. Each item is an object: {presetName: string, program: number, bank: number}
|
allcontrollerreset |
All controllers have been reset (and programs!) | None. Note: if there were any locked controllers, they will be restored via controllerchange event after. For example allcontrollersreset will be called and then controllerchange for the locked controller. |
soundfonterror |
The loaded soundfont was invalid | - error : object - The error message from the SoundFont2 class |
synthdisplay |
A SysEx to display some text has been received | - displayData : Uint8Array - the data to display,- displayType : the type of display. Read more below. |
Note
presetlistchange
is the recommended way of retrieving the preset list.
It automatically combines the soundfonts and sends the list of presets as they will be played.
It also signals that the soundfont has been fully loaded.
This event is triggered when a note is released on any channel.
-
midiNote
:number
- the MIDI key number of the note that was released. Ranges from 0 to 127. -
channel
:number
- the channel number which got the note released. Usually ranges from 0 to 16, but it depends on the channel count.
This event is triggered when a note is pressed on any channel.
-
midiNote
:number
- the MIDI key number of the note that was pressed. Ranges from 0 to 127. -
channel
:number
- the channel that the note was played on. Usually ranges from 0 to 16, but it depends on the channel count. -
velocity
:number
- the velocity of the note (usually more means louder). Ranges from 0 to 127.
This event is triggered when the pitch wheel is altered on any channel.
-
channel
:number
- the channel that was pitch bent. Usually ranges from 0 to 16, but it depends on the channel count. -
MSB
:number
- Most Significant byte of the message. Ranges from 0 to 127. -
LSB
:number
- least significant byte of the message. Ranges from 0 to 127.
Note that the two bytes combined like this MSB << 7 | LSB
will give you the pitch bend value from 0 to 16383.
Also note that the pitch bend depends on the pitch bend range, usually two semitones up and down.
This event is triggered when a controller is changed on any channel.
-
channel
:number
- the channel that CC was changed on. Usually ranges from 0 to 16, but it depends on the channel count. -
controllerNumber
:number
- the number of the MIDI controller list. Ranges from 0 to 127. -
controllerValue
:number
- the new value of the controller. Ranges from 0 to 127.
Note that this event is also called after allcontrollerreset
if there were any locked controllers.
For example if CC#1 was locked to 64, after allcontrollerreset
a controllerchange
event will be called with controllerNumber
1 and controllerValue
64.
This event is triggered when a program is changed on any channel (usually MIDI program change, though Some SysExes can change it too). It is also called when receiving a system reset message.
-
channel
:number
- the channel that had its program changed. Usually ranges from 0 to 16, but it depends on the channel count. -
program
:number
- the new MIDI program number. Ranges from 0 to 127. -
bank
:number
- the new bank number of the preset. Ranges from 0 to 127.
This event is triggered when a MIDI channel pressure event is received. This usually controls channels' vibrato.
-
channel
:number
- the channel affected. Usually ranges from 0 to 16, but it depends on the channel count. -
pressure
:number
- the new pressure. Ranges from 0 to 127.
This event is triggered when a MIDI polyphonic pressure event is received. This controls the pressure of a single note. By default, this controls vibrato in SpessaSynth, though it can be changed with SoundFont modulators.
-
midiNote
:number
- the MIDI key number of the note that was affected. Ranges from 0 to 127. -
channel
:number
- the channel affected. Usually ranges from 0 to 16, but it depends on the channel count. -
pressure
:number
- the new pressure. Ranges from 0 to 127.
This event is triggered when a channel is changed to a drum channel or back to a normal channel. Either with a SysEx message or with a MIDI CC message when the synthesizer is in XG mode.
-
channel
:number
- the channel that was altered. Usually ranges from 0 to 16, but it depends on the channel count. -
isDrumChannel
:boolean
- if the channel is now a drum channel or not.
This event is triggered when all voices are stopped. Either manually or when receiving a system reset.
None.
This event is triggered when a new channel is added to the synthesizer. Either manually, or when the sequencer detects a Multi-Port MIDI file.
None.
This event is triggered when a channel is muted or unmuted. This only can be done manually, there's no MIDI message to mute a channel.
-
channel
:number
- the channel that was altered. Usually ranges from 0 to 16, but it depends on the channel count. -
isMuted
:boolean
- if the channel is muted or unmuted.
This event is triggered when the preset list has been changed or initialized, by adding, removing or changing soundfonts, or when a MIDI with an embedded soundfont is loaded. Note that this is the recommended way of retrieving the preset list, rather than loading the soundfont manually.
-
presetList
:array
- The soundfont preset list. Each item is an object:-
presetName
:string
- The name of the preset. -
program
:number
- The MIDI program number. Ranges from 0 to 127. -
bank
:number
- The bank number of the preset. Ranges from 0 to 127.
-
This event is triggered when all controllers and programs have been reset. Effectively a system reset.
None. Note that if there were any locked controllers, they will be restored via controllerchange
event after (like described in controllerchange
).
This event is triggered when the loaded soundfont was invalid.
-
error
:Error
- The error message from the parser, a JavaScript error object.
This event is triggered when a SysEx to display some text has been received.
-
displayData
:Uint8Array
- the data to display, as raw bytes extracted from the MIDI SysEx message. -
displayType
:string
- the type of display. Can be one of the following:- 0 -> Sound Canvas Text: The display data is ASCII text for Roland Sound Canvas.
- 1 -> XG Display Letters: Note that the first byte is the 6th byte of the message, also called "Display Letters" is included in the
displayData
. It is not the part of the text itself, but contains some information that you may want to parse. Refer to the XG specification for more information. - 2 -> Sound Canvas Dot Display: The Sound Canvas Dot Display message. Usually used for the SC-55 and SC-88. Read page 193 from SC-88Pro owner's manual for more information.
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!