Class: Keyboard

music21.keyboard. Keyboard

new Keyboard()

A Class representing a whole Keyboard full of keys.

Properties:
Name Type Description
whiteKeyWidth number

default 23

scaleFactor number

default 1

keyObjects object

a mapping of id to music21.keyboard.Key objects

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

Source:

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
where DOMObject
keyboardSVG DOMObject
Source:

appendKeyboard(where) → {music21.keyboard.Keyboard}

Appends a keyboard to the where parameter

Parameters:
Name Type Argument Description
where JQueryDOMObject | DOMObject <optional>
Source:
Returns:

this

Type
music21.keyboard.Keyboard

clickhandler(keyRect)

Handle a click on a given SVG object

Parameters:
Name Type Description
keyRect DOMObject

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
strokeColor string <optional>
'red'
Source:

markNoteNames(labelOctaves)

Puts note names on every white key.

Parameters:
Name Type Argument Default Description
labelOctaves Boolean <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
svgDOM DOMObject
Source:
Returns:
Type
JQueryDOMObject
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.