Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8987761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:52:09+00:00 2026-06-15T21:52:09+00:00

I’m trying to write some functions to read in a MIDI file. I’ve been

  • 0

I’m trying to write some functions to read in a MIDI file. I’ve been referring to a number of sites that give the specification, but mostly this one: http://www.sonicspot.com/guide/midifiles.html (archive)

I have been testing it on a MIDI file for the Super Mario Bros theme that I downloaded, and I’m getting some unexpected data. It may be that the file is wrongly formatted, but I think it’s more likely that I’m doing something wrong. Here is the data (from a hex editor) that I’m having trouble with, and what I think I know about it:

4D 54 72 6B 00 00 00 19 00 FF 51 03 05 7B 71 00 FF 58 
|---------| |---------| || || || |------| || ||
    MTrk    Chunk size  || || ||  Tempo   || ||
             (25 bytes) || || ||(ms per   || ||
                        \/ || ||1/4 note) || ||
                VLen value || ||          \/ ||
          (Event at time 0)|| ||  VLen value ||
                           \/ || (event at   ||
                 Beginning of ||  time 113)  ||
                 meta-event   ||             ||
                              \/             \/
                 Meta-event type:           ????
                      set tempo

As you can see, if everything before the 0x00 is correct, then what is it doing there? The VLen value before has a binary value of 01110001 and so isn’t expecting another part of the VLen value, and therefore, AFAIK, should be an event type. However there is no event type associated with 0x0. Can anyone see where I’m going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:52:10+00:00Added an answer on June 15, 2026 at 9:52 pm

    I found the problem: meta-event codes (in my case 0x51) are proceeded by a chunk size just like normal events. The reason I thought otherwise is because, for the set tempo meta-event, the tempo data size is always 3. Therefore 51 03 05 7B 71 is actually the set tempo event code (51), the size of the tempo data (03) then the actual tempo (05 7B 71), and then the 00 is just another variable-length value telling me that the next event is at time 0.

    I hope this helps someone. I also found a better piece of documentation for the MIDI format which made this clearer: http://www.omega-art.com/midi/mfiles.html (archive)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.