MIDI Intro Pause

Smedis2's picture

Am I the only one who finds it annoying when there's a pause when a MIDI starts? This gets annoying, especially in MMF2/KNP, when a game has to load the MIDI file before loading a frame.

Why are there random pauses at the start of these MIDI files? I mean, it's usually the same length or a little longer, but what's the point of them? Is it something music related I'm just not getting?

snapman's picture

MIDI cropping

I don't know, I guess MIDI authors just like leaving a "count in" at the beginning of their files?

And a one, and a two, and a one two thee four!

I once searched for a way that would let me easily crop a midi file, but there were always weird unintended consequences to editing a random midi. The weirdest were the ones that loaded up as a single track, even though there were clearly many different instruments. And then there were the seemingly obfuscated ones that loaded up with all the notes on the very first beat of the song, and then nothing after it. There is a lot about midi that I don't understand!

So then I started doing calculated delays, so that the screen would be blank until the opening bars of the midi played. I guess I did that enough that EffBee put a joking reference to it in his KOTM50 megagame.

Smedis2's picture

>I guess I did that enough

>I guess I did that enough that EffBee put a joking reference to it in his KOTM50 megagame.
Maybe it's been awhile, but I don't remember that. I remember the PATH MOVEMENT BALLS thing and the jagged scrolling, but that's about it.

-----------------------------
An Excellent Comment/Thread/Post

snapman's picture

LOADING

=- PLEASE WAIT -=

Danni's picture

I think he's talking about

I think he's talking about how Klik and friends freeze the game while it's loading a MIDI. This is really more of a Windows MCI limitation I believe - it takes a while to buffer the MIDI. It's just that Klik chooses to block the program while MCI is loading. I think Game Maker has a similar issue, only it doesn't block the program (which is nice).

Wine's implementation of MCI doesn't have the pause at the beginning but it blocks waiting for the next MIDI event when you try to stop whatever's playing (probably due to SoundBlaster hardware MIDI timers being stupid).

Zecks's picture

edit

edit: noyb pretty much explained it. i guess it's the same for most programs with midi delay, but it's especially annoying in knp since it fucks up timer events.

if you need to sync something (knp) then either

1. use .wav music. additional pro: zero loading times. cons: enormous filesize with a lot of music.
2? do something like an active object with a path it finishes instantly, and add to a counter always after it has finished (nothing moves until the midi is loaded)

snapman's picture

Time to MIDI

I managed to sync stuff to MIDI just by using "always add 1 to counter" with midis played on start-of-frame (see Circus Galop, FEA|2 title screen). Seems like "always" events don't fire during MIDI load-in either?

Noyb's picture

Apparently the way Clickteam

Apparently the way Clickteam products handle a MIDI embedded in one's game is to first write it to disk as a temporary file, then play the MIDI from that temporary file. This introduces a significant I/O delay upon playing a MIDI file.

If you want good timing, it's probably better to convert it to an ogg (or wav in KNP) using something like Modplug Tracker.

Danni's picture

I really don't think the I/O

I really don't think the I/O is significant enough to cause the program to block. See my explanation above - it's an issue in Microsoft's implementation of the Windows MCI interface (Wine doesn't have this issue).

Noyb's picture

Ah, that'll teach me to stop

Ah, that'll teach me to stop trusting random posts on the Clickteam forums!

Smedis2's picture

Most of my MMF2 trainwrecks

Most of my MMF2 trainwrecks use Chiptunes.

-----------------------------
An Excellent Comment/Thread/Post

Smedis2's picture

Actually, Snapman was right.

Actually, Snapman was right. I didn't mean the freeze at the start of a frame.

-----------------------------
An Excellent Comment/Thread/Post

pensive-mosquitoes