midi-parser-js icon indicating copy to clipboard operation
midi-parser-js copied to clipboard

Not parsing correctly

Open steveschow opened this issue 5 years ago • 5 comments

I have run into bugs with this parser...

I made a simple midi region in LogicPro with notes one tick apart. I export this region as type 0 midi file. When I parse this midi file with midi-parse-js and log the parsed JSON immediately, it is showing incorrect structure in the JSON structure. the notes are being parsed as meta events with -1 deltaTime... I don't know how to attach the midi file to this ticket but if you ask me for it I can send it in email.

{
  "formatType": 0,
  "tracks": 1,
  "track": [
    {
      "event": [
        {
          "deltaTime": 0,
          "type": 255,
          "metaType": 32,
          "data": 0
        },
        {
          "deltaTime": 16259,
          "type": 255,
          "metaType": 6,
          "data": "nst 1\u0000ÿ\u0004\u0006Inst 1\u0000ÿX\u0004\u0004\u0002\u0018\b\u0000ÿY\u0002\u0000\u0000\u0000ÿT\u0005!\u0000\u0000\u0000\u0000\u0000ÿQ\u0003\u0007¡ \u0000<P\u0000=P\u0000>P\u0000?P\u0000@P\u0000APx€<\u0000\u0000=\u0000\u0000"
        },
        {
          "deltaTime": 62,
          "type": 255,
          "metaType": 0,
          "data": -1
        },
        {
          "deltaTime": 63,
          "type": 255,
          "metaType": 0,
          "data": -1
        },
        {
          "deltaTime": 64,
          "type": 255,
          "metaType": 0,
          "data": -1
        },
        {
          "deltaTime": 65,
          "type": 255,
          "metaType": 0,
          "data": -1
        },
        {
          "deltaTime": -1
        }
      ]
    }
  ],
  "timeDivision": 480
}

steveschow avatar Apr 26 '20 20:04 steveschow

Hi @steveschow you can send me the .midi file to [email protected] so i can analyse better what's causing the issue. Thanks for reporting the bug!

colxi avatar Apr 27 '20 17:04 colxi

Hello! Thanks for making this library. I'm also having issues with a simple MIDI file from logic. I just get one event with infinity as the value:

{
  formatType: 0,
  tracks: 1,
  track: [
    {
      event: [
        { deltaTime: 1440, type: 255, metaType: 32, data: 0 },
        {
          deltaTime: 16259,
          type: 255,
          metaType: 23,
          data: 2.8996905316392495e+160
        },
        { deltaTime: 2123, type: 255, metaType: 98, data: Infinity },
        { deltaTime: -1 }
      ]
    }
  ],
  timeDivision: 480
}

I'll send you the MIDI file. Thanks!

alana314 avatar Dec 11 '20 02:12 alana314