MidiKit showing length in Meta-Event

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

MidiKit showing length in Meta-Event

madGambol
Hi,
Does MidiKit show the "len" value in the output for Meta-Events? I'm thinking that it's showing that meta-event data literally and it accepts anything there in the "len" position.

Shouldn't MidiKit complain when the "len" value doesn't match the data provided? Highlight the bad value(s) ... something?

Thanks,
madGambol
Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

mixage
Administrator
MidiKit DOES NOT show the length byte(s) of Meta events and Sysex Events. You don't have to care about this.

The data column shows the meta event minus the length bytes:

Meta event text FF01 and 41414141 ("AAAA")
Mixage Software
www.mixagesoftware.com
support@mixagesoftware.com
Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

madGambol
While it is nice not to have to worry about the length, if you're writing code to write that file, it would be nice to see that it has been written correctly as expected.

The data column is effectively a view of the data and not the actual data. When I see a column labeled "data", I expect to see without any filtering or processing exactly what all that data is.

Because of the variable width length fields, there's a twist to it. The msb can't be used to sync up to a command boundary when any length greater than 127 is in the stream, and since other midi messages can be present with these msb's set when lengths go more than 127 bytes.

Is there a tool to show, essentially as it is in MidiKit, all the data including the length bytes under the "data" column?

Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

madGambol
In reply to this post by mixage
I'm using the library MidiFile to encode the midi output file.

MidiKit is not displaying blocks of text > 127 bytes correctly. I wrote a MIDI test file that should have text starting with "ABCDEFG ... XYZ1234567890... <then special chars> <loop counter value as decimal number", repeated and extended 31 times.

The first two meta event text  values are OK because they're under 128 bytes. The third one is wrong as it begins with "4ABC...". The text under each event is stopping incorrectly after the first one on the .LF. I terminated the text with for each line of the string.

The library I'm using to encode the data is correctly formatting the length as a variable width field. The third meta-event has the length 180, which is encoded as the bytes 0x81 0x34 in the file. Those bytes re-packed become 0xb4 or 180 (decimal). I can't tell exactly what's being done with the 0x81, but the 0x34 is showing up as the first byte of the text, followed by the actual text of the text meta event, ending on the .LF..

I don't see how to attach files in this post, but I put my test MIDI file under this dropbox link:

https://www.dropbox.com/s/7r0klcv2g3dcye7/test-long-midi-text.midi?dl=0">https://www.dropbox.com/s/7r0klcv2g3dcye7/test-long-midi-text.midi?dl=0

What are the chances of a patch/correction for this?

Thanks,
madGambol


Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

madGambol
Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

mixage
Administrator
Yes, there's a bug here. Will fix this asap, thanks
Mixage Software
www.mixagesoftware.com
support@mixagesoftware.com
Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

mixage
Administrator
This post was updated on .
In reply to this post by madGambol
Fixed here:

http://www.mixagesoftware.com/private/beta/midikit-432b1.zip
User: beta_tester
Pass: iwannatest

Let me know if it's OK, thanks for testing.
Mixage Software
www.mixagesoftware.com
support@mixagesoftware.com
Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

madGambol
Thanks for addressing this issue.

I see the text ("Third") column being displayed OK, but the data column shows, in the case of the third meta-event in my original test file, the second byte of the length (0x34) as part of the text data.

I would prefer to see the data, including the length byte or bytes, exactly as it is in the meta-event rather than having it hidden in the data column.

Right now the first length byte (it appears) is hidden, the second and following length bytes are showing. My original test data file doesn't have a meta-event that would have a 3 byte length, but I've generated one.

The file at the following drop box link has 4 meta-events: 127, 128, 16383, and 16384 bytes long. The first displays OK, the other three show 1, 1, and 2 bytes of the length bytes in the data window respectively.

https://www.dropbox.com/s/6wcwmwkelog5409/test-4-meta-events-midi-text.midi?dl=0

I generated a test file with a 3 byte length  (file size ~536Mbytes long) but MidiKit Beta wouldn't open it. It had two really big meta events with a 3 byte length (0x0fffffff and 0x0fffffff+1 bytes).

Chris
Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

