OpenMPT > Technical Documents

MIDI File Import Assistant

(1/9) > >>

Note: This tool is no longer required as of OpenMPT 1.27.

I made a tool that helps you import MIDI files so that notes align to rows like you want.

When opening a MIDI file, OpenMPT focuses on fitting an even number of MIDI file ticks into one module tick based on their durations in microseconds. If you want to align MIDI file notes to module rows, you have carefully plan the size of the MIDI file ticks in microseconds yourself.

The OpenMPT MIDI File Import Assistant is focused on letting you choose what MIDI file note value the module row represents. When you set the MIDI file tempo and OpenMPT MIDI file import Speed to the indicated values, the imported MIDI file notes will align to rows as you specified. The Assistant also helps you set the beat, measure, and pattern sizes to useful values, and helps you reset the module tempo to play notes at the same speed as the original MIDI file.

The OpenMPT MIDI File Import Assistant has the following requirements:

* The MIDI file uses PPQN resolution, and you can find out the exact resolution value it uses.
* The MIDI file notes are aligned to note values (quarter notes, eighth notes, and so on).
* The MIDI file uses exactly one Tempo event at the very beginning, and you are able to change it to a different value to help the import process work correctly.
* The Assistant is an HTML file that runs in your web browser.
Update Version 1.1, 2012-04-29: Added sections and headings to clarify which values are from the MIDI file and which values you choose. Added Next/Back buttons to show the calculated steps on a separate "page".

Saga Musix:
Looks interesting for sure! Now if OpenMPT just had better MIDI support... :D

Okay, i gave it a good try, using Anvil as my MIDI import/export application...
I've never used a web-based app before so this was brand new to me, and i wasn't sure what it would do. From your description i thought it would prepare a MIDI track for importation by MPT, but not so -- i hafta do all the work! >:(   Oh, well... :P
Once i figured where to find the info the little program needed, i followed its instructions and altered the MIDI, saved it*, and then imported it into MPT, which, for those who don't know, will transmogrify the MIDI data (not the MIDI file itself, so that's safe) into an IT-compat track. *Word to the wise: once you make your changes suggested by this MIDI Helper to the MIDI file you want to bring over to MPT, be sure to save it as another file, as you will often hafta change the tempo setting for import, meaning the MIDI file will have a new tempo.
I tried a couple of my own MIDI files assembled on a Mac with Master Tracks Pro-4, as well as third party .mid files that came from various sources. The tracks composed on Pro-4 did not retain MIDI instruments (or else Anvil couldn't read them), so i often had to fix that.
But anywho, following the instructions DID lead to a better import into MPT. There should be clearer instructions as to the "Row units" as in, "Which note length should one row in MPT represent? Enter its Units amount." or some such. But i did figure it out eventually (i'll be the first to admit i overthink things) and when i followed the instructions it seemed to always work. It is after all only a helper, and what it's helping you do is modify the tempo of the original track, then fixing MPT's MIDI Import options so it'll delineate it properly into your patterns.
So all in all, it does what it's supposed to do, and makes MIDI import 100 times easier, as it does all the calculations for you. But it is a bit clunky and with this wonderful technology, it should somehow be incorporated into MPT's GUI.
Excellent work, Bavi! ;D  We thank you!! 8)

I started this project because I was frustrated that when OpenMPT opened a MIDI file, the notes didn't align to rows in any predictable way. When I searched online I couldn't find any explanation of how OpenMPT aligns MIDI file notes to rows, and only found suggestions to play around with the MIDI file import settings.

So I dug into the OpenMPT code to figure out how the the MIDI file import converts MIDI file durations into module rows. Once I understood how it works, I determined you could select a specific MIDI file tempo and import Speed setting to control what note value is assigned to a row. So I started to make an HTML file JavaScript calculator to help you choose the correct values. But I kept thinking of other things you would want to set: You want to make sure the pattern size is useful, and the measure size, and the beat size. And since you usually have to change the MIDI file tempo as part of this process, wouldn't it be helpful if you could change the module tempo back to match the original MIDI file tempo? So I added those calculations too, but this made it a bit more complicated to use. I think I'll expand the readme file with more instructions this weekend.

If OpenMPT's MIDI file import is ever eventually revised, perhaps the concept of fitting MIDI file ticks into module ticks could be abandoned. (I don't understand if that is ever useful?) In the MIDI file import settings, perhaps the Speed setting could be removed and replaced with a setting for how many MIDI file ticks to put into a row, or how many rows to put into a MIDI file quarter note.

P.S. For editing MIDI files, have you heard of Sekaiju? It has a few drawbacks (difficult to enter time signature, doesn't play notes well if you switch to another application, limited notation view), but it is better looking and more organized than Anvil Studio. (If you download Sekaiju, be sure to change the Language setting in the ini file to English.)

P.P.S. For MIDI file notation view, I like Notation Player. (The download link is at the bottom of the comparison table.)

Saga Musix:
The MIDI loader will eventually be rewritten - when that is going to be, I have no idea, though. I have the MIDI import code of BeRoTracker lying around here (which allegedly works better than OpenMPT's), but it's in Delphi, so I'll have a *very* hard time translating this (if someone's both fluent with Delphi and C++... hint hint).


[0] Message Index

[#] Next page

Go to full version