Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OpenSheetMusicDisplay

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.

Hierarchy

  • OpenSheetMusicDisplay

Index

Constructors

  • 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.

    Parameters

    • container: string | HTMLElement

      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)

    • options: IOSMDOptions = ...

      An object for rendering options like the backend (svg/canvas) or autoResize.
      For defaults see the OSMDOptionsStandard method in the OSMDOptions class.

    Returns OpenSheetMusicDisplay

Properties

OnXMLRead: Function
autoResizeEnabled: boolean
backendType: BackendType
container: HTMLElement
cursors: Cursor[] = []
cursorsOptions: CursorOptions[] = []
drawBottomLine: boolean
drawBoundingBox: string
drawSkyLine: boolean
drawingParameters: DrawingParameters
followCursor: boolean
loadUrlTimeout: number = 5000

Timeout in milliseconds used in osmd.load(string) when string is a URL.

needBackendUpdate: boolean
resizeHandlerAttached: boolean
sheet: MusicSheet
version: string = "1.8.8-release"
zoom: number = 1.0
zoomUpdated: boolean = false
PageFormatStandards: {} = ...

Standard page format options like A4 or Letter, in portrait and landscape. E.g. PageFormatStandards["A4_P"] or PageFormatStandards["Letter_L"].

Type declaration

Accessors

  • get AutoResizeEnabled(): boolean
  • set AutoResizeEnabled(value: boolean): void
  • get DrawBottomLine(): boolean
  • set DrawBottomLine(value: boolean): void
  • get DrawBoundingBox(): string
  • set DrawBoundingBox(value: string): void
  • get DrawSkyLine(): boolean
  • set DrawSkyLine(value: boolean): void
  • get FollowCursor(): boolean
  • set FollowCursor(value: boolean): void
  • get Version(): string
  • get Zoom(): number
  • set Zoom(value: number): void

Methods

  • IsReadyToRender(): boolean
  • autoResize(): void
  • clear(): void
  • createOrRefreshRenderBackend(): void
  • enableOrDisableCursors(enable: boolean): void
  • exportSVG(): void
  • getLogLevel(): number
  • handleResize(startCallback: (() => void), endCallback: (() => void)): void
  • Helper function for managing window's onResize events

    Parameters

    • startCallback: (() => void)

      is the function called when resizing starts

        • (): void
        • Returns void

    • endCallback: (() => void)

      is the function called when resizing (kind-of) ends

        • (): void
        • Returns void

    Returns void

  • load(content: string | Document, tempTitle?: string): Promise<{}>
  • Load a MusicXML file

    Parameters

    • content: string | Document

      is either the url of a file, or the root node of a MusicXML document, or the string content of a .xml/.mxl file

    • tempTitle: string = "Untitled Score"

      is used as the title for the piece if there is no title in the XML.

    Returns Promise<{}>

  • render(): void
  • reset(): void
  • setCustomPageFormat(width: number, height: number): void
  • setDrawBoundingBox(value: string, render?: boolean): void
  • setLogLevel(level: string): void
  • 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.

    Parameters

    Returns void

  • setPageFormat(formatId: string): void
  • updateGraphic(): void
  • StringToPageFormat(pageFormatString: string): PageFormat

Generated using TypeDoc