new Key()
Represents a single Key
- Source:
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 |
Methods
-
addCircle(strokeColor) → {DOMObject}
-
Adds a circle (red) on the key (to mark middle C etc.)
Parameters:
Name Type Argument Default Description strokeColorstring <optional>
'red' - Source:
Returns:
- Type
- DOMObject
-
addNoteName(labelOctaves) → {DOMObject}
-
Adds the note name on the key
Parameters:
Name Type Argument Default Description labelOctavesBoolean <optional>
false use octave numbers too?
- Source:
Returns:
- Type
- DOMObject
-
makeKey(startX) → {DOMObject}
-
Gets an SVG object for the key
Parameters:
Name Type Description startXnumber 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