nfroidure / midifile

A MIDI file parser/writer using ArrayBuffers
http://karaoke.insertafter.com
MIT License
199 stars 30 forks source link

stream.end is not a function running example code #17

Closed turnerhayes closed 8 years ago

turnerhayes commented 8 years ago

I get the error stream.end is not a function when trying to run the getTrackEvents() part of the sample code in the Readme. It looks like trackEventsChunk is an array, while MIDIEvents.createParser() expects a stream and tries to call .end() on it. Is the sample code out of date?

nfroidure commented 8 years ago

Such an old project but afaik this libs does not expose NodeJS streams but sort of generators. Do not use .edn() but next() until it returns notihng

turnerhayes commented 8 years ago

The .end() call is not within the demo code, it's within the lib code--see https://github.com/nfroidure/MIDIEvents/blob/master/src/MIDIEvents.js#L126

Maybe this issue should go under that project, but the demo code that triggered it is in this project's Readme.

The problem is that the return value of getTrackEvents() is an array, not a stream, and the .createParser() seems to expect a stream (or similar construct).

nfroidure commented 8 years ago

Ok, found the problem: https://github.com/nfroidure/MIDIFile/commit/82f26c119ee10e8afeb15e642627b678706950ff

This project really needs a total rewrite imo ;)