OptionalalignWhether to let Vexflow align rests to preceding or following notes (Vexflow option). Default false (0). This can naturally reduce collisions of rest notes with other notes. Auto mode (2) only aligns rests when there are multiple voices in a measure, and at least once at the same x-coordinate. Auto is the recommended setting, and would be default, if it couldn't in rare cases deteriorate rest placement for existing users. The on mode (1) always aligns rests, also changing their position when there is no simultaneous note at the same x-coordinate, which is nonstandard.
OptionalautoWhether to automatically create beams for notes that don't have beams set in XML.
OptionalautoOptions for autoBeaming like whether to beam over rests. See AutoBeamOptions interface.
OptionalautoSet to true if subsequent measures full of rests should be auto-converted to multi-rest measure. Default is true This works across instruments- If all instruments have subsequent measures with nothing but rests, multirest measures are generated
OptionalautoAutomatically render the score again when the width of its container changes. Default is true.
true: observes the container (ResizeObserver), so the score also adapts when the container changes its width without
a window resize, e.g. next to a sidebar that opens, in a split pane, or when a hidden container (a tab, display: none)
is shown: a render() while it's hidden is skipped, and done when it gets a width. Only width changes render again,
200 ms after the last one. In a browser without ResizeObserver, this listens to the window's resize events instead.
A sheet taller than the window makes the page's scrollbar appear, which narrows the container where scrollbars
take space: this doesn't render again, the sheet stays as wide as the container was (reserve the scrollbar's
space with the CSS scrollbar-gutter: stable or overflow-y: scroll on the scrolling element to avoid that).
false: the score is only rendered when you call render(), e.g. from your own resize handling.
An automatic render replaces the drawn elements: see onRender to do something after each one.
Meanwhile, the container keeps the instance in memory: it's freed together with its
container, or call osmd.dispose() when you don't need it anymore but keep the container.
Setting this to false (also during runtime) removes the observer or listener as well.
OptionalbackendRender backend: "canvas" (in any letter case) for Canvas, anything else for SVG, e.g. "svg" or a misspelled value. Default SVG.
OptionalcoloringWhether to enable coloring noteheads and stems, depending on coloringMode.
OptionalcoloringDefines the mode that is used for coloring: XML (0), Boomwhacker(1), CustomColorSet (2). Default XML. If coloringMode.CustomColorSet (2) is chosen, a coloringSetCustom parameter must be added.
OptionalcoloringSet of 8 colors for automatic coloring of 7 notes from C to B + rest note in HTML form (e.g. "#00ff00" for green).
OptionalcolorWhether to color the stems of notes the same as their noteheads. Default false.
OptionalcursorsDefines multiple simultaneous cursors. If left undefined the standard cursor will be used, or with osmd.setOptions(), the cursors set before are kept.
OptionaldarkDark mode (black background, white notes). Simply sets defaultColorMusic and EngravingRules.PageBackgroundColor.
OptionaldefaultDefault color for Labels like title or lyrics. Default black (undefined).
OptionaldefaultDefault color for all musical elements including key signature etc. Can be used for dark mode etc. Default undefined.
OptionaldefaultDefault color for a note head (without stem). Default black (undefined).
Only considered before loading a sample, not before render.
To change the color after loading a sample and before render, use note(.sourceNote).NoteheadColor.
The format is Vexflow format, either "#rrggbb" or "#rrggbboo" where
OptionaldefaultDefault color for rests. Default black (undefined).
OptionaldefaultDefault color for a note stem. Default black (undefined).
OptionaldefaultDefault color for labels in the title. Overrides defaultColorLabel for title labels like composer. Default black (undefined).
OptionaldefaultDefault font used for text and labels, e.g. title or lyrics. Default Times New Roman Note that OSMD originally always used Times New Roman, so things like layout and spacing may still be optimized for it. Valid options are CSS font families available in the browser used for rendering, e.g. Times New Roman, Helvetica.
OptionaldefaultDefault font style, e.g. FontStyles.Bold (1). Default Regular (0).
OptionaldisableDon't show/load cursor. Will override disableCursor in drawingParameters. false draws the cursors again from the next render(), also after true or a drawingParameters mode without cursors.
OptionaldrawWhether to draw the composer name (top right of the score).
OptionaldrawWhether to draw credits, including title, subtitle, composer, lyricist, copyright and independent first-page words. Independent words require EngravingRules.ReadFirstPageCreditWords to be enabled before loading the score.
OptionaldrawWhether to draw fingerings. Default true. For their position, see fingeringPosition. Can be turned off and on again after load(), with a render(). Only with fingeringPosition left or right, where the fingerings are created with the notes, call osmd.updateGraphic() before that render().
OptionaldrawOnly draw measure n to m, where n is the number you specify. (for m, see drawUpToMeasureNumber) 0 (the default) draws from the first measure again.
OptionaldrawWhether to draw hidden/invisible notes and rests (print-object="no" in XML) like visible ones. Default false. Sets EngravingRules.RenderHiddenNotes. To change it after load(), call osmd.updateGraphic() before the next render().
OptionaldrawingBroad Parameters like compact or preview mode. Also try "compacttight", which is like compact but also reduces margins. To see what this mode does and maybe adjust the spacing parameters yourself instead of using the mode, see DrawingParameters.ts:setForCompactTightMode().
OptionaldrawWhether to draw the lyricist's name, if given (top left of the score).
OptionaldrawWhether to draw lyrics (and their extensions and dashes).
OptionaldrawWhether to draw measure numbers (labels). Default true. Draws a measure number label at first measure, system start measure, and every [measureNumberInterval] measures. See the [measureNumberInterval] option, default is 2.
OptionaldrawWhether to only draw measure numbers at the start of a system ("new line"), instead of every [measureNumberInterval] measures. Default false.
OptionaldrawWhether to draw metronome marks (e.g. quarter = 120), at each place the score has one. Default true.
OptionaldrawWhether to draw part (instrument) name abbreviations each system after the first. Only draws if drawPartNames. Default true. Single-staff systems additionally need EngravingRules.RenderPartAbbreviationsForSingleStaff.
OptionaldrawWhether to draw part (instrument) names. Setting this to false also disables drawPartAbbreviations, unless explicitly enabled (drawPartNames: false, drawPartAbbreviations: true).
OptionaldrawWhether to draw a measure of a staff that consists only of rests of one voice, filling the measure, as one whole-measure rest, e.g. four quarter rests in 4/4 or six quarter rests in 6/4 (like a measure with a single whole-measure rest). Only affects drawing: the rests keep their time, and chord symbols stay at their times in the measure. Doesn't apply to pickup measures, multiple voices, hidden or positioned rests, tuplets, beams, grace notes, rests carrying marks (e.g. fermatas), or an in-measure clef or key change. Default false. Set before load(), or call updateGraphic() after changing it.
OptionaldrawWhether to calculate extra slurs with bezier curves not covered by Vexflow slurs. Default true.
OptionaldrawWhether to draw the subtitle of the piece. If true, enables drawing Title as well.
OptionaldrawWhether to draw time signatures (e.g. 4/4). Default true.
OptionaldrawWhether to draw the title of the piece. If false, disables drawing Subtitle as well.
OptionaldrawOnly draw measure n to m, where m is the number specified. (for n, see drawFromMeasureNumber) Number.MAX_VALUE (the default) draws up to the last measure again.
OptionaldrawOnly draw the first n pages, where n is the number specified. 0 (or Number.MAX_VALUE, the default) draws all pages again.
OptionaldrawOnly draw the first n systems, where n is the number specified. 0 (or Number.MAX_VALUE, the default) draws all systems again.
OptionalfillWhether to fill measures that don't have notes given in the XML with whole rests (visible = 1, invisible = 2, for layouting). Default No (0).
OptionalfingeringFor above/below fingerings, whether to draw them directly above/below notes (default), or above/below staffline.
OptionalfingeringWhere to draw fingerings (above, below, aboveorbelow, left, right, or auto). Default AboveOrBelow. Auto experimental
OptionalfollowFollow Cursor: Scroll the cursor into view each time it is updated, e.g. by cursor.next(), previous(), reset() or show():
to the vertical center of the view (smoothly, or at once over a long distance), or to the horizontal center
with renderSingleHorizontalStaffline. Default off. This also scrolls while the cursor is still in view,
and only for cursors that have follow: true in their cursorsOptions (the standard cursor has).
Can also be set by osmd.FollowCursor.
OptionalhiddenThe color of the hidden notes drawn with drawHiddenNotes. Default "#A0A0A0CC", a light, slightly transparent gray. "" draws them in the colors of visible notes. Sets EngravingRules.HiddenNotesColor.
OptionalkeepWhether the instance keeps a small rendering alive, so that a sheet rendered after clear() renders about as fast as the one before it: true, false, or "auto" (default): in Chromium-based browsers. Sets osmd.KeepWarm, see there.
OptionalmeasureThe interval of measure numbers to draw, i.e. it draws the measure number above the beginning label every x measures. Default 2.
OptionalnewWhether to begin a new page ("page break") when given in XML ('new-page="yes"'). Default false, because OSMD does its own layout that will do page breaks interactively (when given a PageFormat) at different measures. So this option may result in a page break after a single measure on a page.
OptionalnewWhether to begin a new system ("line break") when given a new page in XML ('new-page="yes"'), but newPageFromXML is false. Default false, because OSMD does its own layout that will do line breaks interactively at different measures. So this option may result in a system break after a single measure in a system.
OptionalnewWhether to begin a new system ("line break") when given in XML ('new-system="yes"'). Default false, because OSMD does its own layout that will do line breaks interactively at different measures. So this option may result in a system break after a single measure in a system.
OptionalpageA custom page/canvas background color. Default undefined/transparent. Example: "#FFFFFF" = white. "#12345600" = transparent. This can be useful when you want to export an image with e.g. white background color instead of transparent, from a CanvasBackend. With the SVG backend, this is the CSS background-color of each page's
OptionalpageSee OpenSheetMusicDisplay.PageFormatStandards for standard options like "A4 P" or "Endless". Default Endless. Uses OpenSheetMusicDisplay.StringToPageFormat(). Unfortunately it would be error-prone to set a PageFormat type directly.
OptionalpercussionThis property is only active if the above property is active (percussionOneLineCutoff) This is the cutoff for forcing all voices to the single line, instead of rendering them at different positions above/below the line. The default is 1, so a part with only one note position is rendered on the line. This is for cases like a Concert snare, which has multiple 'instruments' available (snare, side stick) should still render only on the line since there is no ambiguity. If this value is 0, the feature is turned off. IF this value is -1, it will render all percussion clef voices on the single line.
OptionalpercussionThe cutoff number for rendering percussion clef stafflines as a single line. Default is 3.
This is the number of different note positions on the staff (usually one per instrument), e.g. a drumset:
OptionalrenderThis makes OSMD render on one single horizontal (staff-)line. This option should be set before loading a score. It only starts working after load(), calling setOptions() after load and then render() doesn't work in this case. Explicit system breaks still begin a new system below, e.g. with newSystemFromXML (see EngravingRules.RenderSingleHorizontalStaffline).
OptionalsetWhether to set the wanted stem direction by xml (default) or automatically.
OptionalskyDefines the minimum number of measures in the entire sheet music where the skyline and bottom-line batch calculation is enabled, if useGeometricSkyBottomLineCalculation is false.
OptionalspacingNumber in pixels, of spacing between multi-line labels
OptionalspacingThe softmaxFactor for Vexflow's formatter. Default is 15, default in Vexflow is 100 (voice.js). Lowering this factor makes the spacing between individual notes smaller (especially from one half note to the next). So, to get more compact scores, try lowering this value (or set osmd.zoom, which simply scales), or try 100 for a more expansive layout. Setting this is the same as setting osmd.EngravingRules.SoftmaxFactorVexFlow.
OptionalstretchSet to true if the last system line should be streched across the whole page just as the other systems. Default is false
OptionaltripletsWhether all triplets should be bracketed. Overrides tupletsBracketed for triplets. If false, only triplets given as bracketed in XML (bracket="yes") will be bracketed. (Bracketing all triplets can be cluttering)
OptionaltupletsWhether all tuplets should be bracketed (e.g. |--5--| instead of 5). Default false. If false, only tuplets given as bracketed in XML (bracket="yes") will be bracketed.
OptionaltupletsWhether tuplets are labeled with ratio (e.g. 5:2 instead of 5 for quintuplets). Default false.
OptionaluseWhether to calculate the skyline and bottom-line geometrically, from the extents of the VexFlow draw calls, instead of drawing each measure on a hidden canvas and reading back its pixels, which is much slower. Default true. If set to false, the previous pixel-based calculation is used, see skyBottomLineBatchMinMeasures.
OptionaluseWhether to read measure numbers from the "number" attribute in the xml file as opposed to defaulting to start at measure 1. Default true.
OptionalonA function that is called after each render: at the end of render() and of each batch of renderNext(). Code after your own render() call does the same; this also covers the renders OSMD starts itself: with autoResize, when the container's width changed, and the batches of enableIncrementalRenderingOnScroll(). A render replaces the SVG elements, so this is the place to color them or add listeners to them again. Also osmd.OnRender.
OptionalonA custom function that is executed when the xml is read, modifies it, and returns a new xml string that OSMD then parses.
Possible options for the OpenSheetMusicDisplay constructor and osmd.setOptions(). None are mandatory. Note that after using setOptions(), you have to call osmd.render() again to make changes visible. Example: osmd.setOptions({defaultColorRest: "#AAAAAA", drawSubtitle: false}); osmd.render(); An option that is left out (or undefined) keeps its value, and OSMD doesn't change the options object it is given.
Note that some additional, usually more small scale options are available in EngravingRules, though not all of them are meant to be manipulated. The OSMDOptions are the main options we support.