index.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002
  1. import { OpenSheetMusicDisplay } from '../src/OpenSheetMusicDisplay/OpenSheetMusicDisplay';
  2. import { BackendType } from '../src/OpenSheetMusicDisplay/OSMDOptions';
  3. import { PlaybackManager, LinearTimingSource, BasicAudioPlayer, ControlPanel } from '../src/Playback';
  4. import * as jsPDF from '../node_modules/jspdf-yworks/dist/jspdf.min';
  5. import * as svg2pdf from '../node_modules/svg2pdf.js/dist/svg2pdf.min';
  6. import { TransposeCalculator } from '../src/Plugins/Transpose/TransposeCalculator';
  7. /*jslint browser:true */
  8. (function () {
  9. "use strict";
  10. var openSheetMusicDisplay;
  11. var sampleFolder = process.env.STATIC_FILES_SUBFOLDER ? process.env.STATIC_FILES_SUBFOLDER + "/" : "",
  12. samples = {
  13. "Beethoven, L.v. - An die ferne Geliebte": "Beethoven_AnDieFerneGeliebte.xml",
  14. "Clementi, M. - Sonatina Op.36 No.1 Pt.1": "MuzioClementi_SonatinaOpus36No1_Part1.xml",
  15. "Clementi, M. - Sonatina Op.36 No.1 Pt.2": "MuzioClementi_SonatinaOpus36No1_Part2.xml",
  16. "Clementi, M. - Sonatina Op.36 No.3 Pt.1": "MuzioClementi_SonatinaOpus36No3_Part1.xml",
  17. "Clementi, M. - Sonatina Op.36 No.3 Pt.2": "MuzioClementi_SonatinaOpus36No3_Part2.xml",
  18. "Bach, J.S. - Praeludium in C-Dur BWV846 1": "JohannSebastianBach_PraeludiumInCDur_BWV846_1.xml",
  19. "Bach, J.S. - Air": "JohannSebastianBach_Air.xml",
  20. "Gounod, C. - Méditation": "CharlesGounod_Meditation.xml",
  21. "Haydn, J. - Concertante Cello": "JosephHaydn_ConcertanteCello.xml",
  22. "Joplin, S. - Elite Syncopations": "ScottJoplin_EliteSyncopations.xml",
  23. "Joplin, S. - The Entertainer": "ScottJoplin_The_Entertainer.xml",
  24. "Mozart, W.A. - An Chloe": "Mozart_AnChloe.xml",
  25. "Mozart, W.A. - Das Veilchen": "Mozart_DasVeilchen.xml",
  26. "Mozart, W.A. - Clarinet Quintet (Excerpt)": "Mozart_Clarinet_Quintet_Excerpt.mxl",
  27. "Mozart, W.A. - String Quartet in G, K. 387, 1st Mvmt Excerpt": "Mozart_String_Quartet_in_G_K._387_1st_Mvmnt_excerpt.musicxml",
  28. "Mozart/Holzer - Land der Berge (national anthem of Austria)": "Land_der_Berge.musicxml",
  29. "OSMD Function Test - All": "OSMD_function_test_all.xml",
  30. "OSMD Function Test - Accidentals": "OSMD_function_test_accidentals.musicxml",
  31. "OSMD Function Test - Autobeam": "OSMD_function_test_autobeam.musicxml",
  32. "OSMD Function Test - Auto-/Custom-Coloring": "OSMD_function_test_auto-custom-coloring-entchen.musicxml",
  33. "OSMD Function Test - Bar lines": "OSMD_function_test_bar_lines.musicxml",
  34. "OSMD Function Test - Chord Symbols": "OSMD_function_test_chord_symbols.musicxml",
  35. "OSMD Function Test - Chord Spacing": "OSMD_function_test_chord_spacing.mxl",
  36. "OSMD Function Test - Chord Symbols - Various Chords": "OSMD_function_test_chord_tests_various.musicxml",
  37. "OSMD Function Test - Chord Symbols - BrookeWestSample": "BrookeWestSample.mxl",
  38. "OSMD Function Test - Color (from XML)": "OSMD_function_test_color.musicxml",
  39. "OSMD Function Test - Container height (compacttight mode)": "OSMD_Function_Test_Container_height.musicxml",
  40. "OSMD Function Test - Drumset": "OSMD_function_test_drumset.musicxml",
  41. "OSMD Function Test - Drums on one Line": "OSMD_Function_Test_Drums_one_line_snare_plus_piano.musicxml",
  42. "OSMD Function Test - Expressions": "OSMD_function_test_expressions.musicxml",
  43. "OSMD Function Test - Expressions Overlap": "OSMD_function_test_expressions_overlap.musicxml",
  44. "OSMD Function Test - Grace Notes": "OSMD_function_test_GraceNotes.xml",
  45. "OSMD Function Test - Metronome Marks": "OSMD_function_test_metronome_marks.mxl",
  46. "OSMD Function Test - Multiple Rest Measures": "OSMD_function_test_multiple_rest_measures.musicxml",
  47. "OSMD Function Test - Invisible Notes": "OSMD_function_test_invisible_notes.musicxml",
  48. "OSMD Function Test - Notehead Shapes": "OSMD_function_test_noteheadShapes.musicxml",
  49. "OSMD Function Test - Ornaments": "OSMD_function_test_Ornaments.xml",
  50. "OSMD Function Test - Selecting Measures To Draw": "OSMD_function_test_measuresToDraw_Beethoven_AnDieFerneGeliebte.xml",
  51. "OSMD Function Test - System and Page Breaks": "OSMD_Function_Test_System_and_Page_Breaks_4_pages.mxl",
  52. "OSMD Function Test - Tabulature": "OSMD_Function_Test_Tabulature_hayden_study_1.mxl",
  53. "OSMD Function Test - Tabulature MultiBends": "OSMD_Function_Test_Tablature_Multibends.musicxml",
  54. "OSMD Function Test - Tabulature All Effects": "OSMD_Function_Test_Tablature_Alleffects.musicxml",
  55. "OSMD Function Test - Tremolo": "OSMD_Function_Test_Tremolo_2bars.musicxml",
  56. "OSMD Function Test - Labels": "OSMD_Function_Test_Labels.musicxml",
  57. "OSMD Function Test - High Slur Test": "test_slurs_highNotes.musicxml",
  58. "OSMD Function Test - Auto Multirest Measures Single Staff": "Test_Auto_Multirest_1.musicxml",
  59. "OSMD Function Test - Auto Multirest Measures Multiple Staves": "Test_Auto_Multirest_2.musicxml",
  60. "OSMD Function Test - String number collisions": "test_string_number_collisions.musicxml",
  61. "Schubert, F. - An Die Musik": "Schubert_An_die_Musik.xml",
  62. "Actor, L. - Prelude (Large Sample, loading time)": "ActorPreludeSample.xml",
  63. "Actor, L. - Prelude (Large, No Print Part Names)": "ActorPreludeSample_PartName.xml",
  64. "Anonymous - Saltarello": "Saltarello.mxl",
  65. "Debussy, C. - Mandoline": "Debussy_Mandoline.xml",
  66. "Levasseur, F. - Parlez Mois": "Parlez-moi.mxl",
  67. "Schumann, R. - Dichterliebe": "Dichterliebe01.xml",
  68. "Telemann, G.P. - Sonate-Nr.1.1-Dolce": "TelemannWV40.102_Sonate-Nr.1.1-Dolce.xml",
  69. "Telemann, G.P. - Sonate-Nr.1.2-Allegro": "TelemannWV40.102_Sonate-Nr.1.2-Allegro-F-Dur.xml",
  70. },
  71. comments = {
  72. "Beethoven_AnDieFerneGeliebte.xml": ["Beethoven_AnDieFerneGeliebte_comments.xml", "Beethoven_AnDieFerneGeliebte_comments_2.xml"]
  73. },
  74. zoom = 1.0,
  75. // HTML Elements in the page
  76. divControls,
  77. zoomControls,
  78. header,
  79. err,
  80. error_tr,
  81. canvas,
  82. selectSample,
  83. selectBounding,
  84. skylineDebug,
  85. bottomlineDebug,
  86. zoomIns,
  87. zoomOuts,
  88. zoomDivs,
  89. custom,
  90. nextCursorBtn,
  91. resetCursorBtn,
  92. followCursorCheckbox,
  93. showCursorBtn,
  94. hideCursorBtn,
  95. backendSelect,
  96. backendSelectDiv,
  97. debugReRenderBtn,
  98. debugClearBtn,
  99. selectPageSizes,
  100. printPdfBtns,
  101. transpose,
  102. transposeBtn,
  103. playbackControlsButton,
  104. playbackControl;
  105. // manage option setting and resetting for specific samples, e.g. in the autobeam sample autobeam is set to true, otherwise reset to previous state
  106. // TODO design a more elegant option state saving & restoring system, though that requires saving the options state in OSMD
  107. var minMeasureToDrawStashed = 1;
  108. var maxMeasureToDrawStashed = Number.MAX_SAFE_INTEGER;
  109. var measureToDrawRangeNeedsReset = false;
  110. var drawingParametersStashed = "default";
  111. var drawingParametersNeedsReset = false;
  112. var autobeamOptionNeedsReset = false;
  113. var autobeamOptionStashedValue = false;
  114. var autoCustomColoringOptionNeedsReset = false;
  115. var autoCustomColoringOptionStashedValue = false;
  116. var drawPartNamesOptionStashedValue = true;
  117. var drawPartAbbreviationsStashedValue = true;
  118. var drawPartNamesOptionNeedsReset = false;
  119. var pageBreaksOptionStashedValue = false;
  120. var pageBreaksOptionNeedsReset = false;
  121. var systemBreaksOptionStashedValue = false; // reset handled by pageBreaksOptionNeedsReset
  122. var showControls = true;
  123. var showExportPdfControl = false;
  124. var showPageFormatControl = false;
  125. var showZoomControl = true;
  126. var showHeader = true;
  127. var showDebugControls = false;
  128. if (process.env.OSMD_DEMO_TITLE) {
  129. document.title = process.env.OSMD_DEMO_TITLE;
  130. }
  131. // Initialization code
  132. function init() {
  133. var name, option;
  134. // Handle window parameter
  135. var paramEmbedded = findGetParameter('embedded');
  136. var paramShowControls = findGetParameter('showControls');
  137. var paramShowPageFormatControl = findGetParameter('showPageFormatControl');
  138. var paramShowExportPdfControl = findGetParameter('showExportPdfControl');
  139. var paramShowZoomControl = findGetParameter('showZoomControl');
  140. var paramShowHeader = findGetParameter('showHeader');
  141. var paramZoom = findGetParameter('zoom');
  142. var paramOverflow = findGetParameter('overflow');
  143. var paramOpenUrl = findGetParameter('openUrl');
  144. var paramDebugControls = findGetParameter('debugControls');
  145. var paramCompactMode = findGetParameter('compactMode');
  146. var paramMeasureRangeStart = findGetParameter('measureRangeStart');
  147. var paramMeasureRangeEnd = findGetParameter('measureRangeEnd');
  148. var paramPageFormat = findGetParameter('pageFormat');
  149. var paramPageBackgroundColor = findGetParameter('pageBackgroundColor');
  150. var paramBackendType = findGetParameter('backendType');
  151. var paramPageWidth = findGetParameter('pageWidth');
  152. var paramPageHeight = findGetParameter('pageHeight');
  153. var paramHorizontalScrolling = findGetParameter('horizontalScrolling');
  154. var paramSingleHorizontalStaffline = findGetParameter('singleHorizontalStaffline');
  155. showHeader = (paramShowHeader !== '0');
  156. showControls = false;
  157. if (paramEmbedded) {
  158. showControls = paramShowControls !== '0';
  159. showZoomControl = paramShowZoomControl !== '0';
  160. showPageFormatControl = paramShowPageFormatControl !== '0';
  161. showExportPdfControl = paramShowExportPdfControl !== '0';
  162. }
  163. if (paramZoom) {
  164. if (paramZoom > 0.1 && paramZoom < 5.0) {
  165. zoom = paramZoom;
  166. }
  167. }
  168. if (paramOverflow && typeof paramOverflow === 'string') {
  169. if (paramOverflow === 'hidden' || paramOverflow === 'auto' || paramOverflow === 'scroll' || paramOverflow === 'visible') {
  170. document.body.style.overflow = paramOverflow;
  171. }
  172. }
  173. var compactMode = paramCompactMode && paramCompactMode !== '0';
  174. var measureRangeStart = paramMeasureRangeStart ? Number.parseInt(paramMeasureRangeStart) : 0;
  175. var measureRangeEnd = paramMeasureRangeEnd ? Number.parseInt(paramMeasureRangeEnd) : Number.MAX_SAFE_INTEGER;
  176. if (measureRangeStart && measureRangeEnd && measureRangeEnd < measureRangeStart) {
  177. console.log("[OSMD] warning: measure range end parameter should not be smaller than measure range start. We've set start measure = end measure now.")
  178. measureRangeStart = measureRangeEnd;
  179. }
  180. let pageFormat = paramPageFormat ? paramPageFormat : "Endless";
  181. if (paramPageHeight && paramPageWidth) {
  182. pageFormat = `${paramPageWidth}x${paramPageHeight}`
  183. }
  184. var pageBackgroundColor = paramPageBackgroundColor ? "#" + paramPageBackgroundColor : undefined; // vexflow format, see OSMDOptions. can't use # in parameters.
  185. //console.log("demo: osmd pagebgcolor: " + pageBackgroundColor);
  186. var backendType = (paramBackendType && paramBackendType.toLowerCase) ? paramBackendType : "svg";
  187. var horizontalScrolling = paramHorizontalScrolling === '1';
  188. var singleHorizontalStaffline = paramSingleHorizontalStaffline === '1';
  189. // set the backendSelect debug controls dropdown menu selected item
  190. //console.log("true: " + backendSelect && backendType.toLowerCase && backendType.toLowerCase() === "canvas");
  191. // TODO somehow backendSelect becomes undefined here:
  192. /*if (backendSelect && backendType.toLowerCase && backendType.toLowerCase() === "canvas") {
  193. console.log("here1");
  194. for (var i=0; i<backendSelect.options.length; i++) {
  195. if (backendSelect.options[i].value.toLowerCase() === "canvas") {
  196. backendSelect.selectedIndex = i;
  197. }
  198. }
  199. backendSelect.value = "Canvas";
  200. }*/
  201. divControls = document.getElementById('divControls');
  202. zoomControls = document.getElementById('zoomControls');
  203. header = document.getElementById('header');
  204. err = document.getElementById("error-td");
  205. error_tr = document.getElementById("error-tr");
  206. zoomDivs = [];
  207. zoomDivs.push(document.getElementById("zoom-str"));
  208. zoomDivs.push(document.getElementById("zoom-str-optional"));
  209. custom = document.createElement("option");
  210. selectSample = document.getElementById("selectSample");
  211. selectBounding = document.getElementById("selectBounding");
  212. skylineDebug = document.getElementById("skylineDebug");
  213. bottomlineDebug = document.getElementById("bottomlineDebug");
  214. zoomIns = [];
  215. zoomIns.push(document.getElementById("zoom-in-btn"));
  216. zoomIns.push(document.getElementById("zoom-in-btn-optional"));
  217. zoomOuts = [];
  218. zoomOuts.push(document.getElementById("zoom-out-btn"));
  219. zoomOuts.push(document.getElementById("zoom-out-btn-optional"));
  220. canvas = document.createElement("div");
  221. if (horizontalScrolling) {
  222. canvas.style.overflowX = 'auto'; // enable horizontal scrolling
  223. }
  224. //canvas.id = 'osmdCanvasDiv';
  225. //canvas.style.overflowX = 'auto'; // enable horizontal scrolling
  226. nextCursorBtn = document.getElementById("next-cursor-btn");
  227. resetCursorBtn = document.getElementById("reset-cursor-btn");
  228. followCursorCheckbox = document.getElementById("follow-cursor-checkbox");
  229. showCursorBtn = document.getElementById("show-cursor-btn");
  230. hideCursorBtn = document.getElementById("hide-cursor-btn");
  231. backendSelect = document.getElementById("backend-select");
  232. backendSelectDiv = document.getElementById("backend-select-div");
  233. debugReRenderBtn = document.getElementById("debug-re-render-btn");
  234. debugClearBtn = document.getElementById("debug-clear-btn");
  235. selectPageSizes = [];
  236. selectPageSizes.push(document.getElementById("selectPageSize"));
  237. selectPageSizes.push(document.getElementById("selectPageSize-optional"));
  238. printPdfBtns = [];
  239. printPdfBtns.push(document.getElementById("print-pdf-btn"));
  240. printPdfBtns.push(document.getElementById("print-pdf-btn-optional"));
  241. transpose = document.getElementById('transpose');
  242. transposeBtn = document.getElementById('transpose-btn');
  243. playbackControlsButton = document.getElementById("playback-settings-button")
  244. //var defaultDisplayVisibleValue = "block"; // TODO in some browsers flow could be the better/default value
  245. var defaultVisibilityValue = "visible";
  246. var devDemoRunning = process.env.OSMD_DEBUG_CONTROLS;
  247. showDebugControls = paramDebugControls === '1' || (devDemoRunning && paramDebugControls !== '0')
  248. if (showDebugControls) {
  249. var elementsToEnable = [
  250. selectSample, selectBounding, selectPageSize, backendSelect, backendSelectDiv, divControls
  251. ];
  252. for (var i=0; i<elementsToEnable.length; i++) {
  253. if (elementsToEnable[i]) { // make sure this element is not null/exists in the index.html, e.g. github.io demo has different index.html
  254. if (elementsToEnable[i].style) {
  255. elementsToEnable[i].style.visibility = defaultVisibilityValue;
  256. elementsToEnable[i].style.opacity = 1.0;
  257. }
  258. }
  259. }
  260. } else {
  261. if (divControls) {
  262. divControls.style.display = "none";
  263. }
  264. }
  265. const optionalControls = document.getElementById('optionalControls');
  266. if (optionalControls) {
  267. if (showControls) {
  268. optionalControls.style.visibility = defaultVisibilityValue;
  269. optionalControls.style.opacity = 0.8;
  270. } else {
  271. optionalControls.style.display = 'none';
  272. }
  273. }
  274. if (!showHeader) {
  275. if (header) {
  276. header.style.display = 'none';
  277. }
  278. } else {
  279. if (header) {
  280. header.style.opacity = 1.0;
  281. }
  282. }
  283. // Hide error
  284. error();
  285. if (showControls) {
  286. const optionalControls = document.getElementById('optionalControls');
  287. if (optionalControls) {
  288. optionalControls.style.opacity = 1.0;
  289. // optionalControls.appendChild(zoomControlsButtons);
  290. // optionalControls.appendChild(zoomControlsString);
  291. optionalControls.style.position = 'absolute';
  292. optionalControls.style.zIndex = '10';
  293. optionalControls.style.right = '10px';
  294. // optionalControls.style.padding = '10px';
  295. }
  296. if (showZoomControl) {
  297. const zoomControlsButtonsColumn = document.getElementById('zoomControlsButtons-optional-column');
  298. zoomControlsButtonsColumn.style.opacity = 1.0;
  299. // const zoomControlsButtons = document.getElementById('zoomControlsButtons-optional');
  300. // zoomControlsButtons.style.opacity = 1.0;
  301. const zoomControlsString = document.getElementById('zoom-str-optional'); // actually === zoomDivs[1] above
  302. if (zoomControlsString) {
  303. zoomControlsString.innerHTML = Math.floor(zoom * 100.0) + "%";
  304. zoomControlsString.style.display = 'inline';
  305. // zoomControlsString.style.padding = '10px';
  306. }
  307. }
  308. if (showExportPdfControl) {
  309. const exportPdfButtonColumn = document.getElementById('print-pdf-btn-optional-column');
  310. if (exportPdfButtonColumn) {
  311. exportPdfButtonColumn.style.opacity = 1.0;
  312. }
  313. }
  314. const pageFormatControlColumn = document.getElementById("selectPageSize-optional-column");
  315. if (pageFormatControlColumn) {
  316. if (showPageFormatControl) {
  317. pageFormatControlColumn.style.opacity = 1.0;
  318. } else {
  319. // showPageFormatControlColumn.innerHTML = "";
  320. // pageFormatControlColumn.style.minWidth = 0;
  321. // pageFormatControlColumn.style.width = 0;
  322. pageFormatControlColumn.style.display = 'none'; // squeezes buttons/columns
  323. // pageFormatControlColumn.style.visibility = 'hidden';
  324. // const optionalControlsColumnContainer = document.getElementById("optionalControlsColumnContainer");
  325. // optionalControlsColumnContainer.removeChild(pageFormatControlColumn);
  326. // optionalControlsColumnContainer.width *= 0.66;
  327. // optionalControls.witdh *= 0.66;
  328. // optionalControls.focus();
  329. }
  330. }
  331. }
  332. // Create select
  333. for (name in samples) {
  334. if (samples.hasOwnProperty(name)) {
  335. option = document.createElement("option");
  336. option.value = samples[name];
  337. option.textContent = name;
  338. }
  339. if (selectSample) {
  340. selectSample.appendChild(option);
  341. }
  342. }
  343. if (selectSample) {
  344. selectSample.onchange = selectSampleOnChange;
  345. }
  346. if (selectBounding) {
  347. selectBounding.onchange = selectBoundingOnChange;
  348. }
  349. for (const selectPageSize of selectPageSizes) {
  350. if (selectPageSize) {
  351. selectPageSize.onchange = function (evt) {
  352. var value = evt.target.value;
  353. openSheetMusicDisplay.setPageFormat(value);
  354. openSheetMusicDisplay.render();
  355. };
  356. }
  357. }
  358. for (const printPdfBtn of printPdfBtns) {
  359. if (printPdfBtn) {
  360. printPdfBtn.onclick = function () {
  361. createPdf();
  362. }
  363. }
  364. }
  365. // Pre-select default music piece
  366. custom.appendChild(document.createTextNode("Custom"));
  367. // Create zoom controls
  368. for (const zoomIn of zoomIns) {
  369. if (zoomIn) {
  370. zoomIn.onclick = function () {
  371. zoom *= 1.2;
  372. scale();
  373. };
  374. }
  375. }
  376. for (const zoomOut of zoomOuts) {
  377. if (zoomOut) {
  378. zoomOut.onclick = function () {
  379. zoom /= 1.2;
  380. scale();
  381. };
  382. }
  383. }
  384. if (skylineDebug) {
  385. skylineDebug.onclick = function () {
  386. openSheetMusicDisplay.DrawSkyLine = !openSheetMusicDisplay.DrawSkyLine;
  387. openSheetMusicDisplay.render();
  388. }
  389. }
  390. if (bottomlineDebug) {
  391. bottomlineDebug.onclick = function () {
  392. openSheetMusicDisplay.DrawBottomLine = !openSheetMusicDisplay.DrawBottomLine;
  393. openSheetMusicDisplay.render();
  394. }
  395. }
  396. if (debugReRenderBtn) {
  397. debugReRenderBtn.onclick = function () {
  398. rerender();
  399. }
  400. }
  401. if (debugClearBtn) {
  402. debugClearBtn.onclick = function () {
  403. openSheetMusicDisplay.clear();
  404. }
  405. }
  406. // Create OSMD object and canvas
  407. openSheetMusicDisplay = new OpenSheetMusicDisplay(canvas, {
  408. autoResize: true,
  409. backend: backendType,
  410. //backend: "canvas",
  411. disableCursor: false,
  412. drawingParameters: compactMode ? "compact" : "default", // try compact (instead of default)
  413. drawPartNames: true, // try false
  414. // drawTitle: false,
  415. // drawSubtitle: false,
  416. drawFingerings: true,
  417. fingeringPosition: "left", // left is default. try right. experimental: auto, above, below.
  418. // fingeringInsideStafflines: "true", // default: false. true draws fingerings directly above/below notes
  419. setWantedStemDirectionByXml: true, // try false, which was previously the default behavior
  420. // drawUpToMeasureNumber: 3, // draws only up to measure 3, meaning it draws measure 1 to 3 of the piece.
  421. drawFromMeasureNumber : measureRangeStart,
  422. drawUpToMeasureNumber : measureRangeEnd,
  423. //drawMeasureNumbers: false, // disable drawing measure numbers
  424. //measureNumberInterval: 4, // draw measure numbers only every 4 bars (and at the beginning of a new system)
  425. useXMLMeasureNumbers: true, // read measure numbers from xml
  426. // coloring options
  427. coloringEnabled: true,
  428. // defaultColorNotehead: "#CC0055", // try setting a default color. default is black (undefined)
  429. // defaultColorStem: "#BB0099",
  430. autoBeam: false, // try true, OSMD Function Test AutoBeam sample
  431. autoBeamOptions: {
  432. beam_rests: false,
  433. beam_middle_rests_only: false,
  434. //groups: [[3,4], [1,1]],
  435. maintain_stem_directions: false
  436. },
  437. pageFormat: pageFormat,
  438. pageBackgroundColor: pageBackgroundColor,
  439. renderSingleHorizontalStaffline: singleHorizontalStaffline
  440. // tupletsBracketed: true, // creates brackets for all tuplets except triplets, even when not set by xml
  441. // tripletsBracketed: true,
  442. // tupletsRatioed: true, // unconventional; renders ratios for tuplets (3:2 instead of 3 for triplets)
  443. });
  444. openSheetMusicDisplay.setLogLevel('info'); // set this to 'debug' if you want to see more detailed control flow information in console
  445. document.body.appendChild(canvas);
  446. window.addEventListener("keydown", function (e) {
  447. var event = window.event ? window.event : e;
  448. if (event.keyCode === 39) {
  449. openSheetMusicDisplay.cursor.next();
  450. }
  451. });
  452. nextCursorBtn.addEventListener("click", function () {
  453. openSheetMusicDisplay.cursor.next();
  454. });
  455. resetCursorBtn.addEventListener("click", function () {
  456. openSheetMusicDisplay.cursor.reset();
  457. });
  458. if (followCursorCheckbox) {
  459. followCursorCheckbox.onchange = function () {
  460. openSheetMusicDisplay.FollowCursor = !openSheetMusicDisplay.FollowCursor;
  461. }
  462. }
  463. window.addEventListener("wheel", function(e){
  464. if(followCursorCheckbox) {
  465. followCursorCheckbox.checked = false;
  466. openSheetMusicDisplay.FollowCursor = false;
  467. }
  468. });
  469. hideCursorBtn.addEventListener("click", function () {
  470. if (openSheetMusicDisplay.cursor) {
  471. openSheetMusicDisplay.cursor.hide();
  472. } else {
  473. console.info("Can't hide cursor, as it was disabled (e.g. by drawingParameters).");
  474. }
  475. });
  476. showCursorBtn.addEventListener("click", function () {
  477. if (openSheetMusicDisplay.cursor) {
  478. openSheetMusicDisplay.cursor.show();
  479. } else {
  480. console.info("Can't show cursor, as it was disabled (e.g. by drawingParameters).");
  481. }
  482. });
  483. backendSelect.addEventListener("change", function (e) {
  484. var value = e.target.value;
  485. var createNewOsmd = true;
  486. if (createNewOsmd) {
  487. // clears the canvas element
  488. canvas.innerHTML = "";
  489. openSheetMusicDisplay = new OpenSheetMusicDisplay(canvas, { backend: value });
  490. openSheetMusicDisplay.setLogLevel('info'); // set this to 'debug' if you want to get more detailed control flow information
  491. } else {
  492. // alternative, doesn't work yet, see setOptions():
  493. openSheetMusicDisplay.setOptions({ backend: value });
  494. }
  495. console.log("[OSMD] selectSampleOnChange addEventListener change");
  496. // selectSampleOnChange();
  497. });
  498. if(transposeBtn && transpose){
  499. openSheetMusicDisplay.TransposeCalculator = new TransposeCalculator();
  500. transposeBtn.onclick = function(){
  501. var transposeValue = parseInt(transpose.value);
  502. openSheetMusicDisplay.Sheet.Transpose = transposeValue;
  503. openSheetMusicDisplay.updateGraphic();
  504. rerender();
  505. }
  506. }
  507. playbackControl = demoPlaybackControl(openSheetMusicDisplay);
  508. playbackControlsButton.addEventListener("click", function(){
  509. if(!playbackControl.IsClosed()){
  510. playbackControl.hideControls();
  511. } else {
  512. playbackControl.showControls();
  513. }
  514. });
  515. // TODO after selectSampleOnChange, the resize handler triggers immediately,
  516. // so we render twice at the start of the demo.
  517. // maybe delay the first osmd render, e.g. when window ready?
  518. if (paramOpenUrl) {
  519. if (openSheetMusicDisplay.getLogLevel() < 2) { // debug or trace
  520. console.log("[OSMD] selectSampleOnChange with " + paramOpenUrl);
  521. }
  522. // DEBUG: cause an error for a certain sample, for testing
  523. // if (paramOpenUrl.startsWith("Beethoven")) {
  524. // paramOpenUrl.causeError();
  525. // }
  526. selectSampleOnChange(paramOpenUrl);
  527. } else {
  528. if (openSheetMusicDisplay.getLogLevel() < 2) { // debug or trace
  529. console.log("[OSMD] selectSampleOnChange without param");
  530. }
  531. selectSampleOnChange();
  532. }
  533. }
  534. function findGetParameter(parameterName) {
  535. // special treatment for the openUrl parameter, because different systems attach different arguments to an URL.
  536. // because of CORS (cross-origin safety restrictions), you can only load an xml file from the same origin (server).
  537. // test parameter: ?openUrl=https://opensheetmusiceducation.org/index.php?gf-download=2020%2F01%2FJohannSebastianBach_PraeludiumInCDur_BWV846_1.xml&endUrl&form-id=1&field-id=4&hash=c4ba271ef08204a26cbd4cd2d751c53b78f238c25ddbb1f343e1172f2ce2aa53
  538. // (enable the console.log at the end of this method for testing)
  539. // working test parameter in local demo: ?openUrl=OSMD_function_test_all.xml&endUrl
  540. if (parameterName === 'openUrl') {
  541. let startParameterName = 'openUrl=';
  542. let endParameterName = '&endUrl';
  543. let openUrlIndex = location.search.indexOf(startParameterName);
  544. if (openUrlIndex < 0) {
  545. return undefined;
  546. }
  547. let endIndex = location.search.indexOf(endParameterName) + endParameterName.length;
  548. if (endIndex < 0) {
  549. console.log("[OSMD] If using openUrl as a parameter, you have to end it with '&endUrl'. openUrl parameter omitted.");
  550. return undefined;
  551. }
  552. let urlString = location.search.substring(openUrlIndex + startParameterName.length, endIndex - endParameterName.length);
  553. //console.log("openUrl: " + urlString);
  554. return urlString;
  555. }
  556. let result = undefined;
  557. let tmp = [];
  558. location.search
  559. .substr(1)
  560. .split('&')
  561. .forEach(function (item) {
  562. tmp = item.split('=');
  563. if (tmp[0] === parameterName) {
  564. result = decodeURIComponent(tmp[1]);
  565. //console.log('Found param:' + parameterName + ' = ' + result);
  566. }
  567. });
  568. return result;
  569. }
  570. function selectBoundingOnChange(evt) {
  571. var value = evt.target.value;
  572. openSheetMusicDisplay.DrawBoundingBox = value;
  573. }
  574. function selectSampleOnChange(str) {
  575. var comment = undefined;
  576. var sampleStr = undefined;
  577. error();
  578. disable();
  579. var isCustom = typeof str === "string";
  580. if (!isCustom) {
  581. if (selectSample) {
  582. sampleStr = selectSample.value;
  583. str = sampleFolder + sampleStr;
  584. } else {
  585. if (samples && samples.length > 0) {
  586. sampleStr = samples[0];
  587. str = sampleFolder + sampleStr;
  588. } else {
  589. return; // no sample to load right now
  590. }
  591. }
  592. if(comments.hasOwnProperty(sampleStr)){
  593. comment = comments[sampleStr];
  594. }
  595. }
  596. // zoom = 1.0;
  597. setSampleSpecificOptions(str, isCustom);
  598. openSheetMusicDisplay.load(str, comment).then(
  599. function () {
  600. // This gives you access to the osmd object in the console. Do not use in production code
  601. window.osmd = openSheetMusicDisplay;
  602. openSheetMusicDisplay.zoom = zoom;
  603. return openSheetMusicDisplay.render();
  604. },
  605. function (e) {
  606. errorLoadingOrRenderingSheet(e, "rendering");
  607. }
  608. ).then(
  609. function () {
  610. return onLoadingEnd(isCustom);
  611. }, function (e) {
  612. errorLoadingOrRenderingSheet(e, "loading");
  613. onLoadingEnd(isCustom);
  614. }
  615. );
  616. }
  617. function setSampleSpecificOptions(str, isCustom) {
  618. if (!isCustom && str.includes("measuresToDraw")) { // set options for measuresToDraw sample
  619. // stash previously set range of measures to draw
  620. if (!measureToDrawRangeNeedsReset) { // only stash once, when measuresToDraw called multiple times in a row
  621. minMeasureToDrawStashed = openSheetMusicDisplay.EngravingRules.MinMeasureToDrawIndex + 1;
  622. maxMeasureToDrawStashed = openSheetMusicDisplay.EngravingRules.MaxMeasureToDrawIndex + 1;
  623. }
  624. measureToDrawRangeNeedsReset = true;
  625. // for debugging: draw from a random range of measures
  626. let minMeasureToDraw = Math.ceil(Math.random() * 15); // measures start at 1 (measureIndex = measure number - 1 elsewhere)
  627. let maxMeasureToDraw = Math.ceil(Math.random() * 15);
  628. if (minMeasureToDraw > maxMeasureToDraw) {
  629. minMeasureToDraw = maxMeasureToDraw;
  630. let a = minMeasureToDraw;
  631. maxMeasureToDraw = a;
  632. }
  633. //minMeasureToDraw = 1; // set your custom indexes here. Drawing only one measure can be a special case
  634. //maxMeasureToDraw = 1;
  635. console.log("drawing measures in the range: [" + minMeasureToDraw + "," + maxMeasureToDraw + "]");
  636. openSheetMusicDisplay.setOptions({
  637. drawFromMeasureNumber: minMeasureToDraw,
  638. drawUpToMeasureNumber: maxMeasureToDraw
  639. });
  640. } else if (measureToDrawRangeNeedsReset) { // reset for other samples
  641. openSheetMusicDisplay.setOptions({
  642. drawFromMeasureNumber: minMeasureToDrawStashed,
  643. drawUpToMeasureNumber: maxMeasureToDrawStashed
  644. });
  645. measureToDrawRangeNeedsReset = false;
  646. }
  647. if (!isCustom && str.includes("Test_Container_height")) {
  648. drawingParametersStashed = openSheetMusicDisplay.drawingParameters.drawingParametersEnum;
  649. openSheetMusicDisplay.setOptions({
  650. drawingParameters: "compacttight"
  651. });
  652. drawingParametersNeedsReset = true;
  653. } else if (drawingParametersNeedsReset) {
  654. openSheetMusicDisplay.setOptions({
  655. drawingParameters: drawingParametersStashed
  656. });
  657. drawingParametersNeedsReset = false;
  658. }
  659. // Enable Boomwhacker-like coloring for OSMD Function Test - Auto-Coloring (Boomwhacker-like, custom color set)
  660. if (!isCustom && str.includes("auto-custom-coloring")) { // set options for auto coloring sample
  661. autoCustomColoringOptionNeedsReset = true;
  662. //openSheetMusicDisplay.setOptions({coloringMode: 1}); // Auto-Coloring with pre-defined colors
  663. openSheetMusicDisplay.setOptions({
  664. coloringMode: 2, // custom coloring set. 0 would be XML, 1 autocoloring
  665. coloringSetCustom: ["#d82c6b", "#F89D15", "#FFE21A", "#4dbd5c", "#009D96", "#43469d", "#76429c", "#ff0000"],
  666. // last color value of coloringSetCustom is for rest notes
  667. colorStemsLikeNoteheads: true
  668. });
  669. } else if (autoCustomColoringOptionNeedsReset) {
  670. openSheetMusicDisplay.setOptions({ // set default values. better would be to restore to stashed values, but unnecessarily complex for demo
  671. coloringMode: 0,
  672. colorStemsLikeNoteheads: false,
  673. coloringSetCustom: null
  674. });
  675. autoCustomColoringOptionNeedsReset = false;
  676. }
  677. if (!isCustom && str.includes("autobeam")) {
  678. autobeamOptionStashedValue = openSheetMusicDisplay.EngravingRules.AutoBeamNotes; // stash previously set value, to restore later
  679. autobeamOptionNeedsReset = true;
  680. openSheetMusicDisplay.setOptions({ autoBeam: true });
  681. } else if (autobeamOptionNeedsReset) {
  682. openSheetMusicDisplay.setOptions({ autoBeam: autobeamOptionStashedValue });
  683. autobeamOptionNeedsReset = false;
  684. }
  685. if (!isCustom && str.includes("OSMD_Function_Test_System_and_Page_Breaks")) {
  686. pageBreaksOptionStashedValue = openSheetMusicDisplay.EngravingRules.NewPageAtXMLNewPageAttribute;
  687. systemBreaksOptionStashedValue = openSheetMusicDisplay.EngravingRules.NewSystemAtXMLNewSystemAttribute;
  688. pageBreaksOptionNeedsReset = true;
  689. openSheetMusicDisplay.setOptions({ newPageFromXML: true, newSystemFromXML: true });
  690. }
  691. else if (pageBreaksOptionNeedsReset) {
  692. openSheetMusicDisplay.setOptions({ newPageFromXML: pageBreaksOptionStashedValue, newSystemFromXML: systemBreaksOptionStashedValue });
  693. pageBreaksOptionNeedsReset = false;
  694. }
  695. if (!isCustom && str.includes("Schubert_An_die_Musik")) { // TODO weird layout bug here with part names. but shouldn't be in score anyways
  696. drawPartNamesOptionStashedValue = openSheetMusicDisplay.EngravingRules.RenderPartNames;
  697. drawPartAbbreviationsStashedValue = openSheetMusicDisplay.EngravingRules.RenderPartAbbreviations;
  698. openSheetMusicDisplay.setOptions({ drawPartNames: false, drawPartAbbreviations: false }); // TODO sets osmd.drawingParameters.DrawPartNames! also check EngravingRules.RenderPartAbbreviations, was false
  699. drawPartNamesOptionNeedsReset = true;
  700. } else if (drawPartNamesOptionNeedsReset) {
  701. openSheetMusicDisplay.setOptions({ drawPartNames: drawPartNamesOptionStashedValue, drawPartAbbreviations: drawPartAbbreviationsStashedValue });
  702. drawPartNamesOptionNeedsReset = false;
  703. }
  704. }
  705. function errorLoadingOrRenderingSheet(e, loadingOrRenderingString) {
  706. var errorString = "Error " + loadingOrRenderingString + " sheet: " + e;
  707. // if (process.env.DEBUG) { // people may not set a debug environment variable for the demo.
  708. // Always giving a StackTrace might give us more and better error reports.
  709. // TODO for a release, StackTrace control could be reenabled
  710. errorString += "\n" + "StackTrace: \n" + e.stack;
  711. // }
  712. console.warn(errorString);
  713. }
  714. function onLoadingEnd(isCustom) {
  715. // Remove option from select
  716. if (!isCustom && custom.parentElement === selectSample) {
  717. selectSample.removeChild(custom);
  718. }
  719. playbackControl.initialize();
  720. // Enable controls again
  721. enable();
  722. }
  723. function logCanvasSize() {
  724. for (const zoomDiv of zoomDivs) {
  725. if (zoomDiv) {
  726. zoomDiv.innerHTML = Math.floor(zoom * 100.0) + "%";
  727. }
  728. }
  729. }
  730. function scale() {
  731. disable();
  732. window.setTimeout(function () {
  733. openSheetMusicDisplay.Zoom = zoom;
  734. openSheetMusicDisplay.render();
  735. enable();
  736. }, 0);
  737. }
  738. function rerender() {
  739. disable();
  740. window.setTimeout(function () {
  741. if (openSheetMusicDisplay.IsReadyToRender()) {
  742. openSheetMusicDisplay.render();
  743. } else {
  744. console.log("[OSMD demo] Loses context!"); // TODO not sure that this message is reasonable, renders fine anyways. maybe vexflow context lost?
  745. selectSampleOnChange(); // reload sample e.g. after osmd.clear()
  746. }
  747. enable();
  748. }, 0);
  749. }
  750. function error(errString) {
  751. if (!errString) {
  752. error_tr.style.display = "none";
  753. } else {
  754. console.log("[OSMD demo] error: " + errString)
  755. err.textContent = errString;
  756. error_tr.style.display = "";
  757. canvas.width = canvas.height = 0;
  758. enable();
  759. }
  760. }
  761. // Enable/Disable Controls
  762. function disable() {
  763. document.body.style.opacity = 0.3;
  764. setDisabledForControls("disabled");
  765. }
  766. function enable() {
  767. document.body.style.opacity = 1;
  768. setDisabledForControls("");
  769. logCanvasSize();
  770. }
  771. function setDisabledForControls(disabledValue) {
  772. if (selectSample) {
  773. selectSample.disabled = disabledValue;
  774. }
  775. for (const zoomIn of zoomIns) {
  776. if (zoomIn) {
  777. zoomIn.disabled = disabledValue;
  778. }
  779. }
  780. for (const zoomOut of zoomOuts) {
  781. if (zoomOut) {
  782. zoomOut.disabled = disabledValue;
  783. }
  784. }
  785. }
  786. /**
  787. * Creates a Pdf of the currently rendered MusicXML
  788. * @param pdfName if no name is given, the composer and title of the piece will be used
  789. */
  790. function createPdf(pdfName) {
  791. if (openSheetMusicDisplay.backendType !== BackendType.SVG) {
  792. console.log("[OSMD] createPdf(): Warning: createPDF is only supported for SVG background for now, not for Canvas." +
  793. " Please use osmd.setOptions({backendType: SVG}).");
  794. return;
  795. }
  796. if (pdfName === undefined) {
  797. pdfName = openSheetMusicDisplay.sheet.FullNameString + ".pdf";
  798. }
  799. const backends = openSheetMusicDisplay.drawer.Backends;
  800. let svgElement = backends[0].getSvgElement();
  801. let pageWidth = 210;
  802. let pageHeight = 297;
  803. const engravingRulesPageFormat = openSheetMusicDisplay.rules.PageFormat;
  804. if (engravingRulesPageFormat && !engravingRulesPageFormat.IsUndefined) {
  805. pageWidth = engravingRulesPageFormat.width;
  806. pageHeight = engravingRulesPageFormat.height;
  807. } else {
  808. pageHeight = pageWidth * svgElement.clientHeight / svgElement.clientWidth;
  809. }
  810. const orientation = pageHeight > pageWidth ? "p" : "l";
  811. // create a new jsPDF instance
  812. const pdf = new jsPDF(orientation, "mm", [pageWidth, pageHeight]);
  813. const scale = pageWidth / svgElement.clientWidth;
  814. for (let idx = 0, len = backends.length; idx < len; ++idx) {
  815. if (idx > 0) {
  816. pdf.addPage();
  817. }
  818. svgElement = backends[idx].getSvgElement();
  819. // render the svg element
  820. svg2pdf(svgElement, pdf, {
  821. scale: scale,
  822. xOffset: 0,
  823. yOffset: 0
  824. });
  825. }
  826. // simply save the created pdf
  827. pdf.save(pdfName);
  828. // note that using jspdf with svg2pdf creates unnecessary console warnings "AcroForm-Classes are not populated into global-namespace..."
  829. // this will hopefully be fixed with a new jspdf release, see https://github.com/yWorks/jsPDF/pull/32
  830. }
  831. var demoPlaybackControl = function(osmd) {
  832. var playbackListener = {
  833. play() {
  834. followCursorCheckbox.checked = true;
  835. openSheetMusicDisplay.FollowCursor = true;
  836. },
  837. pause() {},
  838. reset() {},
  839. bpmChanged() {},
  840. volumeChanged() {},
  841. volumeMute() {},
  842. volumeUnmute() {}
  843. }
  844. var timingSource = new LinearTimingSource();
  845. var playbackManager = new PlaybackManager(timingSource, undefined, new BasicAudioPlayer(), undefined);
  846. playbackManager.DoPlayback = true;
  847. playbackManager.DoPreCount = false;
  848. var playbackControlPanel = new ControlPanel();
  849. playbackControlPanel.addListener(playbackManager);
  850. playbackControlPanel.addListener(playbackListener);
  851. function initialize() {
  852. timingSource.reset();
  853. timingSource.pause();
  854. timingSource.Settings = osmd.sheet.playbackSettings;
  855. playbackManager.initialize(osmd.sheet.musicPartManager);
  856. playbackManager.addListener(osmd.cursor);
  857. playbackManager.reset();
  858. osmd.PlaybackManager = playbackManager;
  859. playbackControlPanel.clearVolumeTracks();
  860. playbackControlPanel.addVolumeTrack(playbackManager.Metronome.Name, playbackManager.Metronome.Id, playbackManager.Metronome.Volume*100);
  861. for(const instrId of playbackManager.InstrumentIdMapping.keys()) {
  862. const instr = playbackManager.InstrumentIdMapping.getValue(instrId);
  863. playbackControlPanel.addVolumeTrack(instr.Name, instrId, instr.Volume * 100);
  864. }
  865. playbackControlPanel.bpmChanged(osmd.sheet.DefaultStartTempoInBpm);
  866. }
  867. function showControls() {
  868. playbackControlPanel.show();
  869. }
  870. function hideControls() {
  871. playbackControlPanel.hideAndClear();
  872. }
  873. function IsClosed() {
  874. return playbackControlPanel.IsClosed;
  875. }
  876. return {
  877. initialize: initialize,
  878. showControls: showControls,
  879. hideControls: hideControls,
  880. IsClosed: IsClosed
  881. }
  882. };
  883. // Register events: load, drag&drop
  884. window.addEventListener("load", function () {
  885. init();
  886. });
  887. window.addEventListener("dragenter", function (event) {
  888. event.preventDefault();
  889. disable();
  890. });
  891. window.addEventListener("dragover", function (event) {
  892. event.preventDefault();
  893. });
  894. window.addEventListener("dragleave", function (event) {
  895. enable();
  896. });
  897. window.addEventListener("drop", function (event) {
  898. event.preventDefault();
  899. if (!event.dataTransfer || !event.dataTransfer.files || event.dataTransfer.files.length === 0) {
  900. return;
  901. }
  902. // Add "Custom..." score
  903. selectSample.appendChild(custom);
  904. custom.selected = "selected";
  905. // Read dragged file
  906. var reader = new FileReader();
  907. reader.onload = function (res) {
  908. selectSampleOnChange(res.target.result);
  909. };
  910. var filename = event.dataTransfer.files[0].name;
  911. if (filename.toLowerCase().indexOf(".xml") > 0
  912. || filename.toLowerCase().indexOf(".musicxml") > 0) {
  913. reader.readAsText(event.dataTransfer.files[0]);
  914. } else if (event.dataTransfer.files[0].name.toLowerCase().indexOf(".mxl") > 0) {
  915. reader.readAsBinaryString(event.dataTransfer.files[0]);
  916. }
  917. else {
  918. alert("No vaild .xml/.mxl/.musicxml file!");
  919. }
  920. });
  921. }());