Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing midi file broken #70

Closed
j0hnm4r5 opened this issue Apr 22, 2019 · 3 comments
Closed

Importing midi file broken #70

j0hnm4r5 opened this issue Apr 22, 2019 · 3 comments

Comments

@j0hnm4r5
Copy link

This is connected to an issue filed with tensorflow/magenta-js.


Issue

Importing a midi file (via magenta-js, which is using Tonejs Midi) fails with this error:

Midi.js:86 Uncaught TypeError: Decoder is not a function
    at Midi.decode (Midi.js:86)
    at Object.parse (MidiConvert.js:43)
    at Object.midiToSequenceProto (midi_io.ts:39)
    at FileReader.<anonymous> (....js:14)

Solution

Midi.js within the package midiconvert calls Decoder(bytes) from the midi-file-parser package (expecting it to be a function), except midi-file-parser exports that function within an object.

Changing const midiData = Decoder(bytes) to const midiData = Decoder.default(bytes) within node_modules/midiconvert/src/Midi.js fixes the issue.

@j0hnm4r5
Copy link
Author

j0hnm4r5 commented Apr 22, 2019

I'm actually super confused now — what is the difference between this package and the midiconvert package? Both have the same author and redirect here, but midiconvert hasn't been updated in over a year. And Midi.js within @tonejs/midi`` is different from the one within midiconvert`.

EDIT: looks like midiconvert was wrapped into @tonejs/midi with this commit?

@appsforartists
Copy link
Collaborator

This package used to be called midiconvert. I'm guessing @tambien renamed/refactored it.

It sounds like your bundler is behaving differently than what one of your dependencies was tested against.

@tambien
Copy link
Contributor

tambien commented May 6, 2019

Closing, since i don't this is still relevant in the latest version. please reopen if there are still import issues

@tambien tambien closed this as completed May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants