0

So I want to change every individual midi note into a different midi track one after the other. Here is a jsfiddle of what I have so far: https://jsfiddle.net/alexybaddie/5ca7r9g0/84/

But the general code I want some help with lies in this section and goes as follows:

var twocolors = document.getElementById("twocolor");
  var threecolors = document.getElementById("threecolor");

  if (threecolors) {

    for (let i = 0; i < 3; i++) {
      // if "3 Colors" is selected, it will change first note, second note and then the third note to different tracks each. 
      // After that it will loop again and do the same thing but for the next notes.
    }
  } else if (twocolors) {

    for (let i = 0; i < 2; i++) {
      // if "2 Colors" is selected, it will change first note and then the second note to different tracks each. 
      // After that it will loop again and do the same thing but for the next notes.
    }
  }

Also, I have no idea if I imported the midi library correctly.

Hopefully someone could help me.

Alexandra
  • 5
  • 4
  • you're using `require` in a browser script - that's not a good start, unless you're using `requirejs` - your resources in that fiddle are invalid ... you use `await` inside a function that isn't `async` ... there's not much right in the fiddle ... as for the code in the post ... creating vague comments for what you want to do is not a serious attempt to write code – Jaromanda X Jul 17 '22 at 06:16
  • I just dont know how to do it at all... I've tried looking it up a lot without really getting anything that helped me... – Alexandra Jul 17 '22 at 09:12

0 Answers0