UNPKG

vexflow-musicxml

Version:

MusicXml Parser for vexflow

44 lines (39 loc) 1.09 kB
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Vexflow MusicXML integration</title> </head> <body> <style> html, body, canvas { width: 100%; height: 100%; margin: 5px; } </style> <script src="../build/vexflow-musicxml.js"></script> <script> const reader = new FileReader(); const openFile = function(event) { const input = event.target; reader.onload = function(){ const dStart = new Date(); const text = reader.result; const node = document.getElementById('output'); const vex = new Vex.Flow.MusicXmlRenderer(text, node); const dStop = new Date(); console.log('Time for loading: ' + (dStop.getMilliseconds() - dStart.getMilliseconds()) + ' ms'); }; reader.readAsText(input.files[0]); }; </script> <form name="foo" method="post" enctype="multipart/form-data"> <input type='file' accept='text/xml' onchange='openFile(event)'><br> </form> <canvas id='output' width='1280' height='1024'> </canvas> </body> </html>