berg8793 / gba-mus-ripper

An up-to-date fork of Bregalad's "GBA Mus Ripper" program.
16 stars 4 forks source link

Ripped Soundfonts Have Invalid Generators #2

Open IAGOnGithub opened 1 month ago

IAGOnGithub commented 1 month ago

I am attempting to rip the soundbanks from Pokemon Emerald (pokeemerald.gba as produced from pret's decomp project) and use them with Fluidsynth (x86_64 GNU/Linux) but encounter warning messages such as this: $ fluidsynth soundbank_0000/soundbank_0000.sf2 soundbank_0000/song0351.mid

fluidsynth: warning: Instrument 'EveryKeySplit @0x675': Some invalid generators were discarded
fluidsynth: warning: Instrument '0x676a90 key split': Some invalid generators were discarded
fluidsynth: warning: Instrument '0x676ac0 key split': Some invalid generators were discarded
fluidsynth: warning: Instrument '0x676ae4 key split': Some invalid generators were discarded
fluidsynth: warning: Some invalid sample loops were sanitized! If you experience audible glitches, start fluidsynth in verbose mode for detailed information.

Running with --verbose reveals that notes corresponding to instruments with invalid generators are duplicated multiple times, sometimes more than 70 times.

The generated soundfonts seem to work fine and sound correct when using other synthesizers, such as CoolSoft's VirtualMIDISynth on Windows. Note that I ripped the soundfonts as individual banks with the -sb flag.

IAGOnGithub commented 1 month ago

I don't know why, I don't WANT to know why, but Fluidsynth seems to be playing every sample in the instrument AT ONCE. Hence why it sounds like garbage. I have no idea how to even BEGIN to fix this, so I think I'll leave it to someone else.

IAGOnGithub commented 1 month ago

For EveryKeySplit and Key Split instruments, the keyRange generator is not the first generator in the zone. Since Fluidsynth is pedantic, it ends up rejecting the generators because of this. I have fixed this in my fork; reach out to me if you want me to file a pull request.

Not closing, since the issue is not resolved here.