For editing and repair of MIDI and Style files get the MIDI File Disassembler/Assembler software. Install this program.
Get MidiFile.exe and GenMidi.exe files as well. These files are executables. Just run the files, they will install in the Windows folder.
This software translates MIDI data to readable text; and backwards again. Editing a text file is somewhat easier than editing the binary data in MIDI and Style files.
Click the "Make Text" button; and select the file to repair.
If it is a style file - e.g. "HappyStyle.sty" - you will have to select "All Files" in the File Type list in the File Dialog.
During this process any error messages will be shown in the lower window; and a text file (e.g. "HappyStyle.txt") will be created in the same folder as the file opened.
Right now forget the loading error message.
Click the "Make MIDI" button; and select the text file to repair; e.g. "HappyStyle.txt".
This conversion will stop at the first error; and an error message is displayed.
Open the text file in a text editor by clicking the NotePad button. Or better select a text editor with line numbers; by selecting menu "Options" - "Set Editor".
(Top of text file showing MIDI header information)
Now go to the line mentioned in the error message; e.g. line 5441
In this file you will notice there is a Note Off event at tick 41840. This is an error; as the MIDI resolution in this file is 1920.
It is not possible to know which is the right value; but it must be less than 1920 and less than the subsequent value, in this case 1904.
Correct the error; save the text file; and start over from Step 2 until this message appears:
The following errors are corrected in the same way as described above.
- Invalid MIDI channel (chan=18)
- Invalid Note number (pitch=G-2)
- Invalid Volume (vol=189)
For valid values read the MIDI Reference
Unknown Chunks - just delete!
These examples only show few error types and only few features in the program. Get it!