midi_note_on()

Sends a “note on” MIDI message to a specified MIDI channel with a given note number and velocity.

Syntax

midi_note_on(channel, note_number, velocity)

Parameters

Parameter Type Description Comment
channel Number The MIDI channel (0-15). Valid values are 0-15.
note_number Number The note number (0-127). Represents the MIDI note (e.g., 60 = Middle C).
velocity Number The velocity of the note (0.0 to 1.0). Represents the loudness or intensity of the note.

Return Value

Examples

Send a “note on” message for channel 1, note 60 (Middle C) with velocity 0.8

midi_note_on(1, 60, 0.8); // returns 1 if successful

Send a “note on” message for channel 0, note 64 (E4) with velocity 0.5

midi_note_on(0, 64, 0.5); // returns 1 if successful

See also

midi_note_on
midi_note_off
midi_ctrl
midi_prog
midi_play
midi_stop
midi_is_playing

midiin_channel
midiin_prog
midiin_note
midiin_ctrl