Class: Key

music21.keyboard. Key

new Key()

Represents a single Key

Properties:
Name Type Argument Default Description
callbacks Array.<function()>

called when key is clicked/selected

scaleFactor number <optional>
1
parent music21.keyboard.Keyboard | undefined
id Int

midinumber associated with the key.

pitchObj music21.pitch.Pitch | undefined
svgObj DOMObject | undefined

SVG representing the drawing of the key

noteNameSvgObj DOMObject | undefined

SVG representing the note name drawn on the key

keyStyle string ''

css style information for the key

keyClass string ''

css class information for the key ("keyboardkey" + this is the class)

width number

width of key

height number

height of key

Source:

Methods

addCircle(strokeColor) → {DOMObject}

Adds a circle (red) on the key (to mark middle C etc.)

Parameters:
Name Type Argument Default Description
strokeColor string <optional>
'red'
Source:
Returns:
Type
DOMObject

addNoteName(labelOctaves) → {DOMObject}

Adds the note name on the key

Parameters:
Name Type Argument Default Description
labelOctaves Boolean <optional>
false

use octave numbers too?

Source:
Returns:
Type
DOMObject

makeKey(startX) → {DOMObject}

Gets an SVG object for the key

Parameters:
Name Type Description
startX number

X position in pixels from left of keyboard to draw key at

Source:
Returns:

a SVG rectangle for the key

Type
DOMObject

removeNoteName() → {undefined}

Removes the note name from the key (if exists)

Source:
Returns:
Type
undefined
Music21j, Copyright © 2013-2018 Michael Scott Cuthbert and cuthbertLab.
Documentation generated by JSDoc 3.5.5 on Wed Jul 4th 2018 using the DocStrap template.