Thread with 11 posts
jump to expanded posthey wait you could write a song with midi that's almost entirely printable ascii. with some effort, i wonder if it could even be valid utf-8. hmmmmm
@hikari Apropos of nothing I created a MIDI file using Perl some years ago that at the time Quicktime Player could play and browsers of the time could play but something is wrong with it and most music software I try to import it into cannot play it. I do not know how to fix this.
@mcc i would be more than happy to debug it for you, if you can get it to me via some reasonable medium! i have written a Standard MIDI File parser and know the MIDI spec like the back of my hand at this point, i can probably figure out what's wrong with it
@hikari !!
That is a very exciting offer! This is the MIDI file. https://data.runhello.com/file.mid
I cannot, for example, open it in VLC, testing on my windows 10 machine this second.
I will tell you what it is in the next post, but you might find it an interesting data puzzle to figure out what this song "is" on your own.
$ file
file.mid: Standard MIDI data (format 0) using 1 track at 1/16480
oh, that's a very high time resolution, usually it's something like 1/240
Error: "Unrecognized SMPTE format"
ohhhhh. the time division is so big that the reserved bit (sign bit) marking whether it's using SMPTE time codes instead has been unintentionally clobbered (https://github.com/hikari-no-yume/SoundPalette/blob/bb6b09dd7d411ec1f4f1ac9eed77bece0b7b43f5/src/midi.rs#L171-L182)
so my midi parser looks at it, tries to recognise which of the four video framerates is in use, sees it isn't a recognised one, and crashes; that's probably what most MIDI players are doing
@hikari ohh, geez
I wonder if I'm actually getting any advantage from that. The notes are all of the same length (I don't remember if they're all a full quarter-note long, but other than potentially releasing a little early nothing does anything except on the same beat)
@mcc i think it's far higher resolution than the original midi physical interface can handle even ^^;
i surveyed some of the midi files i have and 1/960 was the highest resolution i saw, 1/480 is more typical
@hikari hm so i guess i'll need like, a raw c midi importer that can import my incorrect format so i can export it again correct!
maybe ii'll fork the soundpallete thing >_>
@mcc it happens to be a good base for this! check out the most recent commit, i used it last week to solve my own unusual midi problem
@mcc the exporter isn't perfectly faithful, currently it collapses all tracks into one, but for most songs that's not a problem (channels are still kept separate, main casualty is track name metadata)