A newer version of Max is available. Click here to access the latest version of the documentation

kslider Reference

Output numbers from an onscreen keyboard

kslider

Description

Outputs and displays note and velocity information using an on-screen keyboard.

Examples

Produce output by clicking on the keyboard... or use to display incoming pitches

Arguments

None.

Attributes

blackkeycolor [4 floats]

Sets the color for the upper level of keys (otherwise known as the black keys) in RGBA format.

hkeycolor [4 floats]

Sets the selected key color in RGBA format.

inputmode [int] (default: 0)

Set how incoming MIDI is interpreted.

Possible values:

0 = 'Off' ( Input passed unclipped to output )
1 = 'MIDI' ( Input clipped to 0-127 )
2 = 'Visible' ( Input clipped to visible range )

mode [int] (default: 0)

Sets the kslider object's mode of operation.
Monophonic: (the default) Only one key can be selected and displayed at one time.
Polyphonic: The kslider object keeps track of note-ons and note-offs, so it mirrors which notes are currently held down on your MIDI keyboard. A key is “turned off” by sending the kslider object a key on message with a velocity of 0.
Touchscreen: Same as polyphonic, except touch up and mouse up events send out note offs.

Possible values:

0 = 'Monophonic'
1 = 'Polyphonic'
2 = 'Touchscreen'

offset [int] (default: 36)

Sets an offset value in octaves for the kslider object.

parameter_enable [int]

Enables use of this object with Max for Live Parameters and allows for setting initial parameter values in the Max environment.

parameter_mappable [int] (default: 1)

When parameter_mappable is enabled, the object will be available for mapping to keyboard or MIDI input using the Mappings feature.

range [int] (default: 48)

Sets the number of keys in the keyboard display.

selectioncolor [4 floats]7.0.0

Sets the color for the currently active keys in RGBA format.

style [symbol] (default: )7.0.0

Sets the style to be applied to the object. Styles can be set using the Format palette.

whitekeycolor [4 floats]

Sets the color for the lower level of keys (otherwise known as the white keys) in RGBA format.

Common Box Attributes

Parameter Attributes

Messages

bang

In left inlet: Sends out the pitch and velocity values currently stored in kslider.

int

Arguments

pitch [int]
The number received in the inlet is displayed graphically by kslider if it falls within its displayed range. The current velocity value (from 1 to 127) that kslider holds is sent out its right outlet, followed by the received number out the left outlet.

  (inlet1)

Arguments

velocity [int]
In right inlet: The number received in the right inlet sets the output key velocity without triggering output.

float

Arguments

pitch [float]
Converted to int.

  (inlet1)

Arguments

velocity [float]
Converted to int.

chord

Arguments

value-pairs [list]
In left inlet: The word chord, followed by a list of MIDI note name and velocity pairs, can be used to play chords on the kslider in polyphonic mode (set by the mode 1 message). The chord message sends note-offs for currently held notes, followed by note-on commands for the specified note and velocity pairs. When the kslider object's state is saved by a preset object in polyphonic mode, the preset object will store chord messages.

clear

In left inlet: The clear message will clear any currently highlighted notes on the keyboard, but will not trigger any output.

flush

In left inlet: When the kslider object is in polyphonic mode (set by the mode 1 message), the flush message will send note-offs to currently held notes and clear the kslider object's display.

(mouse)

The kslider object sends out numbers when you click or drag on it with the mouse. The velocity value is determined by the vertical position of the mouse within each key. Higher vertical positions produce higher velocities, to a maximum of 127.
If the kslider object is in polyphonic mode, you need to click on a key twice: once to send a note-on, and once again for a note-off.
Clicking on the very rightmost edge of the kslider sends out the note of the key C that would be just to the right of the keys that are visible.

set

Arguments

pitch [int]
velocity [int]
In left inlet: The word set, followed by a number, changes the value displayed by kslider, without triggering output.

size

Arguments

size-flag [int]
This is a legacy message - the size of the kslider object can be set by clicking on the object's resize handle and dragging.
In left inlet: The word size, followed by a zero or one, sets the size of the keyboard display. size 0 (default) sets the large keyboard, and size 1 selects the small keyboard.

Output

int

kslider sends its current velocity value out its right outlet, followed by the (displayable) pitch value out its left outlet, when a number is received in its inlet or you click or drag on the object.

See Also

Name Description
MIDI MIDI
makenote
notein
noteout
nslider
pictslider
rslider
slider