cables is under heavy development.
There might be one or another bug, please let us know about it!

KeyPiano Op


Namespace: Ops.WebAudio

Op author: tim

Generates notes based on key presses

summary (oneliner)

Can be used to generate notes based on keyboard presses together with the KeyLearn-op. For every note the keyboard key can be defined in the corresponding KeyLearn-op, so e.g. you would add a KeyLearn-op, press its learn-button to store e.g. the key code for the key c and then you need to connect its on press-port with the c note on-port of KeyPiano. Please note that key-presses are only detected in the preview window by default (click inside to set the focus).
Currently only one key can be played simultaneously.

The Note On / Note Off can be connected to a Ops.Devices.Keyboard.KeyPressLearn op.



example patch id

youtube id

caniuse query


related ops


c note on (Trigger)

c note off (Trigger)

cis note on (Trigger)

cis note off (Trigger)

d note on (Trigger)

d note off (Trigger)

dis note on (Trigger)

dis note off (Trigger)

e note on (Trigger)

e note off (Trigger)

f note on (Trigger)

f note off (Trigger)

fis note on (Trigger)

fis note off (Trigger)

g note on (Trigger)

g note off (Trigger)

gis note ons (Trigger)

gis note off (Trigger)

a note on (Trigger)

a note off (Trigger)

ais note on (Trigger)

ais note off (Trigger)

b note on (Trigger)

b note off (Trigger)

octave (Number)

The currently active octave – 1 is the lowest, 7 the highest. [1-7]


frequency (Number)

The note frequency of the last pressed / released key in Hz, e.g. 440 for A4 (middle A). This port can be connected to the frequency-port of an oscillator-op e.g..

is pressed (Number)

If one of the keys is currently pressed: 1.0, if no key is pressed: 0.0. Can e.g. be connected to a Gain node, to control the volume of a Web Audio op.

Caught a mistake or want to contribute to the documentation?

Edit Documentationcancel save

Patches using KeyPiano