mixage
Administrator
You are a great beta tester :) Will fix this asap
I originally choose to hide the len bytes because the data column is editable on sysexes, which have no such bytes in the midi message. But yes, the meta events are not midi messages.
Mixage Software
www.mixagesoftware.com
support@mixagesoftware.com
Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

mixage
Administrator
In reply to this post by madGambol
Fixed. This was a visual only issue.

http://www.mixagesoftware.com/private/beta/midikit-432b2.zip
User: beta_tester
Pass: iwannatest

Let me know if it's OK, thanks for testing.
Mixage Software
www.mixagesoftware.com
support@mixagesoftware.com
Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

madGambol
You fixed the display of the length bytes: they're not showing any more in the wrong place. So the display of data is "good" for normal small-ish meta-event but with one issue I still have...

The length of the meta-event should be shown --- otherwise it's just invisible. You stop displaying the TEXT when you encounter a 0x0a ('\n') in the data ... also hiding that subsequent text. To really be complete, that length data should be shown, and the clearest, cleanest way to show it is in the data column along with the rest of the data shown there. Or maybe have a "length" column? Without showing ALL the data, it's really not editable.

As for the handling of large files: I generated a series of not-too-large files and Midi-Kit Beta 2 fails -- or rather -- has trouble with the file containing the meta-event 65535 bytes long. The file with 32768 bytes in the meta-event is OK as far as I can see.
 
The text it shows in the 65535 case is garbled and complains that it's invalid data in the "data" column, and the file with meta-event 65536 bytes doesn't show any text and no data at all, it just show "FF 01" under the "data" column. The "ticks" column value contains the size of the meta-event in bytes, BTW. I filled in that field with the meta-event size.

It's possible that the library I'm using for the midi file write has a bug with files this large, but it handles files UP to 32768 bytes in the meta-event OK. Are you using the algorithm outlined in the MIDI File spec to read the variable length field and not an abbreviation of it? I have code for that which uses iterators and not putc/getc.

All the test files so far are at the following drop-box link:

https://www.dropbox.com/sh/a0tekqnarv1jvss/AAAeaBiQ2-l36xYP8FLrJSn5a?dl=0

I really would like to see the size info in the data column.

Nobody else wants that? I can give you my code to write the test files if you're interested. You can generate your own test files!

Thanks,
madGambol



Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

mixage
Administrator
Fixed

http://www.mixagesoftware.com/private/beta/midikit-432b3.zip
User: beta_tester
Pass: iwannatest

Text is not truncated. newline is handled as a new line.

Mixage Software
www.mixagesoftware.com
support@mixagesoftware.com
Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

madGambol
It looks as though all problems are solved that I found!
Now if there was only a way to actually see how big that meta event was! Or edit the data. Most of the time the ticks field won't have the byte count as my test files did.

What does the Select->Edit option allow you to do?

Cheers!

madGambol ....
Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

madGambol
What is it that MidiKit is doing to the file that it thinks the file is "dirty" and needs to be written? This is pretty annoying to get that "lose changes?" warning EVERY TIME YOU DISMISS the file you opened in Midikit AND MADE NO MODIFICATIONS!!!!!
How big a contribution do I need to make to get that annoying message to stop?
Cheers!!
madGambol

... there is nothing either good or bad, but thinking makes it so.
-- Shakespeare


On Wed, Nov 13, 2019 at 5:28 PM madGambol [via QMidi Forum] <[hidden email]> wrote:
It looks as though all problems are solved that I found!
Now if there was only a way to actually see how big that meta event was! Or edit the data. Most of the time the ticks field won't have the byte count as my test files did.

What does the Select->Edit option allow you to do?

Cheers!

madGambol ....


If you reply to this email, your message will be added to the discussion below:
https://forum.mixagesoftware.com/MidiKit-showing-length-in-Meta-Event-tp1657p1684.html
To unsubscribe from MidiKit showing length in Meta-Event, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: MidiKit showing length in Meta-Event

mixage
Administrator
For free :

UNCHECK THE "TRY TO GUESS ENCODING" OPTION IN THE PREFERENCES!!!!!
Mixage Software
www.mixagesoftware.com
support@mixagesoftware.com