musicXML importing

Hello, I need to import a musicXML file into p5js por parsing

I found this post

Do you have any hints for doing this?

hi! have you tried this?

if you import with CDN

<script src=""></script>

the functions seem to be exposed to global (like p5.js).


Thank you, yes.
Apparently there’s an issue when importing XML files into p5.js
I’m getting all sorts of issues.

This worked with musicXML files

let img, button, stringy;

function setup() {
  img = createCanvas(300,300);
  button = createButton('2. show string');
  document.getElementById('upload').addEventListener('change', readFileAsString)

function draw() {

function readFileAsString() {
    var files = this.files;
    var reader = new FileReader();
    reader.onload = function(event) {
        console.log('File content:',;
      stringy =;

function printy(){

For those of you that want to work with another type of XML files that doesn’t have the XML extension, this is a solution.

1 Like

I got in touch with the people of OpenSheetMusicDisplay that unites Vexflow.js and musicXML
Thank you!