Acmlm's Board - I2 Archive - Programming - How do you extract "musical notes" from an MIDI track???
User | Post |
eNathan
Posts: 29/33 |
Thanks for the link. I singed up to the site to download the control, and still have not recieved my password via Email
Lets get a little into the actaul format of an MIDI for a sec. If anybody knows the midi format, please reply to this as I am a little lost.
Here are the MTHD and MTRK record's I have created based on this http://www.borg.com/~jglatt/tech/midifile.htm
Type MTHD_CHUNK = Record ID: Array [1..4] of Char; Length: Integer;//4 byte Integer = Unsigned Long??? Format: ShortInt;//2 byte integer NumTracks: ShortInt; Division: ShortInt; End;
Type MTRK_CHUNK = Record ID: Array [1..4] of Char; Length: Integer; Data: Char; End;
There is only one problem with this, which should't really be a problem. The first 8 bytes of the MIDI file reads (in hex)
4D 54 68 64 00 00 00 06
The first 4 bytes of this (4D 54 68 64), when read as a 4 byte string, reads "MThd". The next four bytes (00 00 00 06), when read as a 4 byte integer should read 6! Because 00 00 00 06 = 6! However, Delphi is telling me that it equals 100663296. I am stuck on this problem. I have tried using all 4-byte data types (afak), and none of them equal 6.
Any further help would be great.
Edit :: I found out that the 4 bytes [00 00 00 06] were actaully in "reverse byte order", so I grabed this procedure to reverse the bytes again, yeilding the value of 6.
procedure Swap32(var src, dest) ; asm mov ecx, dword ptr[eax] ; bswap ecx ; mov dword ptr[edx], ecx end ;
But why in the word are the bytes reversed in the midi file? You are just going to have to reverse them back. Or is there something I dont know...?
*Please move this to the programming section* |
Book Keeper
Posts: 157/160 |
*bump*
You'll be able to do that with finale notepad. |
eNathan
Posts: 28/33 |
Hey Acmlmer's.
I basicly want to extract the musical notes from MIDI tracks. I have google'd all I can google with no luck.
I am assuming there are two ways.
1. Write your own data type to handle the MIDI format (I dont know the structure of an MIDI, however).
2. Use a control (ActiveX, Component, whatever) to do it for you. However, I have not found any.
I am using Delphi by the way. I can read VB and C++ tho, if anybody wants to post in those languages.
~eNathan 3.14 |
|