Classes
Members
-
number :number
-
Description
The channel's number (1-16)
Details
-
output :Output
-
Description
The Output this channel belongs to
Details
Methods
-
decrementRegisteredParameter( parameter [, options ] ) → {OutputChannel}
-
Description
Decrements the specified MIDI registered parameter by 1. Here is the full list of parameter names that can be used with this function:
- Pitchbend Range (0x00, 0x00):
"pitchbendrange"
- Channel Fine Tuning (0x00, 0x01):
"channelfinetuning"
- Channel Coarse Tuning (0x00, 0x02):
"channelcoarsetuning"
- Tuning Program (0x00, 0x03):
"tuningprogram"
- Tuning Bank (0x00, 0x04):
"tuningbank"
- Modulation Range (0x00, 0x05):
"modulationrange"
- Azimuth Angle (0x3D, 0x00):
"azimuthangle"
- Elevation Angle (0x3D, 0x01):
"elevationangle"
- Gain (0x3D, 0x02):
"gain"
- Distance Ratio (0x3D, 0x03):
"distanceratio"
- Maximum Distance (0x3D, 0x04):
"maximumdistance"
- Maximum Distance Gain (0x3D, 0x05):
"maximumdistancegain"
- Reference Distance Ratio (0x3D, 0x06):
"referencedistanceratio"
- Pan Spread Angle (0x3D, 0x07):
"panspreadangle"
- Roll Angle (0x3D, 0x08):
"rollangle"
Parameters
Name Type Attributes Default Description parameter
String | Array.<number> A string identifying the parameter's name (see above) or a two-position array specifying the two control bytes (0x65, 0x64) that identify the registered parameter.
options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Throws
Details
- Pitchbend Range (0x00, 0x00):
-
incrementRegisteredParameter( parameter [, options ] ) → {OutputChannel}
-
Description
Increments the specified MIDI registered parameter by 1. Here is the full list of parameter names that can be used with this function:
- Pitchbend Range (0x00, 0x00):
"pitchbendrange"
- Channel Fine Tuning (0x00, 0x01):
"channelfinetuning"
- Channel Coarse Tuning (0x00, 0x02):
"channelcoarsetuning"
- Tuning Program (0x00, 0x03):
"tuningprogram"
- Tuning Bank (0x00, 0x04):
"tuningbank"
- Modulation Range (0x00, 0x05):
"modulationrange"
- Azimuth Angle (0x3D, 0x00):
"azimuthangle"
- Elevation Angle (0x3D, 0x01):
"elevationangle"
- Gain (0x3D, 0x02):
"gain"
- Distance Ratio (0x3D, 0x03):
"distanceratio"
- Maximum Distance (0x3D, 0x04):
"maximumdistance"
- Maximum Distance Gain (0x3D, 0x05):
"maximumdistancegain"
- Reference Distance Ratio (0x3D, 0x06):
"referencedistanceratio"
- Pan Spread Angle (0x3D, 0x07):
"panspreadangle"
- Roll Angle (0x3D, 0x08):
"rollangle"
Parameters
Name Type Attributes Default Description parameter
String | Array.<number> A string identifying the parameter's name (see above) or a two-position array specifying the two control bytes (0x65, 0x64) that identify the registered parameter.
options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Throws
Details
- Pitchbend Range (0x00, 0x00):
-
playNote( note [, options ] ) → {OutputChannel}
-
Description
Plays a note or an array of notes on the channel. The first parameter is the note to play. It can be a single value or an array of the following valid values:
- A MIDI note number (integer between
0
and127
) - A note name, followed by the octave (e.g.
"C3"
,"G#4"
,"F-1"
,"Db7"
) - A Note object
The
playNote()
method sends a note on MIDI message for all specified notes on all specified channels. If aduration
is set in theoptions
parameter or in the Note object's duration property, it will also schedule a note off message to end the note after said duration. If noduration
is set, the note will simply play until a matching note off message is sent with stopNote() or sendNoteOff().The execution of the note on command can be delayed by using the
time
property of theoptions
parameter.When using Note objects, the durations and velocities defined in the Note objects have precedence over the ones specified via the method's
options
parameter.Note: As per the MIDI standard, a note on message with an attack velocity of
0
is functionally equivalent to a note off message.Parameters
Name Type Attributes Default Description note
number | string | Note | Array.<number> | Array.<string> | Array.<Note> The note(s) to play. The notes can be specified by using a MIDI note number (0-127), a note name (e.g. C3, G#4, F-1, Db7), a Note object or an array of the previous types. When using a note name, octave range must be between -1 and 9. The lowest note is C-1 (MIDI note number 0) and the highest note is G9 (MIDI note number 127).
options
Object <optional> {} Name Type Attributes Default Description duration
number <optional> A positive number larger than 0 representing the number of milliseconds to wait before sending a note off message. If invalid or left undefined, only a note on message will be sent.
attack
number <optional> 0.5 The velocity at which to play the note (between
0
and1
). If therawAttack
option is also defined, it will have priority. An invalid velocity value will silently trigger the default of0.5
.rawAttack
number <optional> 0.5 The attack velocity at which to play the note (between
0
and127
). This has priority over theattack
property. An invalid velocity value will silently trigger the default of0.5
.release
number <optional> 0.5 The velocity at which to release the note (between
0
and1
). If therawRelease
option is also defined, it will have priority. An invalid velocity value will silently trigger the default of0.5
. This is only used with the note off event triggered whenoptions.duration
is set.rawRelease
number <optional> 0.5 The velocity at which to release the note (between
0
and127
). This has priority over therelease
property. An invalid velocity value will silently trigger the default of0.5
. This is only used with the note off event triggered whenoptions.duration
is set.time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Details
- A MIDI note number (integer between
-
resetAllControllers( [ options ] ) → {OutputChannel}
-
Description
Sends a reset all controllers channel mode message. This resets all controllers, such as the pitch bend, to their default value.
Parameters
Name Type Attributes Default Description options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Details
-
send( status [, data [, options ] ] ) → {OutputChannel}
-
Description
Sends a MIDI message at the scheduled timestamp. It is usually not necessary to use this method directly as you can use one of the simpler helper methods such as
playNote()
,stopNote()
,sendControlChange()
, etc.Details on the format of MIDI messages are available in the summary of MIDI messages from the MIDI Manufacturers Association.
Parameters
Name Type Attributes Default Description status
Number The MIDI status byte of the message (128-255). This is a combination of the command and the channel.
data
Array.<number> <optional> An array of unsigned integers for the message. The number of data bytes varies depending on the status byte. It is perfectly legal to send no data for some message types (use
undefined
or an empty array in this case). Each byte must be between 0 and 255.options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Throws
Details
-
sendChannelMode( command, value [, options ] ) → {OutputChannel}
-
Description
Sends a MIDI channel mode message. The channel mode message to send can be specified numerically or by using one of the following common names:
"allsoundoff"
(#120)"resetallcontrollers"
(#121)"localcontrol"
(#122)"allnotesoff"
(#123)"omnimodeoff"
(#124)"omnimodeon"
(#125)"monomodeon"
(#126)"polymodeon"
(#127)
It should be noted that, per the MIDI specification, only
localcontrol
andmonomodeon
may require a value that's not zero. For that reason, thevalue
parameter is optional and defaults to 0.To make it easier, all channel mode messages have a matching helper method:
Parameters
Name Type Attributes Default Description command
number | string The numerical identifier of the channel mode message (integer between 120-127) or its name as a string.
value
number The value to send (integer between 0-127).
options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Details
-
sendControlChange( controller, value [, options ] ) → {OutputChannel}
-
Description
Sends a MIDI control change message to the channel at the scheduled time. The control change message to send can be specified numerically or by using one of the following common names:
bankselectcoarse
(#0)modulationwheelcoarse
(#1)breathcontrollercoarse
(#2)footcontrollercoarse
(#4)portamentotimecoarse
(#5)dataentrycoarse
(#6)volumecoarse
(#7)balancecoarse
(#8)pancoarse
(#10)expressioncoarse
(#11)effectcontrol1coarse
(#12)effectcontrol2coarse
(#13)generalpurposeslider1
(#16)generalpurposeslider2
(#17)generalpurposeslider3
(#18)generalpurposeslider4
(#19)bankselectfine
(#32)modulationwheelfine
(#33)breathcontrollerfine
(#34)footcontrollerfine
(#36)portamentotimefine
(#37)dataentryfine
(#38)volumefine
(#39)balancefine
(#40)panfine
(#42)expressionfine
(#43)effectcontrol1fine
(#44)effectcontrol2fine
(#45)holdpedal
(#64)portamento
(#65)sustenutopedal
(#66)softpedal
(#67)legatopedal
(#68)hold2pedal
(#69)soundvariation
(#70)resonance
(#71)soundreleasetime
(#72)soundattacktime
(#73)brightness
(#74)soundcontrol6
(#75)soundcontrol7
(#76)soundcontrol8
(#77)soundcontrol9
(#78)soundcontrol10
(#79)generalpurposebutton1
(#80)generalpurposebutton2
(#81)generalpurposebutton3
(#82)generalpurposebutton4
(#83)reverblevel
(#91)tremololevel
(#92)choruslevel
(#93)celestelevel
(#94)phaserlevel
(#95)databuttonincrement
(#96)databuttondecrement
(#97)nonregisteredparametercoarse
(#98)nonregisteredparameterfine
(#99)registeredparametercoarse
(#100)registeredparameterfine
(#101)
Note: as you can see above, not all control change message have a matching common name. This does not mean you cannot use the others. It simply means you will need to use their number instead of their name.
To view a detailed list of all available control change messages, please consult "Table 3 - Control Change Messages" from the MIDI Messages specification.
Parameters
Name Type Attributes Default Description controller
number | string The MIDI controller name or number (0-119).
value
number The value to send (0-127).
options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Throws
Details
-
sendNoteOff( note [, options ] ) → {OutputChannel}
-
Description
Sends a note off message for the specified notes on the channel. The first parameter is the note. It can be a single value or an array of the following valid values:
- A MIDI note number (integer between
0
and127
) - A note name, followed by the octave (e.g.
"C3"
,"G#4"
,"F-1"
,"Db7"
) - A Note object
The execution of the note off command can be delayed by using the
time
property of theoptions
parameter.When using Note objects, the release velocity defined in the Note objects has precedence over the one specified via the method's
options
parameter.Parameters
Name Type Attributes Default Description note
number | string | Note | Array.<number> | Array.<string> | Array.<Note> The note(s) to stop. The notes can be specified by using a MIDI note number (0-127), a note name (e.g. C3, G#4, F-1, Db7), a Note object or an array of the previous types. When using a note name, octave range must be between -1 and 9. The lowest note is C-1 (MIDI note number 0) and the highest note is G9 (MIDI note number 127).
options
Object <optional> {} Name Type Attributes Default Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.release
number <optional> 0.5 The velocity at which to release the note (between
0
and1
). If therawRelease
option is also defined,rawRelease
will have priority. An invalid velocity value will silently trigger the default of0.5
.rawRelease
number <optional> 64 The velocity at which to release the note (between
0
and127
). If therelease
option is also defined,rawRelease
will have priority. An invalid velocity value will silently trigger the default of64
.Returns
Details
- A MIDI note number (integer between
-
sendNoteOn( note [, options ] ) → {OutputChannel}
-
Description
Sends a note on message for the specified notes on the channel. The first parameter is the note. It can be a single value or an array of the following valid values:
- A MIDI note number (integer between
0
and127
) - A note name, followed by the octave (e.g.
"C3"
,"G#4"
,"F-1"
,"Db7"
) - A Note object
The execution of the note on command can be delayed by using the
time
property of theoptions
parameter.When using Note objects, the attack velocity defined in the Note objects has precedence over the one specified via the method's
options
parameter. Also, theduration
is ignored. If you want to also send a note off message, use the playNote() method instead.Note: As per the MIDI standard, a note on message with an attack velocity of
0
is functionally equivalent to a note off message.Parameters
Name Type Attributes Default Description note
number | string | Note | Array.<number> | Array.<string> | Array.<Note> The note(s) to play. The notes can be specified by using a MIDI note number (0-127), a note name (e.g. C3, G#4, F-1, Db7), a Note object or an array of the previous types. When using a note name, octave range must be between -1 and 9. The lowest note is C-1 (MIDI note number 0) and the highest note is G9 (MIDI note number 127).
options
Object <optional> {} Name Type Attributes Default Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.attack
number <optional> 0.5 The velocity at which to play the note (between
0
and1
). If therawAttack
option is also defined,rawAttack
will have priority. An invalid velocity value will silently trigger the default of0.5
.rawAttack
number <optional> 64 The velocity at which to release the note (between
0
and127
). If theattack
option is also defined,rawAttack
will have priority. An invalid velocity value will silently trigger the default of64
.Returns
Details
- A MIDI note number (integer between
-
setChannelAftertouch( [ pressure [, options ] ] ) → {OutputChannel}
-
Description
Sends a MIDI channel aftertouch message. For key-specific aftertouch, you should instead use setKeyAftertouch().
Parameters
Name Type Attributes Default Description pressure
number <optional> The pressure level (between 0 and 1). If the
rawValue
option is set totrue
, the pressure can be defined by using an integer between 0 and 127.options
Object <optional> {} Name Type Attributes Default Description rawValue
boolean <optional> false A boolean indicating whether the value should be considered a float between 0 and 1.0 (default) or a raw integer between 0 and 127.
time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Throws
Details
-
setKeyAftertouch( note [, pressure [, options ] ] ) → {OutputChannel}
-
Description
Sends a MIDI key aftertouch message at the scheduled time. This is a key-specific aftertouch. For a channel-wide aftertouch message, use setChannelAftertouch().
The note can be a single value or an array of the following valid values:
- A MIDI note number (integer between
0
and127
) - A note name, followed by the octave (e.g.
"C3"
,"G#4"
,"F-1"
,"Db7"
) - A Note object
Parameters
Name Type Attributes Default Description note
number | string | Note | Array.<number> | Array.<string> | Array.<Note> The note(s) for which you are sending an aftertouch value. The notes can be specified by using a MIDI note number (0-127), a note name (e.g. C3, G#4, F-1, Db7), a Note object or an array of the previous types. When using a note name, octave range must be between -1 and 9. The lowest note is C-1 (MIDI note number 0) and the highest note is G9 (MIDI note number 127).
pressure
number <optional> 0.5 The pressure level (between 0 and 1). An invalid pressure value will silently trigger the default behaviour. If the
rawValue
option is set totrue
, the pressure is defined by using an integer between 0 and 127.options
Object <optional> {} Name Type Attributes Default Description useRawValue
boolean <optional> false A boolean indicating whether the value should be considered a float between 0 and 1.0 (default) or a raw integer between 0 and 127.
time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Throws
Details
- A MIDI note number (integer between
-
setLocalControl( [ state [, options ] ] ) → {OutputChannel}
-
Description
Turns local control on or off. Local control is usually enabled by default. If you disable it, the instrument will no longer trigger its own sounds. It will only send the MIDI messages to its out port.
Parameters
Name Type Attributes Default Description state
boolean <optional> false Whether to activate local control (
true
) or disable it (false
).options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Details
-
setMasterTuning( [ value [, options ] ] ) → {OutputChannel}
-
Description
Sends a master tuning message. The value is decimal and must be larger than -65 semitones and smaller than 64 semitones.
Because of the way the MIDI specification works, the decimal portion of the value will be encoded with a resolution of 14bit. The integer portion must be between -64 and 63 inclusively. This function actually generates two MIDI messages: a Master Coarse Tuning and a Master Fine Tuning RPN messages.
Parameters
Name Type Attributes Default Description value
number <optional> 0.0 The desired decimal adjustment value in semitones (-65 < x < 64)
options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Throws
Details
-
setModulationRange( semitones, cents [, options ] ) → {OutputChannel}
-
Description
Sends a modulation depth range message to adjust the depth of the modulation wheel's range. The range can be specified with the
semitones
parameter, thecents
parameter or by specifying both parameters at the same time.Parameters
Name Type Attributes Default Description semitones
number The desired adjustment value in semitones (integer between 0 and 127).
cents
number The desired adjustment value in cents (integer between 0 and 127).
options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Details
-
setNonRegisteredParameter( parameter [, data [, options ] ] ) → {OutputChannel}
-
Description
Sets a non-registered parameter (NRPN) to the specified value. The NRPN is selected by passing in a two-position array specifying the values of the two control bytes. The value is specified by passing in a single integer (most cases) or an array of two integers.
NRPNs are not standardized in any way. Each manufacturer is free to implement them any way they see fit. For example, according to the Roland GS specification, you can control the vibrato rate using NRPN (1, 8). Therefore, to set the vibrato rate value to 123 you would use:
WebMidi.outputs[0].channels[0].setNonRegisteredParameter([1, 8], 123);
In some rarer cases, you need to send two values with your NRPN messages. In such cases, you would use a 2-position array. For example, for its ClockBPM parameter (2, 63), Novation uses a 14-bit value that combines an MSB and an LSB (7-bit values). So, for example, if the value to send was 10, you could use:
WebMidi.outputs[0].channels[0].setNonRegisteredParameter([2, 63], [0, 10]);
For further implementation details, refer to the manufacturer's documentation.
Parameters
Name Type Attributes Default Description parameter
Array.<number> A two-position array specifying the two control bytes (0x63, 0x62) that identify the non-registered parameter.
data
number | Array.<number> <optional> [] An integer or an array of integers with a length of 1 or 2 specifying the desired data.
options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Throws
Details
-
setOmniMode( [ state [, options ] ] ) → {OutputChannel}
-
Description
Sets OMNI mode to
"on"
or"off"
. MIDI's OMNI mode causes the instrument to respond to messages from all channels.It should be noted that support for OMNI mode is not as common as it used to be.
Parameters
Name Type Attributes Default Description state
boolean <optional> true Whether to activate OMNI mode (
true
) or not (false
).options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Throws
Details
-
setPitchBend( [ value [, options ] ] ) → {OutputChannel}
-
Description
Sends a MIDI pitch bend message at the scheduled time.
Parameters
Name Type Attributes Default Description value
number | Array.<number> <optional> The intensity of the bend (between -1.0 and 1.0). A value of zero means no bend. The resulting bend is relative to the pitch bend range that has been defined. The range can be set with setPitchBendRange() . So, for example, if the pitch bend range has been set to 12 semitones, using a bend value of -1 will bend the note 1 octave below its nominal value.
If the
rawValue
option is set totrue
, the intensity of the bend can be defined by either using a single integer between 0 and 127 (MSB) or an array of two integers between 0 and 127 representing, respectively, the MSB (most significant byte) and the LSB (least significant byte). The MSB is expressed in semitones with64
meaning no bend. A value lower than64
bends downwards while a value higher than64
bends upwards. The LSB is expressed in cents (1/100 of a semitone). An LSB of64
also means no bend.options
Object <optional> {} Name Type Attributes Default Description rawValue
boolean <optional> false A boolean indicating whether the value should be considered as a float between -1.0 and 1.0 (default) or as raw integer between 0 and 127 (or an array of 2 integers if using both MSB and LSB).
time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Details
-
setPitchBendRange( semitones [, cents [, options ] ] ) → {OutputChannel}
-
Description
Sends a pitch bend range message to the specified channel(s) at the scheduled time so that they adjust the range used by their pitch bend lever. The range is specified by using the
semitones
andcents
parameters. For example, setting thesemitones
parameter to12
means that the pitch bend range will be 12 semitones above and below the nominal pitch.Parameters
Name Type Attributes Default Description semitones
number The desired adjustment value in semitones (between 0 and 127). While nothing imposes that in the specification, it is very common for manufacturers to limit the range to 2 octaves (-12 semitones to 12 semitones).
cents
number <optional> 0 The desired adjustment value in cents (integer between 0-127).
options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Throws
Details
-
setPolyphonicMode( [ mode [, options ] ] ) → {OutputChannel}
-
Description
Sets the polyphonic mode. In
"poly"
mode (usually the default), multiple notes can be played and heard at the same time. In"mono"
mode, only one note will be heard at once even if multiple notes are being played.Parameters
Name Type Attributes Default Description mode
string <optional> poly The mode to use:
"mono"
or"poly"
.options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Details
-
setProgram( [ program [, options ] ] ) → {OutputChannel}
-
Description
Sends a MIDI program change message at the scheduled time.
Note: since version 3.0, the program number is an integer between 1 and 128. In versions 1.0 and 2.0, the number was between 0 and 127. This change aligns WebMidi.js with most devices that use a numbering scheme starting at 1.
Parameters
Name Type Attributes Default Description program
number <optional> 1 The MIDI patch (program) number (1-128)
options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Throws
Details
-
setRegisteredParameter( parameter [, data [, options ] ] ) → {OutputChannel}
-
Description
Sets the specified MIDI registered parameter to the desired value. The value is defined with up to two bytes of data (msb, lsb) that each can go from 0 to 127.
MIDI [registered parameters] (https://www.midi.org/specifications-old/item/table-3-control-change-messages-data-bytes-2) extend the original list of control change messages. The MIDI 1.0 specification lists only a limited number of them. Here are the original registered parameters with the identifier that can be used as the first parameter of this function:
- Pitchbend Range (0x00, 0x00):
"pitchbendrange"
- Channel Fine Tuning (0x00, 0x01):
"channelfinetuning"
- Channel Coarse Tuning (0x00, 0x02):
"channelcoarsetuning"
- Tuning Program (0x00, 0x03):
"tuningprogram"
- Tuning Bank (0x00, 0x04):
"tuningbank"
- Modulation Range (0x00, 0x05):
"modulationrange"
Note that the Tuning Program and Tuning Bank parameters are part of the MIDI Tuning Standard, which is not widely implemented.
Another set of extra parameters have been later added for 3D sound controllers. They are:
- Azimuth Angle (0x3D, 0x00):
"azimuthangle"
- Elevation Angle (0x3D, 0x01):
"elevationangle"
- Gain (0x3D, 0x02):
"gain"
- Distance Ratio (0x3D, 0x03):
"distanceratio"
- Maximum Distance (0x3D, 0x04):
"maximumdistance"
- Maximum Distance Gain (0x3D, 0x05):
"maximumdistancegain"
- Reference Distance Ratio (0x3D, 0x06):
"referencedistanceratio"
- Pan Spread Angle (0x3D, 0x07):
"panspreadangle"
- Roll Angle (0x3D, 0x08):
"rollangle"
Parameters
Name Type Attributes Default Description parameter
string | Array.<number> A string identifying the parameter's name (see above) or a two-position array specifying the two control bytes (e.g.
[0x65, 0x64]
) that identify the registered parameter.data
number | Array.<number> <optional> [] An single integer or an array of integers with a maximum length of 2 specifying the desired data.
options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Details
- Pitchbend Range (0x00, 0x00):
-
setTuningBank( value [, options ] ) → {OutputChannel}
-
Description
Sets the MIDI tuning bank to use. Note that the Tuning Bank parameter is part of the MIDI Tuning Standard, which is not widely implemented.
Note: since version 3.0, the bank number is an integer between 1 and 128. In versions 1.0 and 2.0, the number was between 0 and 127. This change aligns WebMidi.js with most devices that use a numbering scheme starting at 1.
Parameters
Name Type Attributes Default Description value
number The desired tuning bank (1-128).
options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Throws
Details
-
setTuningProgram( value [, options ] ) → {OutputChannel}
-
Description
Sets the MIDI tuning program to use. Note that the Tuning Program parameter is part of the MIDI Tuning Standard, which is not widely implemented.
Note: since version 3.0, the program number is an integer between 1 and 128. In versions 1.0 and 2.0, the number was between 0 and 127. This change aligns WebMidi.js with most devices that use a numbering scheme starting at 1.
Parameters
Name Type Attributes Default Description value
number The desired tuning program (1-128).
options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Throws
Details
-
stopNote( note, options ) → {Output}
-
Description
This is an alias to the sendNoteOff() method.
Parameters
Name Type Description note
options
Returns
Details
-
turnNotesOff( [ options ] ) → {OutputChannel}
-
Description
Sends an all notes off channel mode message. This will turn all currently playing notes off. However, this does not prevent new notes from being played.
Parameters
Name Type Attributes Default Description options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Details
-
turnSoundOff( [ options ] ) → {OutputChannel}
-
Description
Sends an all sound off channel mode message. This will silence all sounds playing on that channel but will not prevent new sounds from being triggered.
Parameters
Name Type Attributes Default Description options
Object <optional> {} Name Type Attributes Description time
number | string <optional> If
time
is a string prefixed with"+"
and followed by a number, the message will be delayed by that many milliseconds. If the value is a number, the operation will be scheduled for that time. The current time can be retrieved with WebMidi.time. Ifoptions.time
is omitted, or in the past, the operation will be carried out as soon as possible.Returns
Details