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

Timeout on midi.header.ticksToSeconds, when using a midi made by MuseScore. midi.tracks[0].endOfTrackTicks undefined. #187

Open
Seda145 opened this issue Nov 29, 2023 · 1 comment

Comments

@Seda145
Copy link

Seda145 commented Nov 29, 2023

Timeout and browser hang when attempting to read the time of a track by midi.header.ticksToSeconds,
midi.tracks[0].endOfTrackTicks undefined.
Problem only occurs on midi made by MuseScore for some reason.
midi.zip

Script terminated by timeout at: r@file:///************************/libs/ToneJS-Midi/Midi.js:24:10417 535/t.prototype.ticksToSeconds@file:///************************/libs/ToneJS-Midi/Midi.js:24:16781

The midi object:
{ "header": { "tempos": [ { "bpm": 120, "ticks": 0, "time": 0 } ], "timeSignatures": [ { "ticks": 0, "timeSignature": [ 4, 4 ], "measures": 0 } ], "keySignatures": [ { "key": "C", "scale": "major", "ticks": 0 } ], "meta": [], "name": "5-str. Electric Bass, Electric Bass" }, "tracks": [ { "name": "", "notes": [ { "midi": 33, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 0, "durationTicks": 479 }, { "midi": 35, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 480, "durationTicks": 479 }, { "midi": 37, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 960, "durationTicks": 479 }, { "midi": 38, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 1440, "durationTicks": 479 }, { "midi": 40, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 1920, "durationTicks": 479 }, { "midi": 42, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 2400, "durationTicks": 479 }, { "midi": 44, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 2880, "durationTicks": 479 }, { "midi": 45, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 3360, "durationTicks": 479 }, { "midi": 47, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 3840, "durationTicks": 479 }, { "midi": 49, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 4320, "durationTicks": 479 }, { "midi": 50, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 4800, "durationTicks": 479 }, { "midi": 52, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 5280, "durationTicks": 479 }, { "midi": 54, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 5760, "durationTicks": 479 }, { "midi": 56, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 6240, "durationTicks": 479 }, { "midi": 57, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 6720, "durationTicks": 479 }, { "midi": 56, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 7200, "durationTicks": 479 }, { "midi": 54, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 7680, "durationTicks": 479 }, { "midi": 52, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 8160, "durationTicks": 479 }, { "midi": 50, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 8640, "durationTicks": 479 }, { "midi": 49, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 9120, "durationTicks": 479 }, { "midi": 47, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 9600, "durationTicks": 479 }, { "midi": 45, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 10080, "durationTicks": 479 }, { "midi": 44, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 10560, "durationTicks": 479 }, { "midi": 42, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 11040, "durationTicks": 479 }, { "midi": 40, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 11520, "durationTicks": 479 }, { "midi": 38, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 12000, "durationTicks": 479 }, { "midi": 37, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 12480, "durationTicks": 479 }, { "midi": 35, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 12960, "durationTicks": 479 }, { "midi": 33, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 13440, "durationTicks": 479 }, { "midi": 28, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 17280, "durationTicks": 1919 }, { "midi": 33, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 19200, "durationTicks": 1919 }, { "midi": 38, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 21120, "durationTicks": 1919 }, { "midi": 43, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 23040, "durationTicks": 1919 }, { "midi": 28, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 24960, "durationTicks": 479 }, { "midi": 33, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 25440, "durationTicks": 479 }, { "midi": 38, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 25920, "durationTicks": 479 }, { "midi": 43, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 26400, "durationTicks": 479 }, { "midi": 33, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 28800, "durationTicks": 479 }, { "midi": 28, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 29280, "durationTicks": 479 }, { "midi": 33, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 29760, "durationTicks": 479 }, { "midi": 28, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 30240, "durationTicks": 479 }, { "midi": 28, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 30720, "durationTicks": 479 }, { "midi": 40, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 31200, "durationTicks": 479 }, { "midi": 35, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 31680, "durationTicks": 479 }, { "midi": 40, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 32160, "durationTicks": 479 }, { "midi": 45, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 32640, "durationTicks": 479 }, { "midi": 40, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 33120, "durationTicks": 479 }, { "midi": 45, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 33600, "durationTicks": 479 }, { "midi": 40, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 34080, "durationTicks": 479 }, { "midi": 28, "velocity": 0.6299212598425197, "noteOffVelocity": 0, "ticks": 34560, "durationTicks": 479 } ], "pitchBends": [], "instrument": { "number": 33 }, "channel": 0 }, { "name": "", "notes": [], "pitchBends": [], "instrument": { "number": 0 }, "channel": 0 }, { "name": "", "notes": [], "pitchBends": [], "instrument": { "number": 36 }, "channel": 0 }, { "name": "", "notes": [], "pitchBends": [], "instrument": { "number": 0 }, "channel": 0 }, { "name": "", "notes": [], "pitchBends": [], "instrument": { "number": 37 }, "channel": 0 } ] }

@Seda145
Copy link
Author

Seda145 commented Dec 3, 2023

Problem occurs on a variety on midi files including new ones exported by MuseScore, Audacity, Tuxguitar. I want to use this plugin for MeloNade. The ticksToSeconds method is used for the html visualizer.

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

1 participant