メインコンテンツまでスキップ

Interface: PianoInputOptions

Defined in: dom/src/piano/index.ts:21

Properties​

glissando?​

optional glissando?: boolean;

Defined in: dom/src/piano/index.ts:31

Let a pointer slide from one key to the next while it is down. With it off, the key that was pressed keeps sounding until the pointer is released.

Default​

true

keyboardShortcuts?​

optional keyboardShortcuts?: KeyboardShortcuts;

Defined in: dom/src/piano/index.ts:50

Play notes from the computer keyboard: keys[i] plays layout.noteRange.first + i. SHORTCUTS has ready-made layouts.

A held key keeps its note until it is released, the focus leaves (with root), or the window loses focus. Changing the keys, the scope or the note range releases every note a key is holding, since the key would mean something else on release.


keyboardShortcutsScope?​

optional keyboardShortcutsScope?: KeyboardShortcutsScope;

Defined in: dom/src/piano/index.ts:59

Where keyboard shortcuts listen: on the element (root), which has to be focusable, or anywhere on the page (window). Keys typed into an editable element are ignored either way.

Default​

'root'

layout​

layout: PianoLayout;

Defined in: dom/src/piano/index.ts:23

Geometry of the drawn keyboard, used to find the note under a pointer.


midiMax?​

optional midiMax?: number;

Defined in: dom/src/piano/index.ts:39

Highest note that can sound. Above it a note is refused, whichever source asks for it.

Default​

127

onActiveNotesChange?​

optional onActiveNotesChange?: (notes) => void;

Defined in: dom/src/piano/index.ts:66

Called whenever PianoInputInstance.activeNotes would change.

Parameters​

ParameterType
notesnumber[]

Returns​

void


onPlayNote?​

optional onPlayNote?: (note, velocity?) => void;

Defined in: dom/src/piano/index.ts:62

Called when a note starts sounding, not for each source that asks.

Parameters​

ParameterType
notenumber
velocity?number

Returns​

void


onStopNote?​

optional onStopNote?: (note) => void;

Defined in: dom/src/piano/index.ts:64

Called once the last source holding a note has let go.

Parameters​

ParameterType
notenumber

Returns​

void