首页 > 解决方案 > Parsing musicXML files with p5js library

问题描述

Is there a way to import a musicXML file into p5js?

I got this

let input,img;

function setup() {
  img = createCanvas(100,100);
  img.drop(fail);
  /*
  input = createFileInput(handleFile);
  input.position(0, 0);
  */
}

function draw() {
  background(220);
}

function fail(data) {
  var x = loadXML(data);
}

But it throws a

 p5.js says: It looks like there was a problem loading your XML file. Try checking if the file path (Error: [object ReadableStream]) is correct, hosting the file online, or running a local server. (More info at https://github.com/processing/p5.js/wiki/Local-server) 

A middle point solution is to be found in this website but I do not know how to translate the code into p5js

标签: musicxml

解决方案


推荐阅读