new Keyboard()
A Class representing a whole Keyboard full of keys.
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
whiteKeyWidth |
number | default 23 |
scaleFactor |
number | default 1 |
keyObjects |
object | a mapping of id to |
svgObj |
DOMObject | the SVG object of the keyboard |
markC |
Boolean | default true |
showNames |
Boolean | default false |
showOctaves |
Boolean | default false |
startPitch |
string | default "C3" |
endPitch |
string | default "C5" |
hideable |
Boolean | default false -- add a way to hide and show keyboard |
scrollable |
Boolean | default false -- add scroll bars to change octave |
Members
-
callbacks :object
-
An object of callbacks on events.
default:
- click: this.clickhandler
Type:
- object
- Source:
Methods
-
appendHideableKeyboard(where, keyboardSVG)
-
Puts a hideable keyboard inside a Div with the proper controls.
Do not call this directly, just use createSVG after changing the
hideable property on the keyboard to True.Parameters:
Name Type Description whereDOMObject keyboardSVGDOMObject - Source:
-
appendKeyboard(where) → {music21.keyboard.Keyboard}
-
Appends a keyboard to the
whereparameterParameters:
Name Type Argument Description whereJQueryDOMObject | DOMObject <optional>
- Source:
Returns:
this
-
clickhandler(keyRect)
-
Handle a click on a given SVG object
Parameters:
Name Type Description keyRectDOMObject the dom object with the keyboard.
- Source:
-
createSVG() → {DOMObject}
-
Draws the SVG associated with this Keyboard
- Source:
Returns:
new svgDOM
- Type
- DOMObject
-
markMiddleC(strokeColor)
-
Puts a circle on middle c.
Parameters:
Name Type Argument Default Description strokeColorstring <optional>
'red' - Source:
-
markNoteNames(labelOctaves)
-
Puts note names on every white key.
Parameters:
Name Type Argument Default Description labelOctavesBoolean <optional>
false - Source:
-
redrawSVG() → {DOMObject}
-
Redraws the SVG associated with this Keyboard
- Source:
Returns:
new svgDOM
- Type
- DOMObject
-
removeNoteNames()
-
Remove note names on the keys, if they exist
- Source:
-
wrapScrollable(svgDOM) → {JQueryDOMObject}
-
Wraps the SVG object inside a scrollable set of buttons
Do not call this directly, just use createSVG after changing the
scrollable property on the keyboard to True.Parameters:
Name Type Description svgDOMDOMObject - Source:
Returns:
- Type
- JQueryDOMObject