ipatix / midi2agb

This is a reimplementation of Nintendo's mid2agb tool. It's not related to the original and is intended to fix a bunch of mid2agb's flaws.
MIT License
29 stars 5 forks source link

Initial notes play as drums #2

Closed HLRxxKarl closed 3 years ago

HLRxxKarl commented 3 years ago

I'm trying to see if I can export a MIDI file straight from FL Studio, run it through midi2agb, and then import it to Sappy. Loop point info doesn't save for some reason, which is probably FL Studio's fault. So I still need to use Anvil Studio to write that in. But I've also found that having a note play at the very start of the MIDI will cause it to play as a drum instead of its designated instrument. MIDIs exported through Anvil do not have this problem, but MIDIs export from FL do. My FL Studio MIDIs also don't show their first note when opened in Anvil, but the first note still plays even though you can't see it. The only time I'd want to skip exporting from Anvil is if I'm trying to quickly test something. So I can work around it, but it would be nice if this issue could be fixed.

Here's the current version of every program I'm using in this process.

And the game I'm importing my music to is Pokémon Emerald.

ipatix commented 3 years ago

Can you provide a sample MIDI file which is causing this?

HLRxxKarl commented 3 years ago

Here's a Google Drive link to a MIDI since I can't attach them to a GitHub post. https://drive.google.com/file/d/1Bk6wz2UEIYO5QgVbDaLdgA4ANoQV-wY8/view?usp=sharing

ipatix commented 3 years ago

Generally speaking, exporting complete midi information in newer software is usually difficult.

Anyway, in your example I don't see anything wrong. The pitch slides seem a little funky, but maybe that's intentional. Also I don't get any missing notes or notes that play as drums

For the loop markers, you need to have a pair of [ and ], or loopStart and loopEnd markers on one of the tracks. Allowed event types are Text, Cuepoint, or Marker.

PS: Attaching files on GitHub should work fine if you zip them first.

HLRxxKarl commented 3 years ago

Yeah, I was able to add a loop in Anvil. This is just the direct FL Studio export. The problem came when I converted that direct export into an S file without putting it through Anvil first. That's when you can hear the notes turn into drums in Sappy.

ipatix commented 3 years ago

And can you provide me with the file that exhibits this behavior? Because the one you posted previously doesn't do that for me.

HLRxxKarl commented 3 years ago

Just double checked, and that MIDI isn't showing that behavior for me either. But this one is. I even included the S file. gbamiditest6a.zip

ipatix commented 3 years ago

I see the problem now which, by the way, does infact not play anything at all for the first note. If drums are played, that's a Sappy issue and doesn't occur in the game. Still, the game will just drop out that note.

Apparently the cause is that the VOICE event somehow get's sorted after the note start event which causes a note to play with invalid instrument.

I need some time to investigate and will provide a fix as soon as possible.

ipatix commented 3 years ago

Should be fixed in latest version. See the download for v0.1.8.