Can someone suggest me how to compare 2 MIDI files? Say MIDI 1 consist of song sequence "XXXYYYYYLLLL" and MIDI 2 consist of song sequence "LLLL", Now i know that MIDI 1 contains MIDI 2, but how to do that programmaticaly? Thanks in advance.
Eh? I don't think I really understand what you're asking.
-Ev
I think I understand. You're wanting to write a program that determines whether a given MIDI sequence appears inside another sequence. Whew! That sounds like a lot of work.
You could do it simply, by stripping out the header information from both files, and then doing a byte-wise comparison. But that would only work if the sequence appeared exactly as given, including exact note lengths, velocities and MIDI channels. Otherwise, you'd have to have a program that read MIDI events into some sort of note object, and then compared notes, ignoring things like velocity, and small changes in length etc.
This would be a fair-sized undertaking. I suggest finding a suitable programming forum, and asking the question there.
Robin
You'll probably find the task a lot easier if you use Jeff Glatt's Midi disassembler (http://www.borg.com/~jglatt/progs/software.htm) to parse the midis into text files. It allows a wide range of filters, so you can suppress information you don't care about, making comparison using an external program easier.
Older versions of this program had a bug that caused a crash on some midi files, but this has been fixed in the current release.
Fred
Assuming the midis are using the same clef, key sig., intruments and rhythm, then a simple "compare files" with Windows Commander (http://www.ghisler.com/) should do it.
Using a text-file generated by a tool such as Fred suggests may be of great help too, with the same "compare" function.
I suggest this tool instead of others specifically doing comparisons, because 1st it's usually cheaper and 2nd it allows you much, much more (replaces viewers, ftp, explorer, file manager, etc). I can't live on a PC computer without it (it even runs under Wine on linux, though midnightcommander is available there).
If you just want the "diff" program (from unix world, for dos/windows), please ask me. But it's rather "spartiat"...
Aside of this, I know that the "SACEM (http://www.sacem.fr/english/index.html)" uses such a tool developed by the "IRCAM (http://www.ircam.fr/index-e.html)", to make sure that a new musical piece proposed to copyright is not too similar to a previous reg'ed one. Maybe you could ask them if this program is available, which I doubt.
Thanks to all. Your suggestions have been very helpful.