Creates and attaches an OpenSheetMusicDisplay object to an HTML element container.
After the constructor, use load() and render() to load and render a MusicXML file.
The container element OSMD will be rendered into.
Either a string specifying the ID of an HTML container element,
or a reference to the HTML element itself (e.g. div)
An object for rendering options like the backend (svg/canvas) or autoResize.
For defaults see the OSMDOptionsStandard method in the [[OSMDOptions]] class.
Protected
autoProtected
backendProtected
containerOptions from which OSMD creates cursors in enableOrDisableCursors().
Protected
drawProtected
drawProtected
drawerProtected
drawingProtected
drawProtected
followProtected
graphicTimeout in milliseconds used in osmd.load(string) when string is a URL.
Protected
needA function that is executed when the XML has been read.
The return value will be used as the actual XML OSMD parses,
so you can make modifications to the xml that OSMD will use.
Note that this is (re-)set on osmd.setOptions as {return xml}
, unless you specify the function in the options.
Protected
resizeProtected
rulesProtected
sheetProtected
versionProtected
zoomStatic
PageStandard page format options like A4 or Letter, in portrait and landscape. E.g. PageFormatStandards["A4_P"] or PageFormatStandards["Letter_L"].
Returns the version of OSMD this object is built from (the version you are using).
Protected
autoAttach the appropriate handler to the window.onResize event
Clears what OSMD has drawn on its canvas.
Protected
createEnable or disable (hide) the cursor.
whether to enable (true) or disable (false) the cursor
Protected
handleHelper function for managing window's onResize events
is the function called when resizing starts
is the function called when resizing (kind-of) ends
States whether the render() function can be safely called.
Load a MusicXML file
is either the url of a file, or the root node of a MusicXML document, or the string content of a .xml/.mxl file
is used as the title for the piece if there is no title in the XML.
Render the loaded music sheet to the container.
Re-render and scroll back to previous scroll bar y position in percent. If the document keeps the same height/length, the scroll bar position will basically be unchanged. For example, if you scroll to the bottom of the page, resize by one pixel (or enable dark mode) and call this, for the human eye there will be no detectable scrolling or change in the scroll position at all. If you just call render() instead of renderAndScrollBack(), it will scroll you back to the top of the page, even if you were scrolled to the bottom before.
Protected
resetInitialize this object to default values FIXME: Probably unnecessary
Sets the logging level for this OSMD instance. By default, this is set to warn
.
@param: content can be trace
, debug
, info
, warn
or error
.
Set OSMD rendering options using an IOSMDOptions object. Can be called during runtime. Also called by constructor. For example, setOptions({autoResize: false}) will disable autoResize even during runtime.
Sets page format by string. Used by setOptions({pageFormat: "A4_P"}) for example.
(Re-)creates the graphic sheet from the music sheet
Static
String
The main class and control point of OpenSheetMusicDisplay.
It can display MusicXML sheet music files in an HTML element container.
After the constructor, use load() and render() to load and render a MusicXML file.