Comments (4)
Thanks for the bug report. I've looked into this and the file is being successfully parsed, but there are two trailing bytes at the end of the file: 0x0D 0x0A. Because these bytes are unexpected, the file is technically considered malformed, even though these bytes are of no apparent consequence.
Thus far I cannot find any reason for them being there. There is nothing in the SMF spec that mentions what they would be for. It's possible to ignore them but I'd rather get to the bottom of why they might be there in the first place if possible before resorting to that.
from midikit.
Appears they are the \r\n characters. Maybe someone edited the file with a hex editor on windows, and when saved it added carriage return line feed?
from midikit.
I have developed parsers using Antlr, and this was always a problem between Windows and Unix. Here is one from IBM.
https://www.ibm.com/support/pages/additional-carriage-return-and-line-feed-added-during-sterling-connectdirect-file-transfer
from midikit.
Yeah it's a Windows CRLF byte pair. Really odd. But if someone attempted editing the file in a text editor then maybe that explains it. Some of the MIDI files out in the wild have survived decades and who knows what happened along the way.
On a related note: I sourced a zip file of about 30,000 crowd-sourced MIDI files from the web and ran all of them through a test harness that had MIDIFile
parse them to catch any misfits. It returned a number of results so I'm going to go through those soon and see if the parser can be made more resilient to malformed or unexpected files.
from midikit.
Related Issues (20)
- Deflake Unit Tests
- Move bluetooth SwiftUI views/classes into MIDIKit?
- midiManager.endpoints and midiManager.devices.devices only give an empty list `[]` HOT 1
- Example: Wired USB Connection from iOS device to Mac HOT 3
- Expose inits for CoreMIDI packets and packet lists HOT 2
- MIDI 2.0 RPN/NRPN HOT 3
- MIDI Notification - Object `removed` may return empty metadata HOT 1
- MIDI Thru Connections are not supported on this platform due to Core MIDI bugs. HOT 16
- Broken link in docs for Event Filters HOT 3
- MIDIEventLogger example In Advanced Examples folder won't build HOT 13
- `MIDIFile` could use `Hashable` conformance HOT 1
- Crash while parsing MIDI file HOT 1
- Translation of Note On with 0 Velocity to Note Off Should Be Opt-In (Off by Default) HOT 1
- `MIDIFile`: Add structure validation
- MTCVideoPlayer project fails to build HOT 1
- Convert `MIDIManager` to global singleton
- MIDIKitSMF: slow parse time for very big SMF files HOT 2
- Docs: "MIDI.File" typo? HOT 3
- ProgramChange midi1RawBytes() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from midikit.