skip to content

On

Handles midiOn events, typically for playing an instrument’s sounds.

class
On
extends
Handle
tag
<on-blam>
see

Props

name type default description
device string null

The named MIDI device to listen to. If not set, the element listens to all connected devices.

root string C4

The key on the MIDI keyboard from which all sounds will be mapped.

range number null

How many keys, from the root, will be mapped (will actively make sounds). If not set, it’s the whole keyboard.

spread boolean false

For non-tonal instruments like Pads. Whether to spread the individual sounds over the range of keys (one sound per key).

from string

CSS selector. Must be a Midi element. If not set, looks for an ancestor Midi element.

to string

CSS selector. If not set, it looks for a single Sampler-based element.

value string null

Handle-derived elements support special value syntax. Separate with | and one value is chosen at random. Separate with ~ and a value is chosen within the range [x]~[n]. Separate with (a single space) if you are supplying multiple args to an element’s method.

event string blam

The event type to listen for. For many Event-based elements, this is the generic custom event blam.

prop string null

The property (which may be a method or map to an audioParam) to affect at the event.

bypass boolean false

Whether to stop responding to events as they happen.

chance boolean 1

The probability that the event will be responded to. From 0 to 1.

Examples

OH FUN! There are currently no examples using On.