grimmdude / MidiWriterJS

♬ A JavaScript library which provides an API for programmatically generating and creating expressive multi-track MIDI files and JSON.
MIT License
547 stars 58 forks source link

Error MidiWriter is not defined #40

Closed fornof closed 6 years ago

fornof commented 6 years ago

So, I have a "Uncaught ReferenceError: MidiWriter is not defined" , even though I imported on the front end. There is a folder in node_modules for "Browser" index.min.js , I was hoping that could be used to read midi, modify it , then write midi back to a file blob on the front end/browser.

just trying :

// Start with a new track
var track = new MidiWriter.Track()
track.addEvent(new MidiWriter.NoteEvent({pitch: 'C5', duration: 'T4550'}))
var track = new MidiWriter.Track();

// Define an instrument (optional):
track.addEvent(new MidiWriter.ProgramChangeEvent({instrument : 1}));

// Add some notes:
var note = new MidiWriter.NoteEvent({pitch:['C4', 'D4', 'E4'], duration: '4'});
track.addEvent(note);

// Generate a data URI
var write = new MidiWriter.Writer([track]);
console.log(write.dataUri());`

does not work as I get the error.
I imported in the tag:

Githubissues.
  • Githubissues is a development platform for aggregating issues